Fix client_add for virtual servers.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 30 Apr 2015 23:48:24 +0000 (19:48 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 30 Apr 2015 23:48:24 +0000 (19:48 -0400)
If there's a "listen" section, the clients are added to that
virtual server.

If there's no "listen" section in this virtual server, the
clients are added to the global list.

src/main/client.c

index f9a3256..1cf500a 100644 (file)
@@ -278,6 +278,7 @@ int client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
        if (!clients) {
                if (client->server != NULL) {
                        CONF_SECTION *cs;
+                       CONF_SECTION *listen;
 
                        cs = cf_section_sub_find_name2(mainconfig.config,
                                                       "server", client->server);
@@ -288,6 +289,13 @@ int client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
                        }
 
                        /*
+                        *      If this server has no "listen" section, add the clients
+                        *      to the global client list.
+                        */
+                       listen = cf_section_sub_find(cs, "listen");
+                       if (!listen) goto global_clients;
+
+                       /*
                         *      If the client list already exists, use that.
                         *      Otherwise, create a new client list.
                         */
@@ -308,6 +316,7 @@ int client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
                        }
 
                } else {
+               global_clients:
                        /*
                         *      Initialize the global list, if not done already.
                         */