mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-30 22:05:46 +00:00
Take MODE_LOGIN_SHELL into account when initially setting reset_home
instead of special-casing it later.
This commit is contained in:
@@ -432,7 +432,8 @@ rebuild_env(int noexec)
|
||||
|
||||
/* Reset HOME based on target user if configured to. */
|
||||
if (ISSET(sudo_mode, MODE_RUN)) {
|
||||
if (def_always_set_home || ISSET(sudo_mode, MODE_RESET_HOME) ||
|
||||
if (def_always_set_home ||
|
||||
ISSET(sudo_mode, MODE_RESET_HOME | MODE_LOGIN_SHELL) ||
|
||||
(ISSET(sudo_mode, MODE_SHELL) && def_set_home))
|
||||
reset_home = TRUE;
|
||||
}
|
||||
@@ -523,8 +524,8 @@ rebuild_env(int noexec)
|
||||
sudo_setenv("USERNAME", user_name, FALSE);
|
||||
}
|
||||
|
||||
/* If not a login shell and it wasn't kept above, reset HOME. */
|
||||
if (ISSET(sudo_mode, MODE_LOGIN_SHELL) || !ISSET(didvar, KEPT_HOME))
|
||||
/* If we didn't keep HOME, reset it based on target user. */
|
||||
if (!ISSET(didvar, KEPT_HOME))
|
||||
reset_home = TRUE;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user