Skip to content

Commit

Permalink
MDL-52387 auth_ldap: add support for fine grained password
Browse files Browse the repository at this point in the history
Contributed by Matthew Johnson.
  • Loading branch information
lameze committed Feb 16, 2016
1 parent 9d5d9c6 commit c1bc628
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,21 @@ function ldap_get_ad_pwdexpire($pwdlastset, $ldapconn, $user_dn){
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$maxpwdage = $info['maxpwdage'][0];

if ($sr = ldap_read($ldapconn, $user_dn, '(objectClass=*)', array('msDS-ResultantPSO', 'msDS-MaximumPasswordAge'))) {
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$userpso = $info['msds-resultantpso'][0];

// If a PSO exists, FGPP is being utilized.
// Grab the new maxpwdage from the msDS-MaximumPasswordAge attribute of the PSO.
if (!empty($userpso)) {
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$maxpwdage = $info['msds-maximumpasswordage'][0];
}
}
}
}
// ----------------------------------------------------------------
// MSDN says that "pwdLastSet contains the number of 100 nanosecond
// intervals since January 1, 1601 (UTC), stored in a 64 bit integer".
Expand Down

0 comments on commit c1bc628

Please sign in to comment.