🚑 fix(users) Fix crash when locking empty password in userManagement

issue #6008
parent 3033b0a7
......@@ -34,9 +34,9 @@ class LockAction extends Action
function isLocked (ListingEntry $entry)
{
if (isset($entry['userPassword']) && preg_match('/^\{[^\}]/', $entry['userPassword'])) {
return (preg_match('/^[^\}]*+\}!/', $entry['userPassword']) === 1);
} elseif ((strtolower($entry->type) == 'user') && !isset($entry['userPassword'])) {
if (isset($entry['userPassword'][0]) && preg_match('/^\{[^\}]/', $entry['userPassword'][0])) {
return (preg_match('/^[^\}]*+\}!/', $entry['userPassword'][0]) === 1);
} elseif ((strtolower($entry->type) == 'user') && empty($entry['userPassword'])) {
/* Empty lockable password */
return FALSE;
}
......
......@@ -21,7 +21,7 @@
class userManagement extends management
{
public $neededAttrs = ['userPassword' => '1'];
public $neededAttrs = ['userPassword' => '*'];
public static $skipTemplates = FALSE;
......@@ -91,7 +91,7 @@ class userManagement extends management
$entry = $this->listing->getEntry($dn);
// Detect the password method and try to lock/unlock.
static::lockUser($action['subaction'], $entry['userPassword'], $dn);
static::lockUser($action['subaction'], ($entry['userPassword'][0] ?? ''), $dn);
}
}
......
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