CONF_SECTION *cf_subsection_find_next(CONF_SECTION *section,
CONF_SECTION *subsection,
const char *name1);
+CONF_SECTION *cf_section_find_next(CONF_SECTION *section,
+ CONF_SECTION *subsection,
+ const char *name1);
int cf_section_lineno(CONF_SECTION *section);
int cf_pair_lineno(CONF_PAIR *pair);
const char *cf_pair_filename(CONF_PAIR *pair);
server = server->item.parent;
}
- if (!server) {
+ if (0 && !server) {
radlog(L_ERR, "%s[%d]: Processing directives such as \"%s\" cannot be used here.",
filename, *lineno, buf1);
return -1;
return cf_itemtosection(ci);
}
+
+/*
+ * Return the next section after a CONF_SECTION
+ * with a certain name1 (char *name1). If the requested
+ * name1 is NULL, any name1 matches.
+ */
+
+CONF_SECTION *cf_section_find_next(CONF_SECTION *section,
+ CONF_SECTION *subsection,
+ const char *name1)
+{
+ if (!section->item.parent) return NULL;
+
+ return cf_subsection_find_next(section->item.parent, subsection, name1);
+}
+
/*
* Return the next item after a CONF_ITEM.
*/
* Count the old-style realms of this name.
*/
num_home_servers = 0;
- for (subcs = cf_subsection_find_next(cs, NULL, "realm");
+ for (subcs = cf_section_find_next(cs, NULL, "realm");
subcs != NULL;
- subcs = cf_subsection_find_next(cs, subcs, "realm")) {
+ subcs = cf_section_find_next(cs, subcs, "realm")) {
const char *this = cf_section_name2(subcs);
if (!this || (strcmp(this, realm) != 0)) continue;
num_home_servers++;
}
+ if (num_home_servers == 0) {
+ cf_log_err(cf_sectiontoitem(cs), "Internal error counting pools for home server %s.", name);
+ free(home);
+ return 0;
+ }
+
pool = rad_malloc(sizeof(*pool) + num_home_servers * sizeof(pool->servers[0]));
memset(pool, 0, sizeof(*pool) + num_home_servers * sizeof(pool->servers[0]));