From 2ca35fccd38e1ae517599a10d201e98398ecacb8 Mon Sep 17 00:00:00 2001 From: tholo Date: Sun, 22 Dec 1996 03:49:44 +0000 Subject: [PATCH] Deal with _POSIX_SAVED_IDS when relinquishing privileges --- gnu/libexec/uucp/libunix/init.c | 8 ++++++-- gnu/libexec/uucp/libunix/spawn.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gnu/libexec/uucp/libunix/init.c b/gnu/libexec/uucp/libunix/init.c index 8a3c416bed1..57a5e77dd40 100644 --- a/gnu/libexec/uucp/libunix/init.c +++ b/gnu/libexec/uucp/libunix/init.c @@ -272,8 +272,10 @@ usysdep_initialize (puuconf,iflags) && geteuid () == 0) { q = getpwnam (OWNER); - if (q != NULL) + if (q != NULL) P + seteuid (q->pw_uid); setuid (q->pw_uid); + } } if ((iflags & INIT_GETCWD) != 0) @@ -371,8 +373,10 @@ usysdep_exit (fsuccess) boolean fsysdep_other_config (z) const char *z; { - (void) setuid (getuid ()); + (void) setegid (getgid ()); (void) setgid (getgid ()); + (void) seteuid (getuid ()); + (void) setuid (getuid ()); return TRUE; } diff --git a/gnu/libexec/uucp/libunix/spawn.c b/gnu/libexec/uucp/libunix/spawn.c index d39e2ba7f49..229616cfa6b 100644 --- a/gnu/libexec/uucp/libunix/spawn.c +++ b/gnu/libexec/uucp/libunix/spawn.c @@ -353,8 +353,10 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, if (! fkeepuid) { /* Return to the uid of the invoking user. */ - (void) setuid (getuid ()); + (void) setegid (getgid ()); (void) setgid (getgid ()); + (void) seteuid (getuid ()); + (void) setuid (getuid ()); } else { -- 2.20.1