Code

- Corrected debian bugnumbers
[gosa.git] / include / class_password-methods.inc
index 6ea694f20cd48cd4d07ca30c9da0e020dd608615..8d9021a4cf8d481fbbd91366dd12bc5787be349a 100644 (file)
@@ -113,15 +113,20 @@ function change_password ($dn, $password, $mode=0, $hash= "")
     $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";
+#  // 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";
+#  }
+
+  /* Is ensure that clear passwords will stay clear */
+  if($hash == "" && isset($attrs['userPassword'][0]) && !preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0])){
+    $hash = "clear";
   }
 
   // Detect the encryption Method