]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
suid down after fchown. Fixes #1914
authorAlan T. DeKok <aland@freeradius.org>
Thu, 16 Feb 2017 15:59:22 +0000 (10:59 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 16 Feb 2017 15:59:22 +0000 (10:59 -0500)
src/main/mainconfig.c

index 43bc2b1365c1ffd804f5e49809685062603f59ec..938a47ae2ec849d72376c5cd8d39d4dc24920848 100644 (file)
@@ -642,15 +642,6 @@ static int switch_users(CONF_SECTION *cs)
                talloc_free(my_dir);
        }
 
-       /*
-        *      Once we're done with all of the privileged work,
-        *      permanently change the UID.
-        */
-       if (do_suid) {
-               rad_suid_set_down_uid(server_uid);
-               rad_suid_down();
-       }
-
        /*
         *      If we don't already have a log file open, open one
         *      now.  We may not have been logging anything yet.  The
@@ -684,6 +675,15 @@ static int switch_users(CONF_SECTION *cs)
                }
        }
 
+       /*
+        *      Once we're done with all of the privileged work,
+        *      permanently change the UID.
+        */
+       if (do_suid) {
+               rad_suid_set_down_uid(server_uid);
+               rad_suid_down();
+       }
+
        /*
         *      This also clears the dumpable flag if core dumps
         *      aren't allowed.