diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2013-03-22 11:19:48 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2013-03-22 11:19:48 +0000 |
commit | 9b81c128761e4627fc5291f371e0d07903eb4e72 (patch) | |
tree | 7ff06aa6c4c960e7fe13b294a9c2eaddce18a2f1 /uidswap.c | |
parent | 925f1fb7e466dbf645650dc4ea9d2a34e728ef9c (diff) | |
download | src-test2-9b81c128761e4627fc5291f371e0d07903eb4e72.tar.gz src-test2-9b81c128761e4627fc5291f371e0d07903eb4e72.zip |
Notes
Diffstat (limited to 'uidswap.c')
-rw-r--r-- | uidswap.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/uidswap.c b/uidswap.c index 8376483967a9..cdd7309e37f6 100644 --- a/uidswap.c +++ b/uidswap.c @@ -138,20 +138,8 @@ permanently_drop_suid(uid_t uid) uid_t old_uid = getuid(); debug("permanently_drop_suid: %u", (u_int)uid); -#if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID) if (setresuid(uid, uid, uid) < 0) fatal("setresuid %u: %.100s", (u_int)uid, strerror(errno)); -#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) - if (setreuid(uid, uid) < 0) - fatal("setreuid %u: %.100s", (u_int)uid, strerror(errno)); -#else -# ifndef SETEUID_BREAKS_SETUID - if (seteuid(uid) < 0) - fatal("seteuid %u: %.100s", (u_int)uid, strerror(errno)); -# endif - if (setuid(uid) < 0) - fatal("setuid %u: %.100s", (u_int)uid, strerror(errno)); -#endif #ifndef HAVE_CYGWIN /* Try restoration of UID if changed (test clearing of saved uid) */ @@ -220,18 +208,8 @@ permanently_set_uid(struct passwd *pw) debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, (u_int)pw->pw_gid); -#if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID) if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0) fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); -#elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID) - if (setregid(pw->pw_gid, pw->pw_gid) < 0) - fatal("setregid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); -#else - if (setegid(pw->pw_gid) < 0) - fatal("setegid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); - if (setgid(pw->pw_gid) < 0) - fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); -#endif #ifdef __APPLE__ /* @@ -243,20 +221,8 @@ permanently_set_uid(struct passwd *pw) pw->pw_name, (u_int)pw->pw_gid, strerror(errno)); #endif -#if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID) if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); -#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) - if (setreuid(pw->pw_uid, pw->pw_uid) < 0) - fatal("setreuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); -#else -# ifndef SETEUID_BREAKS_SETUID - if (seteuid(pw->pw_uid) < 0) - fatal("seteuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); -# endif - if (setuid(pw->pw_uid) < 0) - fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); -#endif #ifndef HAVE_CYGWIN /* Try restoration of GID if changed (test clearing of saved gid) */ |