[uidswap.c]
     format spec change/casts and some KNF; ok markus@
This commit is contained in:
Ben Lindstrom 2002-06-06 20:38:49 +00:00
parent 105ccbe192
commit abff1dd050
2 changed files with 13 additions and 11 deletions

View File

@ -41,6 +41,9 @@
- stevesk@cvs.openbsd.org 2002/05/28 16:45:27 - stevesk@cvs.openbsd.org 2002/05/28 16:45:27
[monitor_mm.c] [monitor_mm.c]
print strerror(errno) on mmap/munmap error; ok markus@ print strerror(errno) on mmap/munmap error; ok markus@
- stevesk@cvs.openbsd.org 2002/05/28 17:28:02
[uidswap.c]
format spec change/casts and some KNF; ok markus@
20020604 20020604
- (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed
@ -725,4 +728,4 @@
- (stevesk) entropy.c: typo in debug message - (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@ - (djm) ssh-keygen -i needs seeded RNG; report from markus@
$Id: ChangeLog,v 1.2155 2002/06/06 20:33:06 mouring Exp $ $Id: ChangeLog,v 1.2156 2002/06/06 20:38:49 mouring Exp $

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: uidswap.c,v 1.20 2002/04/01 21:50:51 stevesk Exp $"); RCSID("$OpenBSD: uidswap.c,v 1.21 2002/05/28 17:28:02 stevesk Exp $");
#include "log.h" #include "log.h"
#include "uidswap.h" #include "uidswap.h"
@ -52,8 +52,8 @@ temporarily_use_uid(struct passwd *pw)
#ifdef SAVED_IDS_WORK_WITH_SETEUID #ifdef SAVED_IDS_WORK_WITH_SETEUID
saved_euid = geteuid(); saved_euid = geteuid();
saved_egid = getegid(); saved_egid = getegid();
debug("temporarily_use_uid: %d/%d (e=%d)", debug("temporarily_use_uid: %u/%u (e=%u)",
pw->pw_uid, pw->pw_gid, saved_euid); (u_int)pw->pw_uid, (u_int)pw->pw_gid, (u_int)saved_euid);
if (saved_euid != 0) { if (saved_euid != 0) {
privileged = 0; privileged = 0;
return; return;
@ -94,10 +94,10 @@ temporarily_use_uid(struct passwd *pw)
debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno)); debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno));
#endif /* SAVED_IDS_WORK_WITH_SETEUID */ #endif /* SAVED_IDS_WORK_WITH_SETEUID */
if (setegid(pw->pw_gid) < 0) if (setegid(pw->pw_gid) < 0)
fatal("setegid %u: %.100s", (u_int) pw->pw_gid, fatal("setegid %u: %.100s", (u_int)pw->pw_gid,
strerror(errno)); strerror(errno));
if (seteuid(pw->pw_uid) == -1) if (seteuid(pw->pw_uid) == -1)
fatal("seteuid %u: %.100s", (u_int) pw->pw_uid, fatal("seteuid %u: %.100s", (u_int)pw->pw_uid,
strerror(errno)); strerror(errno));
} }
@ -117,10 +117,9 @@ restore_uid(void)
#ifdef SAVED_IDS_WORK_WITH_SETEUID #ifdef SAVED_IDS_WORK_WITH_SETEUID
/* Set the effective uid back to the saved privileged uid. */ /* Set the effective uid back to the saved privileged uid. */
if (seteuid(saved_euid) < 0) if (seteuid(saved_euid) < 0)
fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); fatal("seteuid %u: %.100s", (u_int)saved_euid, strerror(errno));
if (setegid(saved_egid) < 0) if (setegid(saved_egid) < 0)
fatal("setegid %u: %.100s", (u_int) saved_egid, fatal("setegid %u: %.100s", (u_int)saved_egid, strerror(errno));
strerror(errno));
#else /* SAVED_IDS_WORK_WITH_SETEUID */ #else /* SAVED_IDS_WORK_WITH_SETEUID */
/* /*
* We are unable to restore the real uid to its unprivileged value. * We are unable to restore the real uid to its unprivileged value.
@ -148,7 +147,7 @@ permanently_set_uid(struct passwd *pw)
if (temporarily_use_uid_effective) if (temporarily_use_uid_effective)
fatal("restore_uid: temporarily_use_uid effective"); fatal("restore_uid: temporarily_use_uid effective");
if (setgid(pw->pw_gid) < 0) if (setgid(pw->pw_gid) < 0)
fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
if (setuid(pw->pw_uid) < 0) if (setuid(pw->pw_uid) < 0)
fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno)); fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
} }