Browse files

Merge branch 'wip_master_mdl-32724' of https://github.com/iarenaza/mo…

  • Loading branch information...
2 parents 0527e02 + a845160 commit c9f5f0afd37fc3c486df700dfa04996da83348ae Sam Hemelryk committed Feb 10, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 auth/ldap/auth.php
View
11 auth/ldap/auth.php
@@ -1182,6 +1182,7 @@ function user_update($olduser, $newuser) {
return false;
}
+ $success = true;
$user_info_result = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
if ($user_info_result) {
$user_entry = ldap_get_entries_moodle($ldapconnection, $user_info_result);
@@ -1236,8 +1237,10 @@ function user_update($olduser, $newuser) {
if ($nuvalue !== $ldapvalue) {
// This might fail due to schema validation
if (@ldap_modify($ldapconnection, $user_dn, array($ldapkey => $nuvalue))) {
+ $changed = true;
continue;
} else {
+ $success = false;
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
array('errno'=>ldap_errno($ldapconnection),
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
@@ -1256,6 +1259,7 @@ function user_update($olduser, $newuser) {
$changed = true;
continue;
} else {
+ $success = false;
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
array('errno'=>ldap_errno($ldapconnection),
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
@@ -1273,6 +1277,7 @@ function user_update($olduser, $newuser) {
$changed = true;
continue;
} else {
+ $success = false;
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
array('errno'=>ldap_errno($ldapconnection),
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
@@ -1286,6 +1291,7 @@ function user_update($olduser, $newuser) {
}
if ($ambiguous and !$changed) {
+ $success = false;
error_log($this->errorlogtag.get_string ('updateremfailamb', 'auth_ldap',
array('key'=>$key,
'ouvalue'=>$ouvalue,
@@ -1295,12 +1301,11 @@ function user_update($olduser, $newuser) {
}
} else {
error_log($this->errorlogtag.get_string ('usernotfound', 'auth_ldap'));
- $this->ldap_close();
- return false;
+ $success = false;
}
$this->ldap_close();
- return true;
+ return $success;
}

0 comments on commit c9f5f0a

Please sign in to comment.