summaryrefslogtreecommitdiff
path: root/uidswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'uidswap.c')
-rw-r--r--uidswap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/uidswap.c b/uidswap.c
index 04c269b0a..e517da21d 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -167,9 +167,9 @@ permanently_set_uid(struct passwd *pw)
167#if defined(HAVE_SETRESUID) 167#if defined(HAVE_SETRESUID)
168 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) 168 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
169 fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); 169 fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
170#elif defined(HAVE_SETRESUID) 170#elif defined(HAVE_SETREUID)
171 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) 171 if (setreuid(pw->pw_uid, pw->pw_uid) < 0)
172 fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); 172 fatal("setreuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
173#else 173#else
174# ifndef SETEUID_BREAKS_SETUID 174# ifndef SETEUID_BREAKS_SETUID
175 if (seteuid(pw->pw_uid) < 0) 175 if (seteuid(pw->pw_uid) < 0)
@@ -182,7 +182,7 @@ permanently_set_uid(struct passwd *pw)
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"); 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) {
@@ -194,7 +194,7 @@ permanently_set_uid(struct passwd *pw)
194 /* Try restoration of UID if changed (test clearing of saved uid) */ 194 /* Try restoration of UID if changed (test clearing of saved uid) */
195 if (old_uid != pw->pw_uid && 195 if (old_uid != pw->pw_uid &&
196 (setuid(old_uid) != -1 || seteuid(old_uid) != -1)) 196 (setuid(old_uid) != -1 || seteuid(old_uid) != -1))
197 fatal("%s: was able to restore old [e]uid"); 197 fatal("%s: was able to restore old [e]uid", __func__);
198 198
199 /* Verify UID drop was successful */ 199 /* Verify UID drop was successful */
200 if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) { 200 if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {