Commit 1a45020c authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes #4063 Using a pattern in password is broken

parent 0ac270b2
......@@ -157,18 +157,25 @@ class UserPasswordAttribute extends CompositeAttribute
{
$pw_storage = $this->plugin->config->get_cfg_value('passwordDefaultHash', 'ssha');
$locked = FALSE;
$password = '';
if ($this->plugin->is_template) {
list($value, $password) = split('/|/', $value, 2);
}
if (preg_match ('/^{[^}]+}/', $value)) {
$tmp = passwordMethod::get_method($value);
if (is_object($tmp)) {
$pw_storage = $tmp->get_hash();
$locked = $tmp->is_locked($this->plugin->config, $this->plugin->dn);
if ($this->plugin->is_template) {
$value = $tmp->generate_hash($password);
}
}
} else {
if ($value != '') {
$pw_storage = 'clear';
}
}
return array($pw_storage, '', '', $value, $locked);
return array($pw_storage, $password, $password, $value, $locked);
}
function writeValues($values)
......@@ -183,7 +190,11 @@ class UserPasswordAttribute extends CompositeAttribute
}
$test = new $temp[$values[0]]($this->plugin->config, $this->plugin->dn);
$test->set_hash($values[0]);
return $test->generate_hash($values[1]);
if ($this->plugin->is_template) {
return $test->generate_hash($values[1]).'|'.$values[1];
} else {
return $test->generate_hash($values[1]);
}
}
function check()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment