summaryrefslogtreecommitdiff
path: root/uidswap.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-11-21 23:48:55 +1100
committerDamien Miller <djm@mindrot.org>2003-11-21 23:48:55 +1100
commita8e06cef35c205e1aa562513c6d034a10c8c9a6d (patch)
treecf8bdb4466f553088c020b9179cabd6eaf196075 /uidswap.c
parent8c5e91c03fdd2693f0635f8b2a9904bffc94ce16 (diff)
- djm@cvs.openbsd.org 2003/11/21 11:57:03
[everything] unexpand and delete whitespace at EOL; ok markus@ (done locally and RCS IDs synced)
Diffstat (limited to 'uidswap.c')
-rw-r--r--uidswap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/uidswap.c b/uidswap.c
index 9e161d0f0..a5f76fdcd 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -180,28 +180,28 @@ permanently_set_uid(struct passwd *pw)
180#endif 180#endif
181 181
182 /* Try restoration of GID if changed (test clearing of saved gid) */ 182 /* Try restoration of GID if changed (test clearing of saved gid) */
183 if (old_gid != pw->pw_gid && 183 if (old_gid != pw->pw_gid &&
184 (setgid(old_gid) != -1 || setegid(old_gid) != -1)) 184 (setgid(old_gid) != -1 || setegid(old_gid) != -1))
185 fatal("%s: was able to restore old [e]gid", __func__); 185 fatal("%s: was able to restore old [e]gid", __func__);
186 186
187 /* Verify GID drop was successful */ 187 /* Verify GID drop was successful */
188 if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) { 188 if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) {
189 fatal("%s: egid incorrect gid:%u egid:%u (should be %u)", 189 fatal("%s: egid incorrect gid:%u egid:%u (should be %u)",
190 __func__, (u_int)getgid(), (u_int)getegid(), 190 __func__, (u_int)getgid(), (u_int)getegid(),
191 (u_int)pw->pw_gid); 191 (u_int)pw->pw_gid);
192 } 192 }
193 193
194#ifndef HAVE_CYGWIN 194#ifndef HAVE_CYGWIN
195 /* Try restoration of UID if changed (test clearing of saved uid) */ 195 /* Try restoration of UID if changed (test clearing of saved uid) */
196 if (old_uid != pw->pw_uid && 196 if (old_uid != pw->pw_uid &&
197 (setuid(old_uid) != -1 || seteuid(old_uid) != -1)) 197 (setuid(old_uid) != -1 || seteuid(old_uid) != -1))
198 fatal("%s: was able to restore old [e]uid", __func__); 198 fatal("%s: was able to restore old [e]uid", __func__);
199#endif 199#endif
200 200
201 /* Verify UID drop was successful */ 201 /* Verify UID drop was successful */
202 if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) { 202 if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {
203 fatal("%s: euid incorrect uid:%u euid:%u (should be %u)", 203 fatal("%s: euid incorrect uid:%u euid:%u (should be %u)",
204 __func__, (u_int)getuid(), (u_int)geteuid(), 204 __func__, (u_int)getuid(), (u_int)geteuid(),
205 (u_int)pw->pw_uid); 205 (u_int)pw->pw_uid);
206 } 206 }
207} 207}