summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48be0a0)
raw | patch | inline | side by side (parent: 48be0a0)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 Nov 2008 08:56:37 +0000 (08:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 Nov 2008 08:56:37 +0000 (08:56 +0000) |
-Added check to ensure that the selected password method is valid ($test instanceOf passowrdMethod)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13051 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13051 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/functions.inc | patch | blob | history |
index ba46e840db640eba6469a22e0dd6418e9ac46c74..991f63e3e427b5c3380927988f3f3f0d1cc080a5 100644 (file)
$test = new $available['md5']($config);
}
- /* Feed password backends with information */
- $test->dn= $dn;
- $test->attrs= $attrs;
- $newpass= $test->generate_hash($password);
-
- // Update shadow timestamp?
- if (isset($attrs["shadowLastChange"][0])){
- $shadow= (int)(date("U") / 86400);
- } else {
- $shadow= 0;
- }
-
- // Write back modified entry
- $ldap->cd($dn);
- $attrs= array();
+ if($test instanceOf passwordMethod){
- // Not for groups
- if ($mode == 0){
+ /* Feed password backends with information */
+ $test->dn= $dn;
+ $test->attrs= $attrs;
+ $newpass= $test->generate_hash($password);
- if ($shadow != 0){
- $attrs['shadowLastChange']= $shadow;
+ // Update shadow timestamp?
+ if (isset($attrs["shadowLastChange"][0])){
+ $shadow= (int)(date("U") / 86400);
+ } else {
+ $shadow= 0;
}
- // Create SMB Password
- $attrs= generate_smb_nt_hash($password);
- }
+ // Write back modified entry
+ $ldap->cd($dn);
+ $attrs= array();
- /* Read ! if user was deactivated */
- if($deactivated){
- $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
- }
+ // Not for groups
+ if ($mode == 0){
- $attrs['userPassword']= array();
- $attrs['userPassword']= $newpass;
+ if ($shadow != 0){
+ $attrs['shadowLastChange']= $shadow;
+ }
- $ldap->modify($attrs);
+ // Create SMB Password
+ $attrs= generate_smb_nt_hash($password);
+ }
- new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error());
+ /* Read ! if user was deactivated */
+ if($deactivated){
+ $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
+ }
- if (!$ldap->success()) {
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, ERROR_DIALOG));
- } else {
+ $attrs['userPassword']= array();
+ $attrs['userPassword']= $newpass;
- /* Run backend method for change/create */
- if(!$test->set_password($password)){
- return(FALSE);
- }
+ $ldap->modify($attrs);
- /* Find postmodify entries for this class */
- $command= $config->search("password", "POSTMODIFY",array('menu'));
+ new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error());
- if ($command != ""){
- /* Walk through attribute list */
- $command= preg_replace("/%userPassword/", $password, $command);
- $command= preg_replace("/%dn/", $dn, $command);
+ if (!$ldap->success()) {
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, ERROR_DIALOG));
+ } else {
- if (check_command($command)){
- @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
- exec($command);
- } else {
- $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
- msg_dialog::display(_("Configuration error"), $message, ERROR_DIALOG);
+ /* Run backend method for change/create */
+ if(!$test->set_password($password)){
+ return(FALSE);
+ }
+
+ /* Find postmodify entries for this class */
+ $command= $config->search("password", "POSTMODIFY",array('menu'));
+
+ if ($command != ""){
+ /* Walk through attribute list */
+ $command= preg_replace("/%userPassword/", $password, $command);
+ $command= preg_replace("/%dn/", $dn, $command);
+
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+ exec($command);
+ } else {
+ $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
+ msg_dialog::display(_("Configuration error"), $message, ERROR_DIALOG);
+ }
}
}
+ return(TRUE);
}
- return(TRUE);
}