sets $HOME to pw_dir of runas user

This commit is contained in:
Todd C. Miller
1996-08-18 00:37:00 +00:00
parent 3d560a9481
commit 10d3642497

9
sudo.c
View File

@@ -287,8 +287,11 @@ int main(argc, argv)
#ifdef SECURE_PATH #ifdef SECURE_PATH
/* replace the PATH envariable with a secure one */ /* replace the PATH envariable with a secure one */
if (!user_is_exempt()) if (!user_is_exempt() && sudo_setenv("PATH", SECURE_PATH)) {
sudo_setenv("PATH", SECURE_PATH); perror("malloc");
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
exit(1);
}
#endif /* SECURE_PATH */ #endif /* SECURE_PATH */
if ((sudo_mode & MODE_RUN)) { if ((sudo_mode & MODE_RUN)) {
@@ -892,6 +895,8 @@ void set_perms(perm)
perror(""); perror("");
exit(1); exit(1);
} }
(void) sudo_setenv("HOME", pw_ent->pw_dir);
} }
break; break;