summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 04cf391)
raw | patch | inline | side by side (parent: 04cf391)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 15 Aug 2007 07:20:25 +0000 (07:20 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 15 Aug 2007 07:20:25 +0000 (07:20 +0000) |
keep deactivate status after changing password
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7062 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7062 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_password-methods.inc | patch | blob | history |
index 80e8c18b5392cc1d881f13b1bee0b0d2c45cbec3..e0b96c0dbafde5719ad5fb740092ca22a1bc5867 100644 (file)
$ldap->cat ($dn, array("shadowLastChange", "userPassword", "uid"));
$attrs = $ldap->fetch ();
- // Set encryption type to clear if required
- if (isset($attrs['userPassword'][0]) && preg_match('/^[^{}]+$/', $attrs['userPassword'][0]) && $hash == ""){
- $hash= "clear";
+ // 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;
}
+# // Get current password hash method if available
+# if($hash == "" && isset($attrs['userPassword'][0]) && preg_match("/[\{\}]/",$attrs['userPassword'][0])){
+# $hash = preg_replace("/^[^\{]*+\{([^\}]*).*$/","\\1",$attrs['userPassword'][0]);
+# $hash = strtolower($hash);
+# }
+
+# // Set encryption type to clear if required
+# if (!isset($attrs['userPassword'][0]) || $hash == ""){
+# $hash= "clear";
+# }
+
// Detect the encryption Method
if ( (isset($attrs['userPassword'][0]) && preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0], $matches)) || $hash != ""){
$attrs= generate_smb_nt_hash($password);
}
+ /* Readd ! if user was deactivated */
+ if($deactivated){
+ $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
+ }
+
$attrs['userPassword']= array();
$attrs['userPassword']= $newpass;