]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Set/unset module names when calling signal and resume functions
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 29 Jan 2018 22:29:50 +0000 (15:29 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 29 Jan 2018 22:33:27 +0000 (15:33 -0700)
Not just cosmetic fixes, we hit asserts if the RINDENTs() and REXDENTS() are done with an inconsistent request->module pointer.

This is because there's a separate indentation counter for when the request is being processed by a module, and for when the request is running outside of a module.

src/main/module_unlang.c

index 2e43406ae97197ae7bae31d47c58306e19c6aa11..100d65b9137fb3065c15639e80a7e9bc98732547 100644 (file)
@@ -169,9 +169,11 @@ static void module_unlang_signal(REQUEST *request, void *rctx, fr_state_signal_t
        mc = unlang_generic_to_module_call(mr->parent);
        ms = talloc_get_type_abort(frame->state, unlang_frame_state_modcall_t);
 
+       request->module = mc->module_instance->name;
        ((fr_module_unlang_signal_t)mr->signal)(request,
                                                mc->module_instance->dl_inst->data, ms->thread->data,
                                                rctx, action);
+       request->module = NULL;
 }
 
 static unlang_action_t module_unlang_resume(REQUEST *request, rlm_rcode_t *presult, UNUSED void *rctx)
@@ -192,11 +194,13 @@ static unlang_action_t module_unlang_resume(REQUEST *request, rlm_rcode_t *presu
        /*
         *      Lock is noop unless instance->mutex is set.
         */
+       request->module = mc->module_instance->name;
        safe_lock(mc->module_instance);
        *presult = request->rcode = ((fr_module_unlang_resume_t)mr->callback)(request,
                                                                              mc->module_instance->dl_inst->data,
                                                                              ms->thread->data, mr->rctx);
        safe_unlock(mc->module_instance);
+       request->module = NULL;
 
        if (*presult != RLM_MODULE_YIELD) ms->thread->active_callers--;