From 5c25b593051a317bd891ead35400b334e9eec9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Mon, 22 Jul 2024 19:59:42 +0200 Subject: [PATCH] Use new ltb-common Directory functions --- conf/config.inc.php | 1 + htdocs/display.php | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/conf/config.inc.php b/conf/config.inc.php index 4f7f768..19efb37 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -38,6 +38,7 @@ $ldap_lastauth_attribute = "authTimestamp"; #$ldap_network_timeout = 10; $ldap_type = "openldap"; +#$ldap_lockout_duration = 3600; # How display attributes $attributes_map = array( diff --git a/htdocs/display.php b/htdocs/display.php index a698d78..245da43 100644 --- a/htdocs/display.php +++ b/htdocs/display.php @@ -14,6 +14,7 @@ $prehookresult= ""; $posthookresult= ""; $ldapExpirationDate=""; +$canLockAccount=""; if (isset($_GET["dn"]) and $_GET["dn"]) { $dn = $_GET["dn"]; @@ -71,7 +72,6 @@ # Search entry $search = ldap_read($ldap, $dn, $ldap_user_filter, $attributes); - $errno = ldap_errno($ldap); if ( $errno ) { @@ -103,10 +103,12 @@ $edit_link = str_replace("{dn}", urlencode($dn), $display_edit_link); } - $unlockDate = ""; - $isExpired = false; + $lockoutDuration = $directory->getLockoutDuration($ldap, $dn, array('pwdPolicy' => $pwdPolicy, 'lockoutDuration' => $ldap_lockout_duration)); + $unlockDate = $directory->getUnlockDate($ldap, $dn, array('lockoutDuration' => $lockoutDuration)); + $isLocked = $directory->isLocked($ldap, $dn, array('lockoutDuration' => $lockoutDuration)); + $canLockAccount = $directory->canLockAccount($ldap, $dn, array('pwdPolicy' => $pwdPolicy)); - $isLocked = $directory->isLocked($ldap, $dn, array( 'pwdpolicy' => $pwdPolicy )); + $isExpired = false; if ($pwdPolicy) { $search_ppolicy = ldap_read($ldap, $pwdPolicy, "(objectClass=pwdPolicy)", array('pwdMaxAge')); @@ -158,5 +160,5 @@ $smarty->assign("accountlockresult", $accountlockresult); $smarty->assign("prehookresult", $prehookresult); $smarty->assign("posthookresult", $posthookresult); -if ($pwdLockout == false) $smarty->assign("use_lockaccount", $pwdLockout); +if ($canLockAccount == false) $smarty->assign("use_lockaccount", $canLockAccount); ?>