]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Remove all knowledge of components from the interpreter.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 25 May 2016 20:48:44 +0000 (16:48 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 25 May 2016 20:48:44 +0000 (16:48 -0400)
src/include/interpreter.h
src/main/interpreter.c
src/main/modcall.c

index bdd4b79fefc43f844a5d645e64982a3156da5a15..c97e4a9502e5abf2dfce3f83ab0d4ded708d0166 100644 (file)
@@ -86,8 +86,10 @@ typedef struct {
 } modgroup;
 
 typedef struct {
-       modcallable mc;
-       module_instance_t *modinst;
+       modcallable             mc;
+       module_instance_t       *modinst;
+       char const              *method;
+       packetmethod            function;
 } modsingle;
 
 typedef struct {
index a8b488fdd57cb21a098b5098d103bf833804fc60..ca4881baed269d9eb610a2a3c15dc7fefc61d01b 100644 (file)
@@ -69,7 +69,7 @@ static void safe_unlock(module_instance_t *instance)
                pthread_mutex_unlock(instance->mutex);
 }
 
-static rlm_rcode_t CC_HINT(nonnull) unlang_module(rlm_components_t component, modsingle *sp, REQUEST *request)
+static rlm_rcode_t CC_HINT(nonnull) unlang_module(REQUEST *request, modsingle *sp)
 {
        int blocked;
 
@@ -80,7 +80,7 @@ static rlm_rcode_t CC_HINT(nonnull) unlang_module(rlm_components_t component, mo
        if (blocked) return RLM_MODULE_NOOP;
 
        RDEBUG3("modsingle[%s]: calling %s (%s) for request %" PRIu64,
-               comp2str[component], sp->modinst->name,
+               sp->method, sp->modinst->name,
                sp->modinst->module->name, request->number);
 
        if (sp->modinst->force) {
@@ -94,7 +94,7 @@ static rlm_rcode_t CC_HINT(nonnull) unlang_module(rlm_components_t component, mo
        request->module = sp->modinst->name;
 
        safe_lock(sp->modinst);
-       request->rcode = sp->modinst->module->methods[component](sp->modinst->data, request);
+       request->rcode = sp->function(sp->modinst->data, request);
        safe_unlock(sp->modinst);
 
        request->module = NULL;
@@ -109,7 +109,7 @@ static rlm_rcode_t CC_HINT(nonnull) unlang_module(rlm_components_t component, mo
 
  fail:
        RDEBUG3("modsingle[%s]: returned from %s (%s) for request %" PRIu64,
-               comp2str[component], sp->modinst->name,
+               sp->method, sp->modinst->name,
                sp->modinst->module->name, request->number);
 
        return request->rcode;
@@ -676,7 +676,7 @@ static unlang_action_t unlang_single(REQUEST *request, unlang_stack_t *stack,
         */
        sp = mod_callabletosingle(c);
 
-       *presult = unlang_module(c->method, sp, request);
+       *presult = unlang_module(request, sp);
        *priority = c->actions[*presult];
 
        RDEBUG2("%s (%s)", c->name ? c->name : "",
index bffea946a15314380934d22611caa124b72dea4c..54f848900cfa2fed2e0f20138f9253c810c8c6b4 100644 (file)
@@ -2525,7 +2525,7 @@ static CONF_SECTION *virtual_module_find_cs(rlm_components_t *pcomponent,
 }
 
 
-static modcallable *compile_csingle(modcallable *parent, rlm_components_t component, CONF_ITEM *ci, module_instance_t *this, grouptype_t grouptype, char const *realname)
+static modcallable *compile_module(modcallable *parent, rlm_components_t component, CONF_ITEM *ci, module_instance_t *this, grouptype_t grouptype, char const *realname)
 {
        modcallable *c;
        modsingle *single;
@@ -2542,6 +2542,8 @@ static modcallable *compile_csingle(modcallable *parent, rlm_components_t compon
 
        single = talloc_zero(parent, modsingle);
        single->modinst = this;
+       single->function = this->module->methods[component];
+       single->method = comp2str[component];
 
        c = mod_singletocallable(single);
        c->parent = parent;
@@ -2840,7 +2842,7 @@ static modcallable *compile_item(modcallable *parent, rlm_components_t component
        this = module_instantiate_method(modules, realname, &method);
        if (this) {
                *modname = this->module->name;
-               return compile_csingle(parent, method, ci, this, parent_grouptype, realname);
+               return compile_module(parent, method, ci, this, parent_grouptype, realname);
        }
 
        /*