Skip to content

Commit

Permalink
fix warning while getting assigned ppolicy in getPwdPolicyConfigurati…
Browse files Browse the repository at this point in the history
…on (#47)
  • Loading branch information
David Coutadeur committed Nov 27, 2024
1 parent a11285f commit 3fca1e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Ltb/Directory/OpenLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,14 @@ public function getPwdPolicyConfiguration($ldap, $entry_dn, $default_ppolicy_dn)
$user_entry = \Ltb\PhpLDAP::ldap_get_entries($ldap, $search_user);
}

$ppolicy_dn = $user_entry[0]['pwdpolicysubentry'] ? $user_entry[0]['pwdpolicysubentry'][0] : $default_ppolicy_dn;
if(isset($user_entry[0]['pwdpolicysubentry'][0]) && !empty($user_entry[0]['pwdpolicysubentry'][0]))
{
$ppolicy_dn = $user_entry[0]['pwdpolicysubentry'][0];
}
else
{
$ppolicy_dn = $default_ppolicy_dn;
}

# Get values from ppolicy
$search = \Ltb\PhpLDAP::ldap_read($ldap, $ppolicy_dn, "(objectClass=pwdPolicy)", array('pwdLockoutDuration', 'pwdMaxAge', 'pwdLockout'));
Expand Down

0 comments on commit 3fca1e8

Please sign in to comment.