]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
nitgroups only when changing UIDs
authorAlan T. DeKok <aland@freeradius.org>
Fri, 29 May 2015 16:09:35 +0000 (12:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 May 2015 16:10:37 +0000 (12:10 -0400)
src/main/mainconfig.c

index a5552cd9cf72d459136aa310419443f657715a0d..b60f0c6c962367bcab4d77a42e26bfa2dd8c6ca7 100644 (file)
@@ -486,16 +486,16 @@ static int switch_users(CONF_SECTION *cs)
                if (server_uid != user->pw_uid) {
                        server_uid = user->pw_uid;
                        do_suid = true;
-               }
-
 #ifdef HAVE_INITGROUPS
-               if (initgroups(uid_name, server_gid) < 0) {
-                       fprintf(stderr, "%s: Cannot initialize supplementary group list for user %s: %s\n",
-                               progname, uid_name, fr_syserror(errno));
-                       talloc_free(user);
-                       return 0;
-               }
+                       if (initgroups(uid_name, server_gid) < 0) {
+                               fprintf(stderr, "%s: Cannot initialize supplementary group list for user %s: %s\n",
+                                       progname, uid_name, fr_syserror(errno));
+                               talloc_free(user);
+                               return 0;
+                       }
 #endif
+               }
+
                talloc_free(user);
        }