From a66039373b81679d8af3ae6da347b1ebf0aedcc2 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Wed, 15 Aug 2001 23:14:49 +0000 Subject: - markus@cvs.openbsd.org 2001/08/08 18:20:15 [uidswap.c] permanently_set_uid is a noop if user is not privilegued; fixes bug on solaris; from sbi@uchicago.edu --- ChangeLog | 6 +++++- uidswap.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c249761d7..bd4498dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ when describing the -o option, give -o Protocol=1 as the specific example since we are SICK AND TIRED of clueless people who cannot have difficulty thinking on their own. + - markus@cvs.openbsd.org 2001/08/08 18:20:15 + [uidswap.c] + permanently_set_uid is a noop if user is not privilegued; + fixes bug on solaris; from sbi@uchicago.edu 20010814 - (stevesk) sshpty.c, cray.[ch]: whitespace, formatting and cleanup @@ -6298,4 +6302,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1477 2001/08/15 23:06:59 mouring Exp $ +$Id: ChangeLog,v 1.1478 2001/08/15 23:14:49 mouring Exp $ diff --git a/uidswap.c b/uidswap.c index 941d6f195..32305a7dc 100644 --- a/uidswap.c +++ b/uidswap.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: uidswap.c,v 1.16 2001/04/20 16:32:22 markus Exp $"); +RCSID("$OpenBSD: uidswap.c,v 1.17 2001/08/08 18:20:15 markus Exp $"); #include "log.h" #include "uidswap.h" @@ -145,6 +145,9 @@ restore_uid(void) void permanently_set_uid(struct passwd *pw) { + /* it's a no-op unless privileged */ + if (!privileged) + return; if (temporarily_use_uid_effective) fatal("restore_uid: temporarily_use_uid effective"); if (setgid(pw->pw_gid) < 0) -- cgit v1.2.3