Bootstrap CoA home servers, as they can stand alone.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 22 Sep 2010 06:04:22 +0000 (08:04 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 22 Sep 2010 09:45:17 +0000 (11:45 +0200)
For the next rev, loop over all home servers *first*, before creating
the pools.

src/main/realms.c

index 97f8acb..208f2e9 100644 (file)
@@ -528,7 +528,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type)
                if (pool_type != home->type) {
                mismatch:
                        cf_log_err(cf_sectiontoitem(cs),
-                                  "Server pool cannot include home server %s of type \"%s\"",
+                                  "Home server %s of unexpected type \"%s\"",
                                   name2, hs_type);
                        goto error;
                }
@@ -783,6 +783,11 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type)
 #endif
        }
 
+       /*
+        *      Mark it as already processed
+        */
+       cf_data_add(cs, "home_server", "added", NULL);
+
        return 1;
 }
 
@@ -1830,6 +1835,22 @@ int realms_init(CONF_SECTION *config)
                        return 0;
                }
        }
+
+       /*
+        *      CoA home servers aren't tied to realms.
+        */
+       for (cs = cf_subsection_find_next(config, NULL, "home_server");
+            cs != NULL;
+            cs = cf_subsection_find_next(config, cs, "home_server")) {
+               /*
+                *      Server was already loaded.
+                */
+               if (cf_data_find(cs, "home_server")) continue;
+
+               if (!home_server_add(rc, cs, HOME_TYPE_COA)) {
+                       return 0;
+               }
+       }
 #endif