Update clients from root_clients, if possible
authoraland <aland>
Sun, 14 Oct 2007 14:03:46 +0000 (14:03 +0000)
committeraland <aland>
Sun, 14 Oct 2007 14:03:46 +0000 (14:03 +0000)
src/main/client.c

index 2297d0f..31be0ba 100644 (file)
@@ -196,14 +196,14 @@ int client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
                 *      Initialize it, if not done already.
                 */
                if (!root_clients) {
-                       clients = clients_init();
-                       if (!clients) return 0;
+                       root_clients = clients_init();
+                       if (!root_clients) return 0;
                        rad_assert(root_clients == NULL);
                }
-               root_clients = clients;
+               clients = root_clients;
        }
 
-       if (client->prefix < 0) {
+       if ((client->prefix < 0) || (client->prefix > 128)) {
                return 0;
        }
 
@@ -298,6 +298,8 @@ RADCLIENT *client_find(const RADCLIENT_LIST *clients,
        int i, max_prefix;
        RADCLIENT myclient;
 
+       if (!clients) clients = root_clients;
+
        if (!clients || !ipaddr) return NULL;
 
        switch (ipaddr->af) {