From 529d2fab39a2689768ff179aee37af75efeb7bc6 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 9 Sep 2010 10:03:27 +0000 Subject: [PATCH] Removed passwordHook git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19580 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/FAQ | 9 +++-- gosa-core/contrib/gosa.conf.5 | 12 ------- gosa-core/html/password.php | 35 +++---------------- gosa-core/include/class_core.inc | 11 ------ .../admin/users/class_userManagement.inc | 15 -------- .../personal/password/class_password.inc | 19 ---------- 6 files changed, 10 insertions(+), 91 deletions(-) diff --git a/gosa-core/FAQ b/gosa-core/FAQ index 8148c169d..e6d8591ce 100644 --- a/gosa-core/FAQ +++ b/gosa-core/FAQ @@ -117,9 +117,12 @@ A: You can place the keywords "passwordMinLength" and "passwordMinDiffer" in the Q: I've to update passwords on external windows PDCs. Can I add a command to let synchronize these for me? -A: There's the possibility to add a password hook in gosa.conf's main section using - the keyword "passwordHook". The specified command will be executed with - three parameters: /path/to/your/script username oldpassword newpassword +A: There's the possibility to add a hooks in gosa.conf's plugin tags using + the "premodify/postmodify" keywords. The specified command will be executed with + these additional parameters: %current_password %new_password %userPassword + + For further information about pre- and post hooks search for the premodify + and postmodify statements. So you can call i.e. smbpasswd to handle your password change on the PDC. diff --git a/gosa-core/contrib/gosa.conf.5 b/gosa-core/contrib/gosa.conf.5 index adb659993..928f25c30 100644 --- a/gosa-core/contrib/gosa.conf.5 +++ b/gosa-core/contrib/gosa.conf.5 @@ -540,18 +540,6 @@ statement determines whether a newly entered password has to be checked to have at least n different characters. .PP -.B passwordHook -.I path -.PP -The -.I passwordHook -can specify an external script to handle password settings at some other -location besides the LDAP. It will be called this way: - -.nf -/path/to/your/script "username" "oldpassword" "newpassword" -.fi - .B passwordProposalHook .I command .PP diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index 10ff4be06..a048c0065 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -284,39 +284,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])) { if (count($message) != 0) { /* Show error message and continue editing */ msg_dialog::displayChecks($message); + } elseif(!change_password($ui->dn, $_POST['new_password'], FALSE, $method,get_post('current_password'),$msg)){ + msg_dialog::displayChecks(array($msg)); } else { - - /* Passed quality check, just try to change the password now */ - $output= ""; - if ($config->get_cfg_value("core","passwordHook") != "") { - - $cmd = $config->get_cfg_value("core","passwordHook"); - $cmd = preg_replace("/%current_password/",escapeshellarg(get_post('current_password')), $cmd); - $cmd = preg_replace("/%new_password/",escapeshellarg(get_post('new_password')), $cmd); - $cmd = preg_replace("/%uid/",escapeshellarg($ui->username), $cmd); - $cmd = preg_replace("/%dn/",escapeshellarg($ui->dn), $cmd); - exec($cmd, $resarr); - if (count($resarr) > 0) { - $output= join('\n', $resarr); - } - } - if ($output != "") { - $message[]= sprintf( - _("External password changer reported a problem: %s"), - $output - ); - msg_dialog::displayChecks($message); - } else { - if(!change_password($ui->dn, $_POST['new_password'], FALSE, $method,get_post('current_password'),$msg)){ - msg_dialog::displayChecks(array($msg)); - }else{ - gosa_log("User/password has been changed"); - $smarty->assign("changed", true); - } - } + gosa_log("User/password has been changed"); + $smarty->assign("changed", true); } - - } /* Parameter fill up */ diff --git a/gosa-core/include/class_core.inc b/gosa-core/include/class_core.inc index 6f9df0b45..0b96b077e 100644 --- a/gosa-core/include/class_core.inc +++ b/gosa-core/include/class_core.inc @@ -299,17 +299,6 @@ class core extends plugin { "group" => "password", "mandatory" => FALSE), - array( - "name" => "passwordHook", - "type" => "command", - "default" => "", - "description" => - _("The 'passwordHook' can specify an external script to handle password settings at some other location besides the LDAP.")." ".sprintf(_("It will be called this way: %s"),"/path/to/your/script \"username\" \"oldpassword\" \"newpassword\""), - "check" => "gosaProperty::isCommand", - "migrate" => "", - "group" => "password", - "mandatory" => FALSE), - array( "name" => "passwordProposalHook", "type" => "command", diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 0e97d648a..b8462732b 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -320,21 +320,6 @@ class userManagement extends management } } - // Check password via check hook - if ($this->config->get_cfg_value("core","passwordHook") != ""){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->cat($this->dn,array('uid')); - $attrs = $ldap->fetch(); - $cmd = $this->config->get_cfg_value("core","passwordHook"); - $cmd = preg_replace("/%current_password/",'',$cmd); - $cmd = preg_replace("/%new_password/",escapeshellarg($new_password), $cmd); - $cmd = preg_replace("/%uid/",escapeshellarg($attrs['uid'][0]), $cmd); - $cmd = preg_replace("/%dn/",escapeshellarg($attrs['dn']), $cmd); - exec($cmd,$resarr); - $message = array_merge($message, $resarr); - } - // Display errors if (count($message) != 0){ msg_dialog::displayChecks($message); diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc index db7fff07e..a436e941f 100644 --- a/gosa-core/plugins/personal/password/class_password.inc +++ b/gosa-core/plugins/personal/password/class_password.inc @@ -114,25 +114,6 @@ class password extends plugin $attrs['current_password'] = escapeshellarg($current_password); $attrs['new_password'] = escapeshellarg($new_password); - // Depricated but execute for backward compability - $check_hook = $this->config->get_cfg_value("core","passwordHook") != ""; - $cmd = $this->config->get_cfg_value("core","passwordHook"); - if(!empty($cmd)){ - $cmd = preg_replace("/%current_password/",escapeshellarg($current_password), $cmd); - $cmd = preg_replace("/%new_password/",escapeshellarg($new_password), $cmd); - $cmd = preg_replace("/%uid/",escapeshellarg($ui->username), $cmd); - $cmd = preg_replace("/%dn/",escapeshellarg($ui->dn), $cmd); - if($check_hook){ - exec($cmd,$resarr); - $check_hook_output = ""; - if(count($resarr) > 0) { - $check_hook_output= join('\n', $resarr); - $message[] = sprintf(_("Password hook reported a problem: %s. Password change canceled!"), - $check_hook_output); - } - } - } - // Perform GOsa password policy checks if(empty($current_password)){ $message[] = _("You need to specify your current password in order to proceed."); -- 2.30.2