diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | uidswap.c | 19 |
2 files changed, 13 insertions, 11 deletions
@@ -41,6 +41,9 @@ | |||
41 | - stevesk@cvs.openbsd.org 2002/05/28 16:45:27 | 41 | - stevesk@cvs.openbsd.org 2002/05/28 16:45:27 |
42 | [monitor_mm.c] | 42 | [monitor_mm.c] |
43 | print strerror(errno) on mmap/munmap error; ok markus@ | 43 | print strerror(errno) on mmap/munmap error; ok markus@ |
44 | - stevesk@cvs.openbsd.org 2002/05/28 17:28:02 | ||
45 | [uidswap.c] | ||
46 | format spec change/casts and some KNF; ok markus@ | ||
44 | 47 | ||
45 | 20020604 | 48 | 20020604 |
46 | - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed | 49 | - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed |
@@ -725,4 +728,4 @@ | |||
725 | - (stevesk) entropy.c: typo in debug message | 728 | - (stevesk) entropy.c: typo in debug message |
726 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ | 729 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ |
727 | 730 | ||
728 | $Id: ChangeLog,v 1.2155 2002/06/06 20:33:06 mouring Exp $ | 731 | $Id: ChangeLog,v 1.2156 2002/06/06 20:38:49 mouring Exp $ |
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: uidswap.c,v 1.20 2002/04/01 21:50:51 stevesk Exp $"); | 15 | RCSID("$OpenBSD: uidswap.c,v 1.21 2002/05/28 17:28:02 stevesk Exp $"); |
16 | 16 | ||
17 | #include "log.h" | 17 | #include "log.h" |
18 | #include "uidswap.h" | 18 | #include "uidswap.h" |
@@ -52,8 +52,8 @@ temporarily_use_uid(struct passwd *pw) | |||
52 | #ifdef SAVED_IDS_WORK_WITH_SETEUID | 52 | #ifdef SAVED_IDS_WORK_WITH_SETEUID |
53 | saved_euid = geteuid(); | 53 | saved_euid = geteuid(); |
54 | saved_egid = getegid(); | 54 | saved_egid = getegid(); |
55 | debug("temporarily_use_uid: %d/%d (e=%d)", | 55 | debug("temporarily_use_uid: %u/%u (e=%u)", |
56 | pw->pw_uid, pw->pw_gid, saved_euid); | 56 | (u_int)pw->pw_uid, (u_int)pw->pw_gid, (u_int)saved_euid); |
57 | if (saved_euid != 0) { | 57 | if (saved_euid != 0) { |
58 | privileged = 0; | 58 | privileged = 0; |
59 | return; | 59 | return; |
@@ -94,10 +94,10 @@ temporarily_use_uid(struct passwd *pw) | |||
94 | debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno)); | 94 | debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno)); |
95 | #endif /* SAVED_IDS_WORK_WITH_SETEUID */ | 95 | #endif /* SAVED_IDS_WORK_WITH_SETEUID */ |
96 | if (setegid(pw->pw_gid) < 0) | 96 | if (setegid(pw->pw_gid) < 0) |
97 | fatal("setegid %u: %.100s", (u_int) pw->pw_gid, | 97 | fatal("setegid %u: %.100s", (u_int)pw->pw_gid, |
98 | strerror(errno)); | 98 | strerror(errno)); |
99 | if (seteuid(pw->pw_uid) == -1) | 99 | if (seteuid(pw->pw_uid) == -1) |
100 | fatal("seteuid %u: %.100s", (u_int) pw->pw_uid, | 100 | fatal("seteuid %u: %.100s", (u_int)pw->pw_uid, |
101 | strerror(errno)); | 101 | strerror(errno)); |
102 | } | 102 | } |
103 | 103 | ||
@@ -117,10 +117,9 @@ restore_uid(void) | |||
117 | #ifdef SAVED_IDS_WORK_WITH_SETEUID | 117 | #ifdef SAVED_IDS_WORK_WITH_SETEUID |
118 | /* Set the effective uid back to the saved privileged uid. */ | 118 | /* Set the effective uid back to the saved privileged uid. */ |
119 | if (seteuid(saved_euid) < 0) | 119 | if (seteuid(saved_euid) < 0) |
120 | fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); | 120 | fatal("seteuid %u: %.100s", (u_int)saved_euid, strerror(errno)); |
121 | if (setegid(saved_egid) < 0) | 121 | if (setegid(saved_egid) < 0) |
122 | fatal("setegid %u: %.100s", (u_int) saved_egid, | 122 | fatal("setegid %u: %.100s", (u_int)saved_egid, strerror(errno)); |
123 | strerror(errno)); | ||
124 | #else /* SAVED_IDS_WORK_WITH_SETEUID */ | 123 | #else /* SAVED_IDS_WORK_WITH_SETEUID */ |
125 | /* | 124 | /* |
126 | * We are unable to restore the real uid to its unprivileged value. | 125 | * We are unable to restore the real uid to its unprivileged value. |
@@ -148,7 +147,7 @@ permanently_set_uid(struct passwd *pw) | |||
148 | if (temporarily_use_uid_effective) | 147 | if (temporarily_use_uid_effective) |
149 | fatal("restore_uid: temporarily_use_uid effective"); | 148 | fatal("restore_uid: temporarily_use_uid effective"); |
150 | if (setgid(pw->pw_gid) < 0) | 149 | if (setgid(pw->pw_gid) < 0) |
151 | fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); | 150 | fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); |
152 | if (setuid(pw->pw_uid) < 0) | 151 | if (setuid(pw->pw_uid) < 0) |
153 | fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno)); | 152 | fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); |
154 | } | 153 | } |