diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-22 17:08:00 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-22 17:08:00 +0000 |
commit | ee2786a2a1c295e25b165af1b830fd0ef28985db (patch) | |
tree | eeb3669dc08dde41013094cba041dd2ef063ef6d | |
parent | b8fbb8eca0ae7ce621a40ee95cdb3f139398e0c9 (diff) |
- markus@cvs.openbsd.org 2001/04/20 16:32:22
[uidswap.c]
set non-privileged gid before uid; tholo@ and deraadt@
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | uidswap.c | 10 |
2 files changed, 12 insertions, 6 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20010422 | ||
2 | - OpenBSD CVS Sync | ||
3 | - markus@cvs.openbsd.org 2001/04/20 16:32:22 | ||
4 | [uidswap.c] | ||
5 | set non-privileged gid before uid; tholo@ and deraadt@ | ||
6 | |||
1 | 20010421 | 7 | 20010421 |
2 | - OpenBSD CVS Sync | 8 | - OpenBSD CVS Sync |
3 | - djm@cvs.openbsd.org 2001/04/20 07:17:51 | 9 | - djm@cvs.openbsd.org 2001/04/20 07:17:51 |
@@ -5200,4 +5206,4 @@ | |||
5200 | - Wrote replacements for strlcpy and mkdtemp | 5206 | - Wrote replacements for strlcpy and mkdtemp |
5201 | - Released 1.0pre1 | 5207 | - Released 1.0pre1 |
5202 | 5208 | ||
5203 | $Id: ChangeLog,v 1.1152 2001/04/21 21:31:52 tim Exp $ | 5209 | $Id: ChangeLog,v 1.1153 2001/04/22 17:08:00 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.15 2001/04/08 11:24:33 markus Exp $"); | 15 | RCSID("$OpenBSD: uidswap.c,v 1.16 2001/04/20 16:32:22 markus Exp $"); |
16 | 16 | ||
17 | #include "log.h" | 17 | #include "log.h" |
18 | #include "uidswap.h" | 18 | #include "uidswap.h" |
@@ -81,7 +81,7 @@ temporarily_use_uid(struct passwd *pw) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * Restores to the original uid. | 84 | * Restores to the original (privileged) uid. |
85 | */ | 85 | */ |
86 | void | 86 | void |
87 | restore_uid(void) | 87 | restore_uid(void) |
@@ -92,7 +92,7 @@ restore_uid(void) | |||
92 | return; | 92 | return; |
93 | if (!temporarily_use_uid_effective) | 93 | if (!temporarily_use_uid_effective) |
94 | fatal("restore_uid: temporarily_use_uid not effective"); | 94 | fatal("restore_uid: temporarily_use_uid not effective"); |
95 | /* Set the effective uid back to the saved uid. */ | 95 | /* Set the effective uid back to the saved privileged uid. */ |
96 | if (seteuid(saved_euid) < 0) | 96 | if (seteuid(saved_euid) < 0) |
97 | fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); | 97 | fatal("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); |
98 | if (setgroups(saved_egroupslen, saved_egroups) < 0) | 98 | if (setgroups(saved_egroupslen, saved_egroups) < 0) |
@@ -111,8 +111,8 @@ permanently_set_uid(struct passwd *pw) | |||
111 | { | 111 | { |
112 | if (temporarily_use_uid_effective) | 112 | if (temporarily_use_uid_effective) |
113 | fatal("restore_uid: temporarily_use_uid effective"); | 113 | fatal("restore_uid: temporarily_use_uid effective"); |
114 | if (setuid(pw->pw_uid) < 0) | ||
115 | fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno)); | ||
116 | if (setgid(pw->pw_gid) < 0) | 114 | if (setgid(pw->pw_gid) < 0) |
117 | fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); | 115 | fatal("setgid %u: %.100s", (u_int) pw->pw_gid, strerror(errno)); |
116 | if (setuid(pw->pw_uid) < 0) | ||
117 | fatal("setuid %u: %.100s", (u_int) pw->pw_uid, strerror(errno)); | ||
118 | } | 118 | } |