]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rename modcall_compile_section() to unlang_compile()
authorAlan T. DeKok <aland@freeradius.org>
Wed, 25 May 2016 21:26:23 +0000 (17:26 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 25 May 2016 21:26:23 +0000 (17:26 -0400)
and fix the arguments to it

src/include/modcall.h
src/main/modcall.c
src/main/modules.c

index ca000fa1f8844c6239fb619604484138a52e9613..faf24ef35a2f268b780322650f16543ced45b188 100644 (file)
@@ -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
 }
index 7013f1c26823f4cfb86e3ac80bec71dcd941e112..c62972422c18e85a359e06087da0c00743f72a7d 100644 (file)
@@ -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;
 }
index 6b3a2b75a2f5c0245b3acd67b745dec052723b7f..2b2006059c1592a746023e0314c5ae1b92e92b48 100644 (file)
@@ -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;