Commit fafeee2b authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4473 altering SSH keys when user is locked

Showing with 20 additions and 0 deletions
+20 -0
......@@ -2825,6 +2825,23 @@ function lock_samba_account($mode, $attrs)
return $modify;
}
/* Lock or unlock ssh account */
function lock_ssh_account($mode, $attrs, &$modify)
{
global $config;
if (!isset($attrs['sshPublicKey'])) {
return;
}
$modify['sshPublicKey'] = array();
for ($i = 0; $i < $attrs['sshPublicKey']['count']; ++$i) {
if ($mode == 'LOCK') {
$modify['sshPublicKey'][] = preg_replace('/^/', 'disabled-', $attrs['sshPublicKey'][0]);
} else {
$modify['sshPublicKey'][] = preg_replace('/^disabled-/', '', $attrs['sshPublicKey'][0]);
}
}
}
/*!
* \brief Get the Change Sequence Number of a certain DN
......
......@@ -174,6 +174,9 @@ class passwordMethod
// (Un)lock the samba account
$modify = lock_samba_account($mode, $attrs);
// (Un)lock SSH keys
lock_ssh_account($mode, $attrs, $modify);
// (Un)lock the account by modifying the password hash.
$pwdClass = new user($config, $dn);
$pwdClass->callHook('PRE'.$mode, array(), $ret);
......
  • bmortier @bmortier

    mentioned in issue #1420 (closed)

    By Côme Chilliet on 2017-09-02T15:25:58 (imported from GitLab)

    ·

    mentioned in issue #1420 (closed)

    By Côme Chilliet on 2017-09-02T15:25:58 (imported from GitLab)

    Toggle commit list
Supports Markdown
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