From 1dab897a88eb5067c836e548880441c2569ccd98 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 4 Oct 2010 12:40:29 +0000 Subject: [PATCH] Added pre/post lock/unlock events git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19911 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_password-methods.inc | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc index 51fdad0c8..9f08e2395 100644 --- a/gosa-core/include/password-methods/class_password-methods.inc +++ b/gosa-core/include/password-methods/class_password-methods.inc @@ -94,11 +94,21 @@ class passwordMethod if(preg_match("/^[^\}]*+\}!/",$pwd)){ return(TRUE); } - + + // Lock the account by modifying the password hash. + $pwdClass = new password($config, $dn); + $pwdClass->callHook($pwdClass, 'PRELOCK',array(), $ret); + /* Lock entry */ $pwd = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$pwd); $ldap->cd($dn); $ldap->modify(array("userPassword" => $pwd)); + + // Call the password post-lock hook, if defined. + if($ldap->success()){ + $pwdClass->callHook($pwdClass, 'POSTLOCK',array(), $ret); + } + return($ldap->success()); } return(FALSE); @@ -132,10 +142,19 @@ class passwordMethod return (TRUE); } + // Unlock the account by modifying the password hash. + $pwdClass = new password($config, $dn); + $pwdClass->callHook($pwdClass, 'PREUNLOCK',array(), $ret); + /* Lock entry */ $pwd = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$pwd); $ldap->cd($dn); $ldap->modify(array("userPassword" => $pwd)); + + // Call the password post-lock hook, if defined. + if($ldap->success()){ + $pwdClass->callHook($pwdClass, 'POSTUNLOCK',array(), $ret); + } return($ldap->success()); } return(FALSE); -- 2.30.2