From: hickert Date: Tue, 6 May 2008 07:38:55 +0000 (+0000) Subject: Updated password change. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e2b2057cafeb1d962f55dd70f3cc4100e380699e;p=gosa.git Updated password change. -Initialize methods with dn, else we can't set or remove passwords for krb5_mit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10780 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index 045380159..b1c527775 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -1677,6 +1677,45 @@ class gosaSupportDaemon } + /*! \brief Sets the password of for the given principal. + (Uses the GOsa support daemon instead of the ldap database.) + @param String The servers mac + @param String The principals name + @param String $the new password. + @return Boolean TRUE on success else FALSE + */ + public function krb5_set_password($server,$name,$password) + { + $ret = FALSE; + + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + + /* Check if the given name is a valid request value + */ + if(!is_string($name) || empty($name)){ + trigger_error("The given principal name is not of type string or it is empty."); + return($ret); + } + + /* Prepare request event + */ + $xml_msg = + "". + "
gosa_krb5_set_password
". + "".$name."". + "".$password."". + "GOSA". + "".$server."". + "
"; + return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error()); + } + + /*! \brief Returns log file informations for a given mac address @param $mac The mac address to fetch logs for. @retrun Array A Multidimensional array containing log infos. diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 4f7236ae5..736db99cf 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2458,9 +2458,9 @@ function change_password ($dn, $password, $mode=0, $hash= "") /* Extract used hash */ if ($hash == ""){ - $test = passwordMethod::get_method($attrs['userPassword'][0]); + $test = passwordMethod::get_method($attrs['userPassword'][0],$dn); } else { - $test = new $available[$hash]($config); + $test = new $available[$hash]($config,$dn); $test->set_hash($hash); } diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc index d0495b09f..d45ec058a 100644 --- a/gosa-core/include/password-methods/class_password-methods.inc +++ b/gosa-core/include/password-methods/class_password-methods.inc @@ -115,7 +115,7 @@ class passwordMethod // Try to find out if it's our hash... - static function get_method($password_hash) + static function get_method($password_hash,$dn) { global $config; @@ -123,7 +123,7 @@ class passwordMethod foreach ($methods['class'] as $class){ - $test = new $class($config); + $test = new $class($config,$dn); if(!$test->is_available())continue; $method= $test->_extract_method($password_hash); if ($method != ""){