summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c5b9cc)
raw | patch | inline | side by side (parent: 5c5b9cc)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 15 Aug 2007 06:34:40 +0000 (06:34 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 15 Aug 2007 06:34:40 +0000 (06:34 +0000) |
Sometimes password change lost encryption method and password was stored in clear text.
Keep users deactivated after changing passwords.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7060 594d385d-05f5-0310-b6e9-bd551577e9d8
Keep users deactivated after changing passwords.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7060 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_password-methods.inc | patch | blob | history |
index 4ebc87bb701e94479e436bd18de96dbcdf49e581..6ea694f20cd48cd4d07ca30c9da0e020dd608615 100644 (file)
$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;
+ }
+
+ // 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]) && preg_match('/^[^{}]+$/', $attrs['userPassword'][0]) && $hash == ""){
+ if (!isset($attrs['userPassword'][0]) || $hash == ""){
$hash= "clear";
}
$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;