- stevesk@cvs.openbsd.org 2002/07/15 17:15:31
[uidswap.c]
little more debugging; ok markus@
diff --git a/ChangeLog b/ChangeLog
index 0760974..77aa254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,9 @@
[sshd.c]
utmp_len is unsigned; display error consistent with other options.
ok markus@
+ - stevesk@cvs.openbsd.org 2002/07/15 17:15:31
+ [uidswap.c]
+ little more debugging; ok markus@
20020722
- (bal) AIX tty data limiting patch fix by leigh@solinno.co.uk
@@ -1449,4 +1452,4 @@
- (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
-$Id: ChangeLog,v 1.2402 2002/07/23 21:15:13 mouring Exp $
+$Id: ChangeLog,v 1.2403 2002/07/23 21:29:49 mouring Exp $
diff --git a/uidswap.c b/uidswap.c
index 0a772c7..d3109de 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -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 @@
#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 @@
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 @@
{
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)