diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-07-23 21:29:49 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-07-23 21:29:49 +0000 |
commit | 1fa330cf35028a45bff8f977ee2935a3a78b0502 (patch) | |
tree | 02a3ed9765ff755b24fbf98d0c1e2d94674799d5 /uidswap.c | |
parent | 41daec7538e7887dc540fdd56afbd21e3c42133e (diff) |
- stevesk@cvs.openbsd.org 2002/07/15 17:15:31
[uidswap.c]
little more debugging; ok markus@
Diffstat (limited to 'uidswap.c')
-rw-r--r-- | uidswap.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: uidswap.c,v 1.22 2002/05/28 21:24:00 stevesk Exp $"); +RCSID("$OpenBSD: uidswap.c,v 1.23 2002/07/15 17:15:31 stevesk Exp $"); #include "log.h" #include "uidswap.h" @@ -52,8 +52,9 @@ temporarily_use_uid(struct passwd *pw) #ifdef SAVED_IDS_WORK_WITH_SETEUID saved_euid = geteuid(); saved_egid = getegid(); - debug("temporarily_use_uid: %u/%u (e=%u)", - (u_int)pw->pw_uid, (u_int)pw->pw_gid, (u_int)saved_euid); + debug("temporarily_use_uid: %u/%u (e=%u/%u)", + (u_int)pw->pw_uid, (u_int)pw->pw_gid, + (u_int)saved_euid, (u_int)saved_egid); if (saved_euid != 0) { privileged = 0; return; @@ -105,13 +106,15 @@ temporarily_use_uid(struct passwd *pw) void restore_uid(void) { - debug("restore_uid"); /* it's a no-op unless privileged */ - if (!privileged) + if (!privileged) { + debug("restore_uid: (unprivileged)"); return; + } if (!temporarily_use_uid_effective) fatal("restore_uid: temporarily_use_uid not effective"); + debug("restore_uid: %u/%u", (u_int)saved_euid, (u_int)saved_egid); #ifdef SAVED_IDS_WORK_WITH_SETEUID /* Set the effective uid back to the saved privileged uid. */ if (seteuid(saved_euid) < 0) @@ -142,6 +145,8 @@ permanently_set_uid(struct passwd *pw) { if (temporarily_use_uid_effective) fatal("permanently_set_uid: temporarily_use_uid effective"); + debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, + (u_int)pw->pw_gid); if (setgid(pw->pw_gid) < 0) fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); if (setuid(pw->pw_uid) < 0) |