Skip to content

Commit

Permalink
Separate RADIUS code from generic code
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Apr 5, 2016
1 parent a6f0c6e commit 183ac0a
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions src/main/modules.c
Expand Up @@ -1347,6 +1347,7 @@ static bool define_type(CONF_SECTION *cs, fr_dict_attr_t const *da, char const *
static bool virtual_server_define_types(CONF_SECTION *cs, rlm_components_t comp)
{
fr_dict_attr_t const *da;
CONF_SECTION *subcs;
CONF_ITEM *ci;

/*
Expand All @@ -1360,45 +1361,34 @@ static bool virtual_server_define_types(CONF_SECTION *cs, rlm_components_t comp)
return false;
}

/*
* Define the Autz-Type, Auth-Type, etc. first.
*/
for (subcs = cf_subsection_find_next(cs, NULL, section_type_value[comp].typename);
subcs != NULL;
subcs = cf_subsection_find_next(cs, subcs, section_type_value[comp].typename)) {
if (!define_type(cs, da, cf_section_name2(subcs))) {
return false;
}
}


if (comp != MOD_AUTHENTICATE) return true;

/*
* Define dynamic types, so that others can reference
* them.
*/
for (ci = cf_item_find_next(cs, NULL);
ci != NULL;
ci = cf_item_find_next(cs, ci)) {
char const *name1;
CONF_SECTION *subcs;

/*
* Create types for simple references
* only when parsing the authenticate
* section.
*/
if ((section_type_value[comp].attr == PW_AUTH_TYPE) &&
cf_item_is_pair(ci)) {
CONF_PAIR *cp = cf_item_to_pair(ci);
if (!define_type(cs, da, cf_pair_attr(cp))) {
return false;
}

continue;
}

if (!cf_item_is_section(ci)) continue;
CONF_PAIR *cp;

subcs = cf_item_to_section(ci);
name1 = cf_section_name1(subcs);
if (!cf_item_is_pair(ci)) continue;

/*
* Not Auth-Type, etc.
*/
if (strcmp(name1, section_type_value[comp].typename) != 0) continue;
cp = cf_item_to_pair(ci);

/*
* And define it.
*/
if (!define_type(cs, da, cf_section_name2(subcs))) {
if (!define_type(cs, da, cf_pair_attr(cp))) {
return false;
}
}
Expand Down

0 comments on commit 183ac0a

Please sign in to comment.