From dc34e2151924833d4254fdaada75e17d584ee001 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 27 Nov 2008 09:01:41 +0000 Subject: [PATCH] Updated functions.inc - change_password -Keep entries locked git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13053 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 991f63e3e..efed58c99 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2468,13 +2468,6 @@ function change_password ($dn, $password, $mode=0, $hash= "") $ldap->cat ($dn, array("shadowLastChange", "userPassword", "uid")); $attrs = $ldap->fetch (); - // Check if user account was deactivated, indicated by ! after } ... {crypt}!### - if(isset($attrs['userPassword'][0]) && preg_match("/^[^\}]*+\}!/",$attrs['userPassword'][0])){ - $deactivated = TRUE; - }else{ - $deactivated = FALSE; - } - /* Is ensure that clear passwords will stay clear */ if($hash == "" && isset($attrs['userPassword'][0]) && !preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0])){ $hash = "clear"; @@ -2502,6 +2495,8 @@ function change_password ($dn, $password, $mode=0, $hash= "") if($test instanceOf passwordMethod){ + $deactivated = $test->is_locked($config,$dn); + /* Feed password backends with information */ $test->dn= $dn; $test->attrs= $attrs; @@ -2529,16 +2524,16 @@ function change_password ($dn, $password, $mode=0, $hash= "") $attrs= generate_smb_nt_hash($password); } - /* Read ! if user was deactivated */ - if($deactivated){ - $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass); - } - $attrs['userPassword']= array(); $attrs['userPassword']= $newpass; $ldap->modify($attrs); + /* Read ! if user was deactivated */ + if($deactivated){ + $test->lock_account($config,$dn); + } + new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error()); if (!$ldap->success()) { -- 2.30.2