mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-04 00:05:11 +00:00
ok, the getcwd() is now *really* done as the user
This commit is contained in:
18
sudo.c
18
sudo.c
@@ -145,17 +145,10 @@ main(argc, argv)
|
|||||||
(void) close(rtn);
|
(void) close(rtn);
|
||||||
#endif /* HAVE_SYSCONF */
|
#endif /* HAVE_SYSCONF */
|
||||||
|
|
||||||
load_globals(); /* load the user host cmnd and uid variables */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We only want to be root when we absolutely need it.
|
|
||||||
* This will effectively do setreuid(0, uid) but for portability...
|
|
||||||
*/
|
|
||||||
be_root();
|
|
||||||
be_user();
|
|
||||||
|
|
||||||
clean_env(environ); /* clean up the environment (no LD_*) */
|
clean_env(environ); /* clean up the environment (no LD_*) */
|
||||||
|
|
||||||
|
load_globals(); /* load the user host cmnd and uid variables */
|
||||||
|
|
||||||
rtn = validate();
|
rtn = validate();
|
||||||
switch (rtn) {
|
switch (rtn) {
|
||||||
|
|
||||||
@@ -203,6 +196,13 @@ static void load_globals()
|
|||||||
|
|
||||||
uid = getuid(); /* we need to tuck this away for safe keeping */
|
uid = getuid(); /* we need to tuck this away for safe keeping */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We only want to be root when we absolutely need it.
|
||||||
|
* This will effectively do setreuid(0, uid) but for portability...
|
||||||
|
*/
|
||||||
|
be_root();
|
||||||
|
be_user();
|
||||||
|
|
||||||
#ifdef UMASK
|
#ifdef UMASK
|
||||||
(void) umask((mode_t)UMASK);
|
(void) umask((mode_t)UMASK);
|
||||||
#endif /* UMASK */
|
#endif /* UMASK */
|
||||||
|
Reference in New Issue
Block a user