Only OR in MODE_RESET_HOME if MODE_RUN is set.

Fixes a problem where "sudo -l" would not work if always_set_home was set.
This commit is contained in:
Todd C. Miller
2002-01-15 20:39:59 +00:00
parent 8b7187483b
commit eb97ce45ea

6
sudo.c
View File

@@ -312,9 +312,9 @@ main(argc, argv, envp)
if ((sudo_mode & MODE_IMPLIED_SHELL) && !def_flag(I_SHELL_NOARGS)) if ((sudo_mode & MODE_IMPLIED_SHELL) && !def_flag(I_SHELL_NOARGS))
usage(1); usage(1);
/* May need to set $HOME to target user. */ /* May need to set $HOME to target user if we are running a command. */
if (def_flag(I_ALWAYS_SET_HOME) || if ((sudo_mode & MODE_RUN) && (def_flag(I_ALWAYS_SET_HOME) ||
((sudo_mode & MODE_SHELL) && def_flag(I_SET_HOME))) ((sudo_mode & MODE_SHELL) && def_flag(I_SET_HOME))))
sudo_mode |= MODE_RESET_HOME; sudo_mode |= MODE_RESET_HOME;
/* Bail if a tty is required and we don't have one. */ /* Bail if a tty is required and we don't have one. */