diff options
Diffstat (limited to 'uidswap.c')
-rw-r--r-- | uidswap.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: uidswap.c,v 1.35 2006/08/03 03:34:42 deraadt Exp $ */ | 1 | /* $OpenBSD: uidswap.c,v 1.36 2013/11/08 11:15:19 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -20,6 +20,7 @@ | |||
20 | #include <string.h> | 20 | #include <string.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
23 | #include <stdlib.h> | ||
23 | 24 | ||
24 | #include <grp.h> | 25 | #include <grp.h> |
25 | 26 | ||
@@ -133,7 +134,9 @@ temporarily_use_uid(struct passwd *pw) | |||
133 | void | 134 | void |
134 | permanently_drop_suid(uid_t uid) | 135 | permanently_drop_suid(uid_t uid) |
135 | { | 136 | { |
137 | #ifndef HAVE_CYGWIN | ||
136 | uid_t old_uid = getuid(); | 138 | uid_t old_uid = getuid(); |
139 | #endif | ||
137 | 140 | ||
138 | debug("permanently_drop_suid: %u", (u_int)uid); | 141 | debug("permanently_drop_suid: %u", (u_int)uid); |
139 | if (setresuid(uid, uid, uid) < 0) | 142 | if (setresuid(uid, uid, uid) < 0) |
@@ -196,8 +199,10 @@ restore_uid(void) | |||
196 | void | 199 | void |
197 | permanently_set_uid(struct passwd *pw) | 200 | permanently_set_uid(struct passwd *pw) |
198 | { | 201 | { |
202 | #ifndef HAVE_CYGWIN | ||
199 | uid_t old_uid = getuid(); | 203 | uid_t old_uid = getuid(); |
200 | gid_t old_gid = getgid(); | 204 | gid_t old_gid = getgid(); |
205 | #endif | ||
201 | 206 | ||
202 | if (pw == NULL) | 207 | if (pw == NULL) |
203 | fatal("permanently_set_uid: no user given"); | 208 | fatal("permanently_set_uid: no user given"); |