]> granicus.if.org Git - sudo/commitdiff
Don't try and build saved uid version of set_perms on systems w/o them.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 30 Dec 2000 03:59:40 +0000 (03:59 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 30 Dec 2000 03:59:40 +0000 (03:59 +0000)
Rename set_perms_saved_uid() -> set_perms_posix()
Make set_perms_setreuid simply be set_perms_fallback() and simply include
  the appropriate function at compile time (setreuid() vs. setuid()).

set_perms.c
sudo.c
sudo.h

index 05ab947b5d5026194e8308b99e78a6cdfd515ae5..525e0d0e699898e593edf27810bf8a5de4b2bf37 100644 (file)
@@ -69,13 +69,14 @@ static const char rcsid[] = "$Sudo$";
 static void runas_setup                __P((void));
 static void fatal              __P((char *));
 
+#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION)
 /*
  * Set real and effective uids and gids based on perm.
  * Since we have POSIX saved IDs we can get away with just
  * toggling the effective uid/gid unless we are headed for an exec().
  */
 void
-set_perms_saved_uid(perm, sudo_mode)
+set_perms_posix(perm, sudo_mode)
     int perm;
     int sudo_mode;
 {
@@ -132,14 +133,16 @@ set_perms_saved_uid(perm, sudo_mode)
                                break;
     }
 }
+#endif /* _SC_SAVED_IDS && _SC_VERSION */
 
+#ifdef HAVE_SETREUID
 /*
  * Set real and effective uids and gids based on perm.
  * We always retain a real or effective uid of 0 unless
  * we are headed for an exec().
  */
 void
-set_perms_setreuid(perm, sudo_mode)
+set_perms_fallback(perm, sudo_mode)
     int perm;
     int sudo_mode;
 {
@@ -199,7 +202,8 @@ set_perms_setreuid(perm, sudo_mode)
     }
 }
 
-#ifndef HAVE_SETREUID
+#else
+
 /*
  * Set real and effective uids and gids based on perm.
  * NOTE: does not support the "stay_setuid" option.
diff --git a/sudo.c b/sudo.c
index c464d1112935ff0073cbf62de23c6dfebd10a918..5b2447b700b9b585fe3cdf32768d2f95fc1e5cd4 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -856,14 +856,10 @@ initial_setup()
     /* Set set_perms pointer to the correct function */
 #if defined(_SC_SAVED_IDS) && defined(_SC_VERSION)
     if (sysconf(_SC_SAVED_IDS) == 1 && sysconf(_SC_VERSION) >= 199009)
-       set_perms = set_perms_saved_uid;
+       set_perms = set_perms_posix;
     else
 #endif
-#ifdef HAVE_SETREUID
-    set_perms = set_perms_setreuid;
-#else
-    set_perms = set_perms_fallback;
-#endif
+       set_perms = set_perms_fallback;
 }
 
 #ifdef HAVE_LOGIN_CAP_H
diff --git a/sudo.h b/sudo.h
index 330c99b517522bbb243eff0be38fd85d29d6cbb1..f34274b0437ac8a6e8f87f226a0c65e5899f4738 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -199,8 +199,7 @@ int find_path               __P((char *, char **, char *));
 void check_user                __P((void));
 void verify_user       __P((struct passwd *, char *));
 int sudoers_lookup     __P((int));
-void set_perms_saved_uid __P((int, int));
-void set_perms_setreuid        __P((int, int));
+void set_perms_posix   __P((int, int));
 void set_perms_fallback        __P((int, int));
 void remove_timestamp  __P((int));
 int check_secureware   __P((char *));