From: Alan T. DeKok Date: Wed, 25 May 2016 20:48:44 +0000 (-0400) Subject: Remove all knowledge of components from the interpreter. X-Git-Tag: branch_3_1_x~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=613bf40ef0c6ee2bae65833167f644789f4467bf;p=thirdparty%2Ffreeradius-server.git Remove all knowledge of components from the interpreter. --- diff --git a/src/include/interpreter.h b/src/include/interpreter.h index bdd4b79fefc..c97e4a9502e 100644 --- a/src/include/interpreter.h +++ b/src/include/interpreter.h @@ -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 { diff --git a/src/main/interpreter.c b/src/main/interpreter.c index a8b488fdd57..ca4881baed2 100644 --- a/src/main/interpreter.c +++ b/src/main/interpreter.c @@ -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 : "", diff --git a/src/main/modcall.c b/src/main/modcall.c index bffea946a15..54f848900cf 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -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); } /*