mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-32724: LDAP Auth function user_update() returns true even if update has failed
This commit is contained in:
parent
183515da23
commit
a8451603cf
1 changed files with 8 additions and 3 deletions
|
@ -1182,6 +1182,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$success = true;
|
||||||
$user_info_result = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
$user_info_result = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
|
||||||
if ($user_info_result) {
|
if ($user_info_result) {
|
||||||
$user_entry = ldap_get_entries_moodle($ldapconnection, $user_info_result);
|
$user_entry = ldap_get_entries_moodle($ldapconnection, $user_info_result);
|
||||||
|
@ -1236,8 +1237,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
if ($nuvalue !== $ldapvalue) {
|
if ($nuvalue !== $ldapvalue) {
|
||||||
// This might fail due to schema validation
|
// This might fail due to schema validation
|
||||||
if (@ldap_modify($ldapconnection, $user_dn, array($ldapkey => $nuvalue))) {
|
if (@ldap_modify($ldapconnection, $user_dn, array($ldapkey => $nuvalue))) {
|
||||||
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
$success = false;
|
||||||
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
||||||
array('errno'=>ldap_errno($ldapconnection),
|
array('errno'=>ldap_errno($ldapconnection),
|
||||||
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
||||||
|
@ -1256,6 +1259,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
$changed = true;
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
$success = false;
|
||||||
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
||||||
array('errno'=>ldap_errno($ldapconnection),
|
array('errno'=>ldap_errno($ldapconnection),
|
||||||
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
||||||
|
@ -1273,6 +1277,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
$changed = true;
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
$success = false;
|
||||||
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
error_log($this->errorlogtag.get_string ('updateremfail', 'auth_ldap',
|
||||||
array('errno'=>ldap_errno($ldapconnection),
|
array('errno'=>ldap_errno($ldapconnection),
|
||||||
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
'errstring'=>ldap_err2str(ldap_errno($ldapconnection)),
|
||||||
|
@ -1286,6 +1291,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ambiguous and !$changed) {
|
if ($ambiguous and !$changed) {
|
||||||
|
$success = false;
|
||||||
error_log($this->errorlogtag.get_string ('updateremfailamb', 'auth_ldap',
|
error_log($this->errorlogtag.get_string ('updateremfailamb', 'auth_ldap',
|
||||||
array('key'=>$key,
|
array('key'=>$key,
|
||||||
'ouvalue'=>$ouvalue,
|
'ouvalue'=>$ouvalue,
|
||||||
|
@ -1295,12 +1301,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_log($this->errorlogtag.get_string ('usernotfound', 'auth_ldap'));
|
error_log($this->errorlogtag.get_string ('usernotfound', 'auth_ldap'));
|
||||||
$this->ldap_close();
|
$success = false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ldap_close();
|
$this->ldap_close();
|
||||||
return true;
|
return $success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue