From f52373f732d6b97ce63298dbbec813a13b570d9f Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Sun, 8 Apr 2001 18:38:04 +0000 Subject: [PATCH] - markus@cvs.openbsd.org 2001/04/08 11:24:33 [uidswap.c] KNF --- ChangeLog | 5 ++++- uidswap.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c54b07cae..fba792775 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,9 @@ portforwarding). work by Dan Kaminsky and me. thanks to Dan for this great patch: use 'ssh -D 1080 host' and make netscape use localhost:1080 as a socks proxy. + - markus@cvs.openbsd.org 2001/04/08 11:24:33 + [uidswap.c] + KNF 20010408 - OpenBSD CVS Sync @@ -4961,4 +4964,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1084 2001/04/08 18:30:26 mouring Exp $ +$Id: ChangeLog,v 1.1085 2001/04/08 18:38:04 mouring Exp $ diff --git a/uidswap.c b/uidswap.c index 7cfacd4a5..3786e276f 100644 --- a/uidswap.c +++ b/uidswap.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: uidswap.c,v 1.14 2001/04/06 21:00:16 markus Exp $"); +RCSID("$OpenBSD: uidswap.c,v 1.15 2001/04/08 11:24:33 markus Exp $"); #include "log.h" #include "uidswap.h" @@ -54,8 +54,8 @@ temporarily_use_uid(struct passwd *pw) } privileged = 1; temporarily_use_uid_effective = 1; - saved_egid = getegid(); - saved_egroupslen = getgroups(NGROUPS_MAX, saved_egroups); + saved_egid = getegid(); + saved_egroupslen = getgroups(NGROUPS_MAX, saved_egroups); if (saved_egroupslen < 0) fatal("getgroups: %.100s", strerror(errno)); @@ -69,10 +69,10 @@ temporarily_use_uid(struct passwd *pw) fatal("getgroups: %.100s", strerror(errno)); } /* Set the effective uid to the given (unprivileged) uid. */ - if (setgroups(user_groupslen, user_groups) < 0) + if (setgroups(user_groupslen, user_groups) < 0) fatal("setgroups: %.100s", strerror(errno)); - pw->pw_gid = pw->pw_gid; - if (setegid(pw->pw_gid) < 0) + pw->pw_gid = pw->pw_gid; + if (setegid(pw->pw_gid) < 0) fatal("setegid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); if (seteuid(pw->pw_uid) == -1) @@ -95,9 +95,9 @@ restore_uid(void) /* Set the effective uid back to the saved uid. */ if (seteuid(saved_euid) < 0) fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); - if (setgroups(saved_egroupslen, saved_egroups) < 0) + if (setgroups(saved_egroupslen, saved_egroups) < 0) fatal("setgroups: %.100s", strerror(errno)); - if (setegid(saved_egid) < 0) + if (setegid(saved_egid) < 0) fatal("setegid %u: %.100s", (u_int) saved_egid, strerror(errno)); temporarily_use_uid_effective = 0; }