Check for setuid, and use those checks
authorAlan T. DeKok <aland@freeradius.org>
Tue, 6 Jan 2009 11:09:30 +0000 (12:09 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 6 Jan 2009 11:09:30 +0000 (12:09 +0100)
configure.in
src/main/mainconfig.c

index 7ad546b..7d2f24a 100644 (file)
@@ -826,6 +826,7 @@ AC_CHECK_FUNCS( \
        closefrom \
        gettimeofday \
        getpeereid \
+       setuid \
        setresuid \
        getresuid \
        strlcat \
index 970e773..0693a8d 100644 (file)
@@ -67,7 +67,10 @@ char *debug_condition = NULL;
  *     Temporary local variables for parsing the configuration
  *     file.
  */
-#ifndef __MINGW32__
+#ifdef HAVE_SETUID
+/*
+ *     Systems that have set/getresuid also have setuid.
+ */
 uid_t server_uid;
 static gid_t server_gid;
 static const char *uid_name = NULL;
@@ -403,7 +406,7 @@ static int r_mkdir(const char *part)
 }
 
 
-#ifndef __MINGW32__
+#ifdef HAVE_SETUID
 int did_setuid = FALSE;
 
 #if defined(HAVE_SETRESUID) && defined (HAVE_GETRESUID)
@@ -813,9 +816,9 @@ int read_mainconfig(int reload)
                }
        }
 
-#ifndef __MINGW32__
+#ifdef HAVE_SETUID
        /*
-        *      We should really switch users earlier in the process.
+        *      Switch users as early as possible.
         */
        if (!switch_users(cs)) exit(1);
 #endif