- (dtucker) [uidswap.c] Fix setreuid and add missing args to fatal(). ok djm@

This commit is contained in:
Darren Tucker 2003-06-06 10:46:04 +10:00
parent 881753bef2
commit 400b8786d6
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,6 @@
20030606
- (dtucker) [uidswap.c] Fix setreuid and add missing args to fatal(). ok djm@
20030605
- (djm) Support AI_NUMERICHOST in fake-getaddrinfo.c. Needed for recent
canohost.c changes.
@ -473,4 +476,4 @@
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
$Id: ChangeLog,v 1.2789 2003/06/05 12:20:11 dtucker Exp $
$Id: ChangeLog,v 1.2790 2003/06/06 00:46:04 dtucker Exp $

View File

@ -167,9 +167,9 @@ permanently_set_uid(struct passwd *pw)
#if defined(HAVE_SETRESUID)
if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
#elif defined(HAVE_SETRESUID)
if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
#elif defined(HAVE_SETREUID)
if (setreuid(pw->pw_uid, pw->pw_uid) < 0)
fatal("setreuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
#else
# ifndef SETEUID_BREAKS_SETUID
if (seteuid(pw->pw_uid) < 0)
@ -182,7 +182,7 @@ permanently_set_uid(struct passwd *pw)
/* Try restoration of GID if changed (test clearing of saved gid) */
if (old_gid != pw->pw_gid &&
(setgid(old_gid) != -1 || setegid(old_gid) != -1))
fatal("%s: was able to restore old [e]gid");
fatal("%s: was able to restore old [e]gid", __func__);
/* Verify GID drop was successful */
if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) {
@ -194,7 +194,7 @@ permanently_set_uid(struct passwd *pw)
/* Try restoration of UID if changed (test clearing of saved uid) */
if (old_uid != pw->pw_uid &&
(setuid(old_uid) != -1 || seteuid(old_uid) != -1))
fatal("%s: was able to restore old [e]uid");
fatal("%s: was able to restore old [e]uid", __func__);
/* Verify UID drop was successful */
if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {