Commit 449ba2cc authored by Franco Fichtner's avatar Franco Fichtner

access: allow root disable and prevent to disable own user

PR: https://forum.opnsense.org/index.php?topic=3684
(cherry picked from commit d569a8e1)
parent ce0b693b
...@@ -429,7 +429,6 @@ function local_user_set(&$user) ...@@ -429,7 +429,6 @@ function local_user_set(&$user)
/* root user special handling */ /* root user special handling */
if ($user_uid == 0) { if ($user_uid == 0) {
$user_shell = isset($user['shell']) ? $user['shell'] : '/usr/local/etc/rc.initial'; $user_shell = isset($user['shell']) ? $user['shell'] : '/usr/local/etc/rc.initial';
$lock_account = 'unlock';
$user_group = 'wheel'; $user_group = 'wheel';
$user_home = '/root'; $user_home = '/root';
} }
......
...@@ -236,6 +236,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -236,6 +236,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[] = gettext("The passwords do not match."); $input_errors[] = gettext("The passwords do not match.");
} }
if (!empty($pconfig['disabled']) && $_SESSION['Username'] === $a_user[$id]['name']) {
$input_errors[] = gettext('You cannot disable yourself.');
}
if (isset($id)) { if (isset($id)) {
$oldusername = $a_user[$id]['name']; $oldusername = $a_user[$id]['name'];
} else { } else {
......
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