fixed SECURE_PATH

This commit is contained in:
Todd C. Miller
1996-01-15 16:34:23 +00:00
parent 1eb9339efb
commit 35622b80c1

12
sudo.c
View File

@@ -246,6 +246,12 @@ int main(argc, argv)
exit(1); exit(1);
} }
#ifdef SECURE_PATH
/* replace the PATH envariable with a secure one */
if (!user_is_exempt())
sudo_setenv("PATH", SECURE_PATH);
#endif /* SECURE_PATH */
if ((sudo_mode & MODE_RUN)) { if ((sudo_mode & MODE_RUN)) {
load_cmnd(sudo_mode); /* load the cmnd global variable */ load_cmnd(sudo_mode); /* load the cmnd global variable */
} else if (sudo_mode == MODE_KILL) { } else if (sudo_mode == MODE_KILL) {
@@ -593,12 +599,6 @@ static void add_env()
{ {
char idstr[MAX_UID_T_LEN + 1]; char idstr[MAX_UID_T_LEN + 1];
#ifdef SECURE_PATH
/* replace the PATH envariable with a secure one */
if (!user_is_exempt())
sudo_setenv("PATH", SECURE_PATH);
#endif /* SECURE_PATH */
/* add the SUDO_COMMAND envariable */ /* add the SUDO_COMMAND envariable */
if (sudo_setenv("SUDO_COMMAND", cmnd)) { if (sudo_setenv("SUDO_COMMAND", cmnd)) {
perror("malloc"); perror("malloc");