From d3e535702ea52d7776f1de656d27d4ca36a2d2c6 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 4 Oct 2010 11:55:55 +0000 Subject: [PATCH] Added pre/post lock/unlock method for user passwords git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19908 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_password-methods.inc | 17 +++++++ .../personal/password/class_password.inc | 48 +++++++++++++++++-- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc index b933300e1..ffcff6799 100644 --- a/gosa-core/include/password-methods/class_password-methods.inc +++ b/gosa-core/include/password-methods/class_password-methods.inc @@ -109,12 +109,21 @@ class passwordMethod $sambaLMPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaLMPassword); $sambaNTPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaNTPassword); $ldap->cd($dn); + + $pwdClass = new password($config, $dn); + $pwdClass->callHook($pwdClass, 'PRELOCK',array(), $ret); $ldap->modify( array( "userPassword" => $userPassword, "sambaLMPassword" => $sambaLMPassword, "sambaNTPassword" => $sambaNTPassword)); + + if($ldap->success()){ + $pwdClass->callHook($pwdClass, 'POSTLOCK',array(), $ret); + print_a($ret); + } return($ldap->success()); + } return(FALSE); } @@ -157,12 +166,20 @@ class passwordMethod $userPassword = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$userPassword); $sambaLMPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaLMPassword); $sambaNTPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaNTPassword); + + $pwdClass = new password($config, $dn); + $pwdClass->callHook($pwdClass, 'PREUNLOCK',array(), $ret); + $ldap->cd($dn); $ldap->modify( array( "userPassword" => $userPassword, "sambaLMPassword" => $sambaLMPassword, "sambaNTPassword" => $sambaNTPassword)); + if($ldap->success()){ + $pwdClass = new password($config, $dn); + $pwdClass->callHook($pwdClass, 'POSTUNLOCK',array(), $ret); + } return($ldap->success()); } return(FALSE); diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc index 2833de2ec..7645b8217 100644 --- a/gosa-core/plugins/personal/password/class_password.inc +++ b/gosa-core/plugins/personal/password/class_password.inc @@ -220,14 +220,52 @@ class password extends plugin static function plInfo() { return (array( - "plDescription" => _("User password"), - "plSelfModify" => TRUE, - "plDepends" => array("user"), - "plPriority" => 10, + "plDescription" => _("User password"), + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 10, "plSection" => array("personal" => _("My account")), "plCategory" => array("users"), - "plOptions" => array(), + "plOptions" => array(), + "plProperties" => array( + array( + "name" => "PRELOCK", + "type" => "command", + "default" => "", + "description" => "", + "check" => "gosaProperty::isCommand", + "migrate" => "", + "group" => "password", + "mandatory" => FALSE), + array( + "name" => "POSTLOCK", + "type" => "command", + "default" => "", + "description" => "", + "check" => "gosaProperty::isCommand", + "migrate" => "", + "group" => "password", + "mandatory" => FALSE), + array( + "name" => "PREUNLOCK", + "type" => "command", + "default" => "", + "description" => "", + "check" => "gosaProperty::isCommand", + "migrate" => "", + "group" => "password", + "mandatory" => FALSE), + array( + "name" => "POSTUNLOCK", + "type" => "command", + "default" => "", + "description" => "", + "check" => "gosaProperty::isCommand", + "migrate" => "", + "group" => "password", + "mandatory" => FALSE) + ), "plProvidedAcls" => array()) ); } -- 2.30.2