system: more of the same for #8221

This commit is contained in:
Franco Fichtner 2025-01-17 10:11:11 +01:00
parent 43cf2fccea
commit ad358ed999
2 changed files with 4 additions and 3 deletions

View File

@ -243,7 +243,7 @@ function local_sync_accounts()
$config_map[$section] = [];
if (is_array($config['system'][$section])) {
foreach ($config['system'][$section] as $item) {
if ($section == 'user' && empty($item['shell'])) {
if ($section == 'user' && (empty($item['shell']) || $user['uid'] != 0)) {
/* no shell, no local user */
continue;
}
@ -293,7 +293,7 @@ function local_user_set(&$user, $force_password = false, $userattrs = null)
if (empty($user['password'])) {
auth_log("Cannot set user {$user['name']}: password is missing");
return;
} elseif (empty($user['shell'])) {
} elseif (empty($user['shell']) || $user['uid'] != 0) {
/* no shell, no local user */
return;
}

View File

@ -489,9 +489,10 @@ function core_run()
function core_user_changed_groups($unused, $username)
{
global $config;
if (is_array($config['system']['user'])) {
foreach ($config['system']['user'] as $user) {
if ($user['name'] == $username && !empty($user['shell'])) {
if ($user['name'] == $username && (!empty($user['shell']) || $user['uid'] == 0)) {
exec("/usr/bin/groups " . escapeshellarg($username) . ' 2>/dev/null', $out, $ret);
$current_groups = [];
if (!$ret) {