]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow root to connect to control socket
authorAlan T. DeKok <aland@freeradius.org>
Mon, 4 Jul 2011 16:02:54 +0000 (18:02 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 4 Jul 2011 16:13:36 +0000 (18:13 +0200)
Even if the configured "allowed UID" has a different value.
They're root, so they can do anything.  We might as well be polite.

src/main/command.c

index cc7128c3fdded5a41ea4cf12979b4e220478ac97..2e2ca346010209384c48211f368d7d489b2a2b18 100644 (file)
@@ -2415,18 +2415,26 @@ static int command_domain_accept(rad_listen_t *listener)
                        return 0;
                }
 
-               if (sock->uid_name && (sock->uid != uid)) {
-                       radlog(L_ERR, "Unauthorized connection to %s from uid %ld",
-                              sock->path, (long int) uid);
-                       close(newfd);
-                       return 0;
-               }
-
-               if (sock->gid_name && (sock->gid != gid)) {
-                       radlog(L_ERR, "Unauthorized connection to %s from gid %ld",
-                              sock->path, (long int) gid);
-                       close(newfd);
-                       return 0;
+               /*
+                *      Only do UID checking if the caller is
+                *      non-root.  The superuser can do anything, so
+                *      we might as well let them.
+                */
+               if (uid != 0) {
+                       if (sock->uid_name && (sock->uid != uid)) {
+                               radlog(L_ERR, "Unauthorized connection to %s from uid %ld",
+                                      
+                                      sock->path, (long int) uid);
+                               close(newfd);
+                               return 0;
+                       }
+                       
+                       if (sock->gid_name && (sock->gid != gid)) {
+                               radlog(L_ERR, "Unauthorized connection to %s from gid %ld",
+                                      sock->path, (long int) gid);
+                               close(newfd);
+                               return 0;
+                       }
                }
        }