From: Alan T. DeKok Date: Wed, 25 May 2016 21:26:23 +0000 (-0400) Subject: rename modcall_compile_section() to unlang_compile() X-Git-Tag: branch_3_1_x~319 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cd1e700539dd83bb47b2314ef2fc1ccbef2e9a9;p=thirdparty%2Ffreeradius-server.git rename modcall_compile_section() to unlang_compile() and fix the arguments to it --- diff --git a/src/include/modcall.h b/src/include/modcall.h index ca000fa1f88..faf24ef35a2 100644 --- a/src/include/modcall.h +++ b/src/include/modcall.h @@ -44,12 +44,7 @@ typedef struct modcallable modcallable; int modcall_fixup_update(vp_map_t *map, void *ctx); -/* Parse a module-method's config section (e.g. authorize{}) into a tree that - * may be called with modcall() */ -modcallable *modcall_compile_section(modcallable *parent, - rlm_components_t component, CONF_SECTION *cs); - -void modcall_debug(modcallable *mc, int depth); +int unlang_compile(CONF_SECTION *cs, rlm_components_t component); #ifdef __cplusplus } diff --git a/src/main/modcall.c b/src/main/modcall.c index 7013f1c2682..c62972422c1 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -948,7 +948,7 @@ static bool pass2_fixup_map(modgroup *g) } #endif -void modcall_debug(modcallable *mc, int depth) +static void unlang_dump(modcallable *mc, int depth) { modcallable *this; modgroup *g; @@ -994,7 +994,7 @@ void modcall_debug(modcallable *mc, int depth) g = mod_callabletogroup(this); DEBUG("%.*s%s {", depth, modcall_spaces, unlang_keyword[this->type]); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; @@ -1004,7 +1004,7 @@ void modcall_debug(modcallable *mc, int depth) fr_cond_snprint(buffer, sizeof(buffer), g->cond); DEBUG("%.*s%s (%s) {", depth, modcall_spaces, unlang_keyword[this->type], buffer); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; @@ -1014,7 +1014,7 @@ void modcall_debug(modcallable *mc, int depth) tmpl_snprint(buffer, sizeof(buffer), g->vpt, NULL); DEBUG("%.*s%s %s {", depth, modcall_spaces, unlang_keyword[this->type], buffer); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; @@ -1023,7 +1023,7 @@ void modcall_debug(modcallable *mc, int depth) g = mod_callabletogroup(this); DEBUG("%.*s%s %s {", depth, modcall_spaces, unlang_keyword[this->type], this->name); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; @@ -1036,7 +1036,7 @@ void modcall_debug(modcallable *mc, int depth) g = mod_callabletogroup(this); DEBUG("%.*s%s {", depth, modcall_spaces, unlang_keyword[this->type]); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; @@ -1046,7 +1046,7 @@ void modcall_debug(modcallable *mc, int depth) g = mod_callabletogroup(this); DEBUG("%.*s%s {", depth, modcall_spaces, unlang_keyword[this->type]); - modcall_debug(g->children, depth + 1); + unlang_dump(g->children, depth + 1); DEBUG("%.*s}", depth, modcall_spaces); break; } @@ -2852,14 +2852,13 @@ fail: return NULL; } -modcallable *modcall_compile_section(modcallable *parent, - rlm_components_t component, CONF_SECTION *cs) +int unlang_compile(CONF_SECTION *cs, rlm_components_t component) { char const *name1, *name2; modcallable *c; - c = compile_group(parent, component, cs, GROUPTYPE_SIMPLE, GROUPTYPE_SIMPLE, MOD_GROUP); - if (!c) return NULL; + c = compile_group(NULL, component, cs, GROUPTYPE_SIMPLE, GROUPTYPE_SIMPLE, MOD_GROUP); + if (!c) return -1; /* * The name / debug name are set to "group". We want @@ -2876,7 +2875,7 @@ modcallable *modcall_compile_section(modcallable *parent, } if (rad_debug_lvl > 3) { - modcall_debug(c, 2); + unlang_dump(c, 2); } /* @@ -2885,5 +2884,5 @@ modcallable *modcall_compile_section(modcallable *parent, cf_data_add(cs, "unlang", c, NULL); dump_tree(component, c); - return c; + return 0; } diff --git a/src/main/modules.c b/src/main/modules.c index 6b3a2b75a2f..2b2006059c1 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -866,7 +866,6 @@ int module_sibling_section_find(CONF_SECTION **out, CONF_SECTION *module, char c static bool load_subcomponent_section(CONF_SECTION *cs, fr_dict_attr_t const *da, rlm_components_t comp) { - modcallable *ml; fr_dict_enum_t *dval; char const *name2 = cf_section_name2(cs); @@ -892,8 +891,9 @@ static bool load_subcomponent_section(CONF_SECTION *cs, /* * Compile the group. */ - ml = modcall_compile_section(NULL, comp, cs); - if (!ml) return false; + if (unlang_compile(cs, comp) < 0) { + return false; + } return true; } @@ -901,7 +901,6 @@ static bool load_subcomponent_section(CONF_SECTION *cs, static int load_component_section(CONF_SECTION *cs, rlm_components_t comp) { CONF_SECTION *subcs; - modcallable *ml; fr_dict_attr_t const *da; /* @@ -932,8 +931,7 @@ static int load_component_section(CONF_SECTION *cs, rlm_components_t comp) /* * Compile the section. */ - ml = modcall_compile_section(NULL, comp, cs); - if (!ml) { + if (unlang_compile(cs, comp) < 0) { cf_log_err_cs(cs, "Errors parsing %s section.\n", cf_section_name1(cs)); return -1;