summaryrefslogtreecommitdiff
path: root/usr.bin/sudo/sudo.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-01-14 00:11:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-01-14 00:11:45 +0000
commitbb6019c6df9f781e59902507fe22bd6e39c04fbc (patch)
treed77e62c5dbbe074d0f21870a031cc7dca4adb102 /usr.bin/sudo/sudo.c
parentf4f544a61c062488ada2cf7986913f30fc3087ee (diff)
sync with sudo 1.6.4-final
Diffstat (limited to 'usr.bin/sudo/sudo.c')
-rw-r--r--usr.bin/sudo/sudo.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index e317d978353..83173713a93 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -98,7 +98,7 @@
#include "version.h"
#ifndef lint
-static const char rcsid[] = "$Sudo: sudo.c,v 1.313 2002/01/08 15:00:18 millert Exp $";
+static const char rcsid[] = "$Sudo: sudo.c,v 1.314 2002/01/13 18:29:23 millert Exp $";
#endif /* lint */
/*
@@ -256,6 +256,21 @@ main(argc, argv, envp)
validated = sudoers_lookup(pwflag);
/*
+ * If we have POSIX saved uids and the stay_setuid flag was not set,
+ * set the real, effective and saved uids to 0 and use set_perms_fallback()
+ * instead of set_perms_posix().
+ */
+#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION)
+ if (!def_flag(I_STAY_SETUID) && set_perms == set_perms_posix) {
+ if (setuid(0)) {
+ perror("setuid(0)");
+ exit(1);
+ }
+ set_perms = set_perms_fallback;
+ }
+#endif
+
+ /*
* Look up runas user passwd struct. If we are given a uid then
* there may be no corresponding passwd(5) entry (which is OK).
*/