summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ddabed9)
raw | patch | inline | side by side (parent: ddabed9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Oct 2010 15:20:55 +0000 (15:20 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Oct 2010 15:20:55 +0000 (15:20 +0000) |
-Do not write sambaHashes while samba hashing is disabled
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20038 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20038 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/password-methods/class_password-methods.inc | patch | blob | history |
diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc
index 695f32e7171783c82c60de123268eb7b903ce822..4e5f38f83117bf2f41793fb0d4b9a721a28c1a46 100644 (file)
/* Lock entry */
$userPassword = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$userPassword);
- $sambaLMPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaLMPassword);
- $sambaNTPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaNTPassword);
+
+ // Only lock samba hashes if samba passwords are enabled
+ $smbPasswdEnabled = trim($config->get_cfg_value('core','sambaHashHook')) == "";
+ if($smbPasswdEnabled){
+ $sambaLMPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaLMPassword);
+ $sambaNTPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaNTPassword);
+ }
// Call external lock hook
$res = $ldap->cat($dn);
// Update the ldap entry
$ldap->cd($dn);
- $ldap->modify(
- array(
- "userPassword" => $userPassword,
- "sambaLMPassword" => $sambaLMPassword,
- "sambaNTPassword" => $sambaNTPassword));
+ $attrs = array();
+ $attrs['userPassword'] = $userPassword;
+
+ // Updated samba hashes if samba hashing is enabled
+ if($smbPasswdEnabled){
+ $attrs['sambaLMPassword'] = $sambaLMPassword;
+ $attrs['sambaNTPassword'] = $sambaNTPassword;
+ }
+ $ldap->modify($attrs);
if($ldap->success()){
// Call the password post-lock hook, if defined.
}
/* Lock entry */
+
$userPassword = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$userPassword);
- $sambaLMPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaLMPassword);
- $sambaNTPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaNTPassword);
+
+ // Update samba hashes only if its enabled.
+ $smbPasswdEnabled = trim($config->get_cfg_value('core','sambaHashHook')) == "";
+ if($smbPasswdEnabled){
+ $sambaLMPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaLMPassword);
+ $sambaNTPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaNTPassword);
+ }
// Call external lock hook
$res = $ldap->cat($dn);
// Lock the account by modifying the password hash.
$ldap->cd($dn);
- $ldap->modify(
- array(
- "userPassword" => $userPassword,
- "sambaLMPassword" => $sambaLMPassword,
- "sambaNTPassword" => $sambaNTPassword));
+
+ // Update the ldap entry
+ $attrs = array();
+ $attrs['userPassword'] = $userPassword;
+
+ // Updated samba hashes if samba hashing is enabled
+ if($smbPasswdEnabled){
+ $attrs['sambaLMPassword'] = $sambaLMPassword;
+ $attrs['sambaNTPassword'] = $sambaNTPassword;
+ }
+
+ $ldap->modify($attrs);
+
if($ldap->success()){
// Call the password post-lock hook, if defined.