From: Arran Cudbard-Bell Date: Thu, 30 Mar 2023 00:26:40 +0000 (-0600) Subject: Add sigmask to xlat/module/func signal handler registration X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b37897ba51404f2b0d11e1c3bd4ef494c413c04;p=thirdparty%2Ffreeradius-server.git Add sigmask to xlat/module/func signal handler registration --- diff --git a/src/lib/eap/tls.c b/src/lib/eap/tls.c index 436c3675c99..749ef7c740d 100644 --- a/src/lib/eap/tls.c +++ b/src/lib/eap/tls.c @@ -924,7 +924,7 @@ static inline CC_HINT(always_inline) unlang_action_t eap_tls_handshake_push(requ if (unlang_function_push(request, NULL, eap_tls_handshake_resume, - NULL, UNLANG_SUB_FRAME, eap_session) < 0) return UNLANG_ACTION_FAIL; + NULL, 0, UNLANG_SUB_FRAME, eap_session) < 0) return UNLANG_ACTION_FAIL; if (fr_tls_session_async_handshake_push(request, tls_session) < 0) return UNLANG_ACTION_FAIL; diff --git a/src/lib/eap_aka_sim/module.c b/src/lib/eap_aka_sim/module.c index f7bb8e3f98e..0f7bb21b369 100644 --- a/src/lib/eap_aka_sim/module.c +++ b/src/lib/eap_aka_sim/module.c @@ -440,7 +440,7 @@ done: * frame when the state machine finishes with * this round. */ - (void)unlang_module_yield(request, mod_encode, NULL, NULL); + (void)unlang_module_yield(request, mod_encode, NULL, 0, NULL); if (virtual_server_push(request, inst->virtual_server, UNLANG_SUB_FRAME) < 0) { unlang_interpet_frame_discard(request); diff --git a/src/lib/eap_aka_sim/state_machine.c b/src/lib/eap_aka_sim/state_machine.c index 55fb0cabc07..ceee377cd55 100644 --- a/src/lib/eap_aka_sim/state_machine.c +++ b/src/lib/eap_aka_sim/state_machine.c @@ -60,6 +60,7 @@ RCSID("$Id$") RLM_MODULE_NOOP, \ resume_ ## _x, \ mod_signal, \ + ~FR_SIGNAL_CANCEL, \ talloc_get_type_abort(mctx->rctx, eap_aka_sim_session_t)) /* @@ -114,10 +115,8 @@ static size_t aka_sim_state_table_len = NUM_ELEMENTS(aka_sim_state_table); * @param[in] request The current request. * @param[in] action to perform. */ -static void mod_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_signal(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Request cancelled - Destroying session"); /* @@ -2952,6 +2951,7 @@ STATE(aka_identity) RLM_MODULE_NOOP, resume_recv_aka_identity_response, mod_signal, + ~FR_SIGNAL_CANCEL, eap_aka_sim_session); } @@ -3057,6 +3057,7 @@ STATE_GUARD(aka_identity) RLM_MODULE_NOOP, resume_send_aka_identity_request, mod_signal, + ~FR_SIGNAL_CANCEL, eap_aka_sim_session); } @@ -3288,6 +3289,7 @@ STATE(sim_start) RLM_MODULE_NOOP, resume_recv_sim_start_response, mod_signal, + ~FR_SIGNAL_CANCEL, eap_aka_sim_session); } @@ -3420,6 +3422,7 @@ STATE_GUARD(sim_start) RLM_MODULE_NOOP, resume_send_sim_start, mod_signal, + ~FR_SIGNAL_CANCEL, eap_aka_sim_session); } diff --git a/src/lib/ldap/base.c b/src/lib/ldap/base.c index 17209ed9b0c..8d8f2470cde 100644 --- a/src/lib/ldap/base.c +++ b/src/lib/ldap/base.c @@ -608,11 +608,10 @@ static unlang_action_t ldap_trunk_query_results(rlm_rcode_t *p_result, UNUSED in /** Signal an LDAP query running on a trunk connection to cancel * */ -static void ldap_trunk_query_cancel(UNUSED request_t *request, fr_state_signal_t action, void *uctx) +static void ldap_trunk_query_cancel(UNUSED request_t *request, UNUSED fr_signal_t action, void *uctx) { fr_ldap_query_t *query = talloc_get_type_abort(uctx, fr_ldap_query_t); - if (action != FR_SIGNAL_CANCEL) return; /* * Query may have completed, but the request * not yet have been resumed. @@ -708,7 +707,7 @@ unlang_action_t fr_ldap_trunk_search(rlm_rcode_t *p_result, } action = unlang_function_push(request, is_async ? NULL : ldap_trunk_query_start, ldap_trunk_query_results, - ldap_trunk_query_cancel, is_async ? UNLANG_SUB_FRAME : UNLANG_TOP_FRAME, query); + ldap_trunk_query_cancel, ~FR_SIGNAL_CANCEL, is_async ? UNLANG_SUB_FRAME : UNLANG_TOP_FRAME, query); if (action == UNLANG_ACTION_FAIL) goto error; @@ -788,7 +787,7 @@ unlang_action_t fr_ldap_trunk_modify(rlm_rcode_t *p_result, } action = unlang_function_push(request, is_async ? NULL : ldap_trunk_query_start, ldap_trunk_query_results, - ldap_trunk_query_cancel, is_async ? UNLANG_SUB_FRAME : UNLANG_TOP_FRAME, query); + ldap_trunk_query_cancel, ~FR_SIGNAL_CANCEL, is_async ? UNLANG_SUB_FRAME : UNLANG_TOP_FRAME, query); if (action == UNLANG_ACTION_FAIL) goto error; diff --git a/src/lib/ldap/bind.c b/src/lib/ldap/bind.c index 729d92d1898..5b36193816a 100644 --- a/src/lib/ldap/bind.c +++ b/src/lib/ldap/bind.c @@ -306,12 +306,10 @@ static unlang_action_t ldap_async_auth_bind_results(rlm_rcode_t *p_result, UNUSE /** Signal an outstanding LDAP bind request to cancel * */ -static void ldap_async_auth_bind_cancel(UNUSED request_t *request, fr_state_signal_t action, void *uctx) +static void ldap_async_auth_bind_cancel(UNUSED request_t *request, UNUSED fr_signal_t action, void *uctx) { fr_ldap_bind_auth_ctx_t *bind_auth_ctx = talloc_get_type_abort(uctx, fr_ldap_bind_auth_ctx_t); - if (action != FR_SIGNAL_CANCEL) return; - ldap_abandon_ext(bind_auth_ctx->bind_ctx->c->handle, bind_auth_ctx->msgid, NULL, NULL); fr_rb_remove(bind_auth_ctx->thread->binds, bind_auth_ctx); @@ -350,5 +348,9 @@ int fr_ldap_bind_auth_async(request_t *request, fr_ldap_thread_t *thread, char c bind_auth_ctx->thread = thread; bind_auth_ctx->ret = LDAP_RESULT_PENDING; - return unlang_function_push(request, ldap_async_auth_bind_start, ldap_async_auth_bind_results, ldap_async_auth_bind_cancel, UNLANG_TOP_FRAME, bind_auth_ctx); + return unlang_function_push(request, + ldap_async_auth_bind_start, + ldap_async_auth_bind_results, + ldap_async_auth_bind_cancel, + ~FR_SIGNAL_CANCEL, UNLANG_TOP_FRAME, bind_auth_ctx); } diff --git a/src/lib/server/process.h b/src/lib/server/process.h index 997efb05de6..9be07e11388 100644 --- a/src/lib/server/process.h +++ b/src/lib/server/process.h @@ -190,7 +190,7 @@ RECV(generic) if (cs) RDEBUG("Running '%s %s' from file %s", cf_section_name1(cs), cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->resume, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME(recv_generic) @@ -219,7 +219,7 @@ RESUME(recv_generic) fr_assert(state->send != NULL); return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->send, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME_NO_MCTX(recv_no_send) @@ -303,7 +303,7 @@ SEND(generic) return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->resume, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME(send_generic) @@ -358,7 +358,7 @@ RESUME(send_generic) return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->send, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } fr_assert(!state->packet_type[rcode] || (state->packet_type[rcode] == request->reply->code)); diff --git a/src/lib/server/request.h b/src/lib/server/request.h index 9e925908a50..65b6cb23ead 100644 --- a/src/lib/server/request.h +++ b/src/lib/server/request.h @@ -75,7 +75,7 @@ typedef enum request_state_t { REQUEST_OTHER_4, } request_state_t; -typedef void (*fr_request_process_t)(request_t *, fr_state_signal_t); //!< Function handler for requests. +typedef void (*fr_request_process_t)(request_t *, fr_signal_t); //!< Function handler for requests. typedef rlm_rcode_t (*RAD_REQUEST_FUNP)(request_t *); extern HIDDEN fr_dict_attr_t const *request_attr_root; diff --git a/src/lib/server/signal.h b/src/lib/server/signal.h index bfc0dd2a859..f108e7af2f3 100644 --- a/src/lib/server/signal.h +++ b/src/lib/server/signal.h @@ -32,18 +32,27 @@ extern "C" { /** Signals that can be generated/processed by request signal handlers * + * This is a bitfield so that it can be used to specify signal masks. */ -typedef enum fr_state_signal_t { /* server action */ - FR_SIGNAL_INVALID = 0, - FR_SIGNAL_RUN, - FR_SIGNAL_CANCEL, //!< Request has been cancelled. If a module is signalled - ///< with this, the module should stop processing - ///< the request and cleanup anything it's done. - FR_SIGNAL_DUP, //!< A duplicate request was received. - FR_SIGNAL_DETACH, //!< Request is being detached from its parent. - FR_SIGNAL_RETRY, //!< a retry timer has hit - FR_SIGNAL_TIMEOUT //!< a retry timeout or max count has hit -} fr_state_signal_t; +DIAG_OFF(attributes) /* Stupid GCC */ +typedef enum CC_HINT(flag_enum) { /* server action */ + FR_SIGNAL_INVALID = 0x00, + FR_SIGNAL_CANCEL = 0x01, //!< Request has been cancelled. + ///< If a module is signalled with this, the module + ///< should stop processing the request and cleanup + ///< anything it's done. + FR_SIGNAL_DUP = 0x02, //!< A duplicate request was received. + FR_SIGNAL_DETACH = 0x04, //!< Request is being detached from its parent. + FR_SIGNAL_RETRY = 0x08, //!< a retry timer has hit + FR_SIGNAL_TIMEOUT = 0x10 //!< a retry timeout or max count has hit +} fr_signal_t; +DIAG_ON(attributes) + +#define fr_signal_is_cancel(_signal) (_signal & FR_SIGNAL_CANCEL) +#define fr_signal_is_dup(_signal) (_signal & FR_SIGNAL_DUP) +#define fr_signal_is_detach(_signal) (_signal & FR_SIGNAL_DETACH) +#define fr_signal_is_retry(_signal) (_signal & FR_SIGNAL_RETRY) +#define fr_signal_is_timeout(_signal) (_signal & FR_SIGNAL_TIMEOUT) #ifdef __cplusplus } diff --git a/src/lib/server/trigger.c b/src/lib/server/trigger.c index 8a71b2c9d7a..57a09349fd3 100644 --- a/src/lib/server/trigger.c +++ b/src/lib/server/trigger.c @@ -468,7 +468,7 @@ int trigger_exec(unlang_interpret_t *intp, } if (unlang_function_push(request, trigger_run, trigger_resume, - NULL, UNLANG_TOP_FRAME, trigger) < 0) goto error; + NULL, 0, UNLANG_TOP_FRAME, trigger) < 0) goto error; if (!intp) { /* diff --git a/src/lib/tls/session.c b/src/lib/tls/session.c index c2b5096531e..222a4731d70 100644 --- a/src/lib/tls/session.c +++ b/src/lib/tls/session.c @@ -1285,13 +1285,11 @@ static unlang_action_t tls_session_async_handshake_done_round(UNUSED rlm_rcode_t * @param[in] action we're being signalled with. * @param[in] uctx the SSL * to cancell. */ -static void tls_session_async_handshake_signal(UNUSED request_t *request, fr_state_signal_t action, void *uctx) +static void tls_session_async_handshake_signal(UNUSED request_t *request, UNUSED fr_signal_t action, void *uctx) { fr_tls_session_t *tls_session = talloc_get_type_abort(uctx, fr_tls_session_t); int ret; - if (action != FR_SIGNAL_CANCEL) return; - /* * We might want to set can_pause = false here * but that would trigger asserts in the @@ -1578,6 +1576,7 @@ unlang_action_t fr_tls_session_async_handshake_push(request_t *request, fr_tls_s tls_session_async_handshake, NULL, tls_session_async_handshake_signal, + ~FR_SIGNAL_CANCEL, UNLANG_SUB_FRAME, tls_session); } diff --git a/src/lib/tls/virtual_server.c b/src/lib/tls/virtual_server.c index ca4bd7203ba..82a9602d2fc 100644 --- a/src/lib/tls/virtual_server.c +++ b/src/lib/tls/virtual_server.c @@ -70,7 +70,7 @@ unlang_action_t fr_tls_call_push(request_t *child, unlang_function_t resume, * subrequest completes. */ if (unlang_function_push(child, NULL, resume, - NULL, UNLANG_SUB_FRAME, tls_session) < 0) return UNLANG_ACTION_FAIL; + NULL, 0, UNLANG_SUB_FRAME, tls_session) < 0) return UNLANG_ACTION_FAIL; /* * Now the child and parent stacks are both diff --git a/src/lib/unlang/function.c b/src/lib/unlang/function.c index f51e76528d2..31610568934 100644 --- a/src/lib/unlang/function.c +++ b/src/lib/unlang/function.c @@ -37,6 +37,7 @@ typedef struct { unlang_function_t repeat; //!< To call when going back up the stack. char const *repeat_name; //!< Debug name for the repeat function. unlang_function_signal_t signal; //!< Signal function to call. + fr_signal_t sigmask; //!< Signals to block. char const *signal_name; //!< Debug name for the signal function. void *uctx; //!< Uctx to pass to function. } unlang_frame_state_func_t; @@ -71,11 +72,11 @@ static unlang_t function_instruction = { * @param[in] action Type of signal. */ static void unlang_function_signal(request_t *request, - unlang_stack_frame_t *frame, fr_state_signal_t action) + unlang_stack_frame_t *frame, fr_signal_t action) { unlang_frame_state_func_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_func_t); - if (!state->signal) return; + if (!state->signal || (action & state->sigmask)) return; state->signal(request, action, state->uctx); } @@ -184,12 +185,13 @@ int unlang_function_clear(request_t *request) * * @param[in] request The current request. * @param[in] signal The signal function to set. + * @param[in] sigmask Signals to block. * @param[in] signal_name Name of the signal function call (for debugging). * @return * - 0 on success. * - -1 on failure. */ -int _unlang_function_signal_set(request_t *request, unlang_function_signal_t signal, char const *signal_name) +int _unlang_function_signal_set(request_t *request, unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name) { unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; @@ -208,6 +210,7 @@ int _unlang_function_signal_set(request_t *request, unlang_function_signal_t sig * once the current function returns. */ state->signal = signal; + state->sigmask = sigmask; state->signal_name = signal_name; return 0; @@ -265,6 +268,7 @@ int _unlang_function_repeat_set(request_t *request, unlang_function_t repeat, ch * This may be the same as func. * @param[in] repeat_name Name of the repeat function call (for debugging). * @param[in] signal function to call if the request is signalled. + * @param[in] sigmask Signals to block. * @param[in] signal_name Name of the signal function call (for debugging). * @param[in] top_frame Return out of the unlang interpreter when popping this frame. * @param[in] uctx to pass to func(s). @@ -275,7 +279,7 @@ int _unlang_function_repeat_set(request_t *request, unlang_function_t repeat, ch unlang_action_t _unlang_function_push(request_t *request, unlang_function_t func, char const *func_name, unlang_function_t repeat, char const *repeat_name, - unlang_function_signal_t signal, char const *signal_name, + unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name, bool top_frame, void *uctx) { unlang_stack_t *stack = request->stack; @@ -305,6 +309,7 @@ unlang_action_t _unlang_function_push(request_t *request, state->repeat = repeat; state->repeat_name = repeat_name; state->signal = signal; + state->sigmask = sigmask; state->signal_name = signal_name; state->uctx = uctx; diff --git a/src/lib/unlang/function.h b/src/lib/unlang/function.h index 797c25ee9a9..40aeb3b5fb1 100644 --- a/src/lib/unlang/function.h +++ b/src/lib/unlang/function.h @@ -56,7 +56,7 @@ typedef unlang_action_t (*unlang_function_t)(rlm_rcode_t *p_result, int *priorit * interpreter, but should be usable by the function. * All input (args) and output will be done using this structure. */ -typedef void (*unlang_function_signal_t)(request_t *request, fr_state_signal_t action, void *uctx); +typedef void (*unlang_function_signal_t)(request_t *request, fr_signal_t action, void *uctx); int unlang_function_clear(request_t *request) CC_HINT(warn_unused_result); @@ -72,7 +72,7 @@ int unlang_function_clear(request_t *request) CC_HINT(warn_unused_result); */ #define unlang_function_signal_set(_request, _signal) \ _unlang_function_signal_set(_request, _signal, STRINGIFY(_signal)) -int _unlang_function_signal_set(request_t *request, unlang_function_signal_t signal, char const *name) +int _unlang_function_signal_set(request_t *request, unlang_function_signal_t signal, fr_signal_t sigmask, char const *name) CC_HINT(warn_unused_result); /** Set a new repeat function for an existing function frame @@ -100,22 +100,23 @@ int _unlang_function_repeat_set(request_t *request, unlang_function_t repeat, c * @param[in] _repeat function to call going back down the stack (may be NULL). * This may be the same as func. * @param[in] _signal function to call if the request is signalled. + * @param[in] _sigmask Signals to block. * @param[in] _top_frame Return out of the unlang interpreter when popping this frame. * @param[in] _uctx to pass to func(s). * @return * - 0 on success. * - -1 on failure. */ -#define unlang_function_push(_request, _func, _repeat, _signal, _top_frame, _uctx) \ +#define unlang_function_push(_request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx) \ _unlang_function_push(_request, \ _func, STRINGIFY(_func), \ _repeat, STRINGIFY(_repeat), \ - _signal, STRINGIFY(_signal), \ + _signal, _sigmask, STRINGIFY(_signal), \ _top_frame, _uctx) unlang_action_t _unlang_function_push(request_t *request, unlang_function_t func, char const *func_name, unlang_function_t repeat, char const *repeat_name, - unlang_function_signal_t signal, char const *signal_name, + unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name, bool top_frame, void *uctx) CC_HINT(warn_unused_result); diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 9af403d6cd1..6dcd4a44373 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1048,7 +1048,7 @@ void unlang_interpret_request_detach(request_t *request) * @param[in] action to signal. * @param[in] limit the frame at which to stop signaling. */ -void unlang_frame_signal(request_t *request, fr_state_signal_t action, int limit) +void unlang_frame_signal(request_t *request, fr_signal_t action, int limit) { unlang_stack_frame_t *frame; unlang_stack_t *stack = request->stack; @@ -1102,7 +1102,7 @@ void unlang_frame_signal(request_t *request, fr_state_signal_t action, int limit * @param[in] request The current request. * @param[in] action to signal. */ -void unlang_interpret_signal(request_t *request, fr_state_signal_t action) +void unlang_interpret_signal(request_t *request, fr_signal_t action) { unlang_stack_t *stack = request->stack; @@ -1407,7 +1407,7 @@ static xlat_action_t unlang_cancel_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, * We call unlang_xlat_yield to keep the interpreter happy * as it expects to see a resume function set. */ - if (!timeout) return unlang_xlat_yield(request, unlang_cancel_never_run, NULL, NULL); + if (!timeout) return unlang_xlat_yield(request, unlang_cancel_never_run, NULL, 0, NULL); if (ev_p_og) { MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_TIME_DELTA, NULL, false)); diff --git a/src/lib/unlang/interpret.h b/src/lib/unlang/interpret.h index cf2be144fb7..558d96d846d 100644 --- a/src/lib/unlang/interpret.h +++ b/src/lib/unlang/interpret.h @@ -158,7 +158,7 @@ void unlang_interpret_mark_runnable(request_t *request); bool unlang_interpret_is_resumable(request_t *request); -void unlang_interpret_signal(request_t *request, fr_state_signal_t action); +void unlang_interpret_signal(request_t *request, fr_signal_t action); int unlang_interpret_stack_depth(request_t *request); diff --git a/src/lib/unlang/limit.c b/src/lib/unlang/limit.c index 058fb7f2666..aececa084d9 100644 --- a/src/lib/unlang/limit.c +++ b/src/lib/unlang/limit.c @@ -45,7 +45,7 @@ typedef struct { * @param[in] frame current stack frame. * @param[in] action to signal. */ -static void unlang_limit_signal(UNUSED request_t *request, unlang_stack_frame_t *frame, fr_state_signal_t action) +static void unlang_limit_signal(UNUSED request_t *request, unlang_stack_frame_t *frame, fr_signal_t action) { unlang_frame_state_limit_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_limit_t); diff --git a/src/lib/unlang/module.c b/src/lib/unlang/module.c index 7f2752aa156..e1355f0fb4c 100644 --- a/src/lib/unlang/module.c +++ b/src/lib/unlang/module.c @@ -440,6 +440,7 @@ int unlang_module_set_resume(request_t *request, module_method_t resume) * @param[in] exp XLAT expansion to evaluate. * @param[in] resume function to call when the XLAT expansion is complete. * @param[in] signal function to call if a signal is received. + * @param[in] sigmask Signals to block. * @param[in] rctx to pass to the resume() and signal() callbacks. * @return * - UNLANG_ACTION_PUSHED_CHILD @@ -447,13 +448,13 @@ int unlang_module_set_resume(request_t *request, module_method_t resume) unlang_action_t unlang_module_yield_to_xlat(TALLOC_CTX *ctx, bool *p_success, fr_value_box_list_t *out, request_t *request, xlat_exp_head_t const *exp, module_method_t resume, - unlang_module_signal_t signal, void *rctx) + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx) { /* * Push the resumption point BEFORE pushing the xlat onto * the parents stack. */ - (void) unlang_module_yield(request, resume, signal, rctx); + (void) unlang_module_yield(request, resume, signal, sigmask, rctx); /* * Push the xlat function @@ -494,13 +495,13 @@ unlang_action_t unlang_module_yield_to_tmpl(TALLOC_CTX *ctx, fr_value_box_list_t request_t *request, tmpl_t const *vpt, unlang_tmpl_args_t *args, module_method_t resume, - unlang_module_signal_t signal, void *rctx) + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx) { /* * Push the resumption point BEFORE pushing the xlat onto * the parents stack. */ - (void) unlang_module_yield(request, resume, signal, rctx); + (void) unlang_module_yield(request, resume, signal, sigmask, rctx); /* * Push the xlat function @@ -516,7 +517,7 @@ unlang_action_t unlang_module_yield_to_section(rlm_rcode_t *p_result, request_t *request, CONF_SECTION *subcs, rlm_rcode_t default_rcode, module_method_t resume, - unlang_module_signal_t signal, void *rctx) + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx) { if (!subcs) { unlang_stack_t *stack = request->stack; @@ -545,7 +546,7 @@ unlang_action_t unlang_module_yield_to_section(rlm_rcode_t *p_result, * Push the resumption point BEFORE adding the subsection * to the parents stack. */ - (void) unlang_module_yield(request, resume, signal, rctx); + (void) unlang_module_yield(request, resume, signal, sigmask, rctx); if (unlang_interpret_push_section(request, subcs, default_rcode, UNLANG_SUB_FRAME) < 0) return UNLANG_ACTION_STOP_PROCESSING; @@ -566,12 +567,13 @@ unlang_action_t unlang_module_yield_to_section(rlm_rcode_t *p_result, * @param[in] request The current request. * @param[in] resume Called on unlang_interpret_mark_runnable(). * @param[in] signal Called on unlang_action(). + * @param[in] sigmask Set of signals to block. * @param[in] rctx to pass to the callbacks. * @return * - UNLANG_ACTION_YIELD. */ unlang_action_t unlang_module_yield(request_t *request, - module_method_t resume, unlang_module_signal_t signal, void *rctx) + module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx) { unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; @@ -582,6 +584,7 @@ unlang_action_t unlang_module_yield(request_t *request, state->rctx = rctx; state->resume = resume; state->signal = signal; + state->sigmask = sigmask; /* * We set the repeatable flag here, @@ -620,7 +623,7 @@ static inline CC_HINT(always_inline) void safe_unlock(module_instance_t *mi) * @param[in] frame current stack frame. * @param[in] action to signal. */ -static void unlang_module_signal(request_t *request, unlang_stack_frame_t *frame, fr_state_signal_t action) +static void unlang_module_signal(request_t *request, unlang_stack_frame_t *frame, fr_signal_t action) { unlang_frame_state_module_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_module_t); unlang_module_t *mc = unlang_generic_to_module(frame->instruction); @@ -634,7 +637,7 @@ static void unlang_module_signal(request_t *request, unlang_stack_frame_t *frame caller = request->module; request->module = mc->instance->name; safe_lock(mc->instance); - state->signal(MODULE_CTX(mc->instance->dl_inst, state->thread->data, state->env_data, state->rctx), request, action); + if (!(action & state->sigmask)) state->signal(MODULE_CTX(mc->instance->dl_inst, state->thread->data, state->env_data, state->rctx), request, action); safe_unlock(mc->instance); request->module = caller; diff --git a/src/lib/unlang/module.h b/src/lib/unlang/module.h index 64caa339fd2..a4c6f14d22f 100644 --- a/src/lib/unlang/module.h +++ b/src/lib/unlang/module.h @@ -64,7 +64,7 @@ typedef void (*unlang_module_timeout_t)(module_ctx_t const *mctx, request_t *req */ typedef void (*unlang_module_fd_event_t)(module_ctx_t const *mctx, request_t *request, int fd); -/** A callback when the request gets a fr_state_signal_t. +/** A callback when the request gets a fr_signal_t. * * A module may call unlang_yeild(), but still need to do something on FR_SIGNAL_DUP. If so, it's * set here. @@ -76,7 +76,7 @@ typedef void (*unlang_module_fd_event_t)(module_ctx_t const *mctx, request_t *re * @param[in] request The current request. * @param[in] action which is signalling the request. */ -typedef void (*unlang_module_signal_t)(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action); +typedef void (*unlang_module_signal_t)(module_ctx_t const *mctx, request_t *request, fr_signal_t action); int unlang_module_timeout_add(request_t *request, unlang_module_timeout_t callback, void const *rctx, fr_time_t when); @@ -97,32 +97,26 @@ int unlang_module_push(rlm_rcode_t *p_result, request_t *request, int unlang_module_set_resume(request_t *request, module_method_t resume); -unlang_action_t unlang_module_yield_to_subrequest(rlm_rcode_t *p_result, request_t *child, - module_method_t resume, - unlang_module_signal_t signal, - unlang_subrequest_session_t const *session, - void *rctx); - unlang_action_t unlang_module_yield_to_section(rlm_rcode_t *p_result, request_t *request, CONF_SECTION *subcs, rlm_rcode_t default_rcode, module_method_t resume, - unlang_module_signal_t signal, void *rctx); + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx); unlang_action_t unlang_module_yield_to_xlat(TALLOC_CTX *ctx, bool *p_success, fr_value_box_list_t *out, request_t *request, xlat_exp_head_t const *xlat, module_method_t resume, - unlang_module_signal_t signal, void *rctx); + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx); unlang_action_t unlang_module_yield_to_tmpl(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *request, tmpl_t const *vpt, unlang_tmpl_args_t *args, module_method_t resume, - unlang_module_signal_t signal, void *rctx); + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx); unlang_action_t unlang_module_yield(request_t *request, module_method_t resume, - unlang_module_signal_t signal, void *rctx); + unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx); #ifdef __cplusplus } diff --git a/src/lib/unlang/module_priv.h b/src/lib/unlang/module_priv.h index 48e5fc06ea2..1faf1f294bf 100644 --- a/src/lib/unlang/module_priv.h +++ b/src/lib/unlang/module_priv.h @@ -85,8 +85,9 @@ typedef struct { * @{ */ void *rctx; //!< for resume / signal - module_method_t resume; //!< resumption handler + module_method_t resume; //!< resumption handler unlang_module_signal_t signal; //!< for signal handlers + fr_signal_t sigmask; //!< Signals to block. /** @} */ diff --git a/src/lib/unlang/parallel.c b/src/lib/unlang/parallel.c index 0524823974e..f7c00779479 100644 --- a/src/lib/unlang/parallel.c +++ b/src/lib/unlang/parallel.c @@ -110,14 +110,12 @@ static void unlang_parallel_cancel_siblings(request_t *request) * * When a request detaches we need */ -static void unlang_parallel_child_signal(request_t *request, fr_state_signal_t action, void *uctx) +static void unlang_parallel_child_signal(request_t *request, UNUSED fr_signal_t action, void *uctx) { unlang_parallel_child_t *child = uctx; unlang_stack_frame_t *frame; unlang_parallel_state_t *state; - if (action != FR_SIGNAL_DETACH) return; - frame = frame_current(request->parent); state = talloc_get_type_abort(frame->state, unlang_parallel_state_t); @@ -368,6 +366,7 @@ static unlang_action_t unlang_parallel_process(rlm_rcode_t *p_result, request_t NULL, unlang_parallel_child_done, unlang_parallel_child_signal, + ~FR_SIGNAL_DETACH, UNLANG_TOP_FRAME, &state->children[i]) < 0) goto error; child_frame = frame_current(child); @@ -420,7 +419,7 @@ static unlang_action_t unlang_parallel_process(rlm_rcode_t *p_result, request_t * */ static void unlang_parallel_signal(UNUSED request_t *request, - unlang_stack_frame_t *frame, fr_state_signal_t action) + unlang_stack_frame_t *frame, fr_signal_t action) { unlang_parallel_state_t *state = talloc_get_type_abort(frame->state, unlang_parallel_state_t); int i; diff --git a/src/lib/unlang/subrequest.c b/src/lib/unlang/subrequest.c index 276abab71d8..bc1a93851ce 100644 --- a/src/lib/unlang/subrequest.c +++ b/src/lib/unlang/subrequest.c @@ -36,7 +36,7 @@ RCSID("$Id$") * */ static void unlang_subrequest_parent_signal(UNUSED request_t *request, unlang_stack_frame_t *frame, - fr_state_signal_t action) + fr_signal_t action) { unlang_frame_state_subrequest_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_subrequest_t); request_t *child = talloc_get_type_abort(state->child, request_t); diff --git a/src/lib/unlang/subrequest_child.c b/src/lib/unlang/subrequest_child.c index 2ae15804e53..b53f5fd2189 100644 --- a/src/lib/unlang/subrequest_child.c +++ b/src/lib/unlang/subrequest_child.c @@ -109,7 +109,7 @@ int unlang_subrequest_lifetime_set(request_t *request) * This processes any detach signals the child receives * The child doesn't actually do the detaching */ -static void unlang_subrequest_child_signal(request_t *request, fr_state_signal_t action, UNUSED void *uctx) +static void unlang_subrequest_child_signal(request_t *request, fr_signal_t action, UNUSED void *uctx) { unlang_frame_state_subrequest_t *state; @@ -147,7 +147,7 @@ static void unlang_subrequest_child_signal(request_t *request, fr_state_signal_t * Indicate to the parent there's no longer a child */ state->child = NULL; - + /* * Tell the parent to resume */ @@ -206,7 +206,10 @@ int unlang_subrequest_child_push_resume(request_t *child, unlang_frame_state_sub */ if (unlang_function_push(child, NULL, unlang_subrequest_child_done, - unlang_subrequest_child_signal, UNLANG_TOP_FRAME, state) < 0) return -1; + unlang_subrequest_child_signal, + ~(FR_SIGNAL_DETACH | FR_SIGNAL_CANCEL), + UNLANG_TOP_FRAME, + state) < 0) return -1; return_point_set(frame_current(child)); /* Stop return going through the resumption frame */ diff --git a/src/lib/unlang/tmpl.c b/src/lib/unlang/tmpl.c index 7a3f9f2a9c2..12af6586a9c 100644 --- a/src/lib/unlang/tmpl.c +++ b/src/lib/unlang/tmpl.c @@ -47,7 +47,7 @@ RCSID("$Id$") * @param[in] frame being signalled. * @param[in] action to signal. */ -static void unlang_tmpl_signal(request_t *request, unlang_stack_frame_t *frame, fr_state_signal_t action) +static void unlang_tmpl_signal(request_t *request, unlang_stack_frame_t *frame, fr_signal_t action) { unlang_frame_state_tmpl_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_tmpl_t); diff --git a/src/lib/unlang/tmpl.h b/src/lib/unlang/tmpl.h index 230f8ce52cf..f9ce7ac9598 100644 --- a/src/lib/unlang/tmpl.h +++ b/src/lib/unlang/tmpl.h @@ -83,7 +83,7 @@ typedef struct { }, \ } -/** A callback when the request gets a fr_state_signal_t. +/** A callback when the request gets a fr_signal_t. * * A module may call unlang_yeild(), but still need to do something on FR_SIGNAL_DUP. If so, it's * set here. @@ -94,7 +94,7 @@ typedef struct { * @param[in] request The current request. * @param[in] action which is signalling the request. */ -typedef void (*fr_unlang_tmpl_signal_t)(request_t *request, void *rctx, fr_state_signal_t action); +typedef void (*fr_unlang_tmpl_signal_t)(request_t *request, void *rctx, fr_signal_t action); /** A callback for when the request is resumed. * diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 35bbc5062d3..d4c2f4727c6 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -186,7 +186,7 @@ typedef unlang_action_t (*unlang_process_t)(rlm_rcode_t *p_result, request_t *re * @param[in] action We're being signalled with. */ typedef void (*unlang_signal_t)(request_t *request, - unlang_stack_frame_t *frame, fr_state_signal_t action); + unlang_stack_frame_t *frame, fr_signal_t action); /** Custom callback for dumping information about frame state * @@ -253,7 +253,7 @@ void unlang_frame_perf_cleanup(unlang_stack_frame_t *frame); #define unlang_frame_perf_cleanup(_x) #endif -void unlang_frame_signal(request_t *request, fr_state_signal_t action, int limit); +void unlang_frame_signal(request_t *request, fr_signal_t action, int limit); typedef struct { request_t *request; diff --git a/src/lib/unlang/xlat.c b/src/lib/unlang/xlat.c index cfe9ee120d1..91720793a07 100644 --- a/src/lib/unlang/xlat.c +++ b/src/lib/unlang/xlat.c @@ -54,6 +54,7 @@ typedef struct { ///< previously took. xlat_func_t resume; //!< called on resume xlat_func_signal_t signal; //!< called on signal + fr_signal_t sigmask; //!< Signals to block void *rctx; //!< for resume / signal bool *success; //!< If set, where to record the result @@ -431,7 +432,7 @@ static unlang_action_t unlang_xlat(rlm_rcode_t *p_result, request_t *request, un * @param[in] frame The current stack frame. * @param[in] action What the request should do (the type of signal). */ -static void unlang_xlat_signal(request_t *request, unlang_stack_frame_t *frame, fr_state_signal_t action) +static void unlang_xlat_signal(request_t *request, unlang_stack_frame_t *frame, fr_signal_t action) { unlang_frame_state_xlat_t *state = talloc_get_type_abort(frame->state, unlang_frame_state_xlat_t); @@ -442,7 +443,7 @@ static void unlang_xlat_signal(request_t *request, unlang_stack_frame_t *frame, TALLOC_FREE(state->event_ctx); } - if (!state->signal) return; + if (!state->signal || (state->sigmask & action)) return; xlat_signal(state->signal, state->exp, request, state->rctx, action); } @@ -535,11 +536,12 @@ static unlang_action_t unlang_xlat_resume(rlm_rcode_t *p_result, request_t *requ * @param[in] request The current request. * @param[in] resume Called on unlang_interpret_mark_runnable(). * @param[in] signal Called on unlang_action(). + * @param[in] sigmask Signals to block. * @param[in] rctx to pass to the callbacks. * @return always returns XLAT_ACTION_YIELD */ xlat_action_t unlang_xlat_yield(request_t *request, - xlat_func_t resume, xlat_func_signal_t signal, + xlat_func_t resume, xlat_func_signal_t signal, fr_signal_t sigmask, void *rctx) { unlang_stack_t *stack = request->stack; @@ -553,6 +555,7 @@ xlat_action_t unlang_xlat_yield(request_t *request, */ state->resume = resume; state->signal = signal; + state->sigmask = sigmask; state->rctx = rctx; return XLAT_ACTION_YIELD; diff --git a/src/lib/unlang/xlat.h b/src/lib/unlang/xlat.h index 7b15c691c99..28a564e6eff 100644 --- a/src/lib/unlang/xlat.h +++ b/src/lib/unlang/xlat.h @@ -201,7 +201,7 @@ typedef void (*fr_unlang_xlat_fd_event_t)(xlat_ctx_t const *xctx, request_t *req typedef xlat_action_t (*xlat_func_t)(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in); -/** A callback when the request gets a fr_state_signal_t. +/** A callback when the request gets a fr_signal_t. * * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * @@ -209,7 +209,7 @@ typedef xlat_action_t (*xlat_func_t)(TALLOC_CTX *ctx, fr_dcursor_t *out, * @param[in] xctx xlat calling ctx. Contains all instance data. * @param[in] action which is signalling the request. */ -typedef void (*xlat_func_signal_t)(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action); +typedef void (*xlat_func_signal_t)(xlat_ctx_t const *xctx, request_t *request, fr_signal_t action); /** Allocate new instance data for an xlat instance * @@ -484,7 +484,7 @@ int unlang_xlat_push(TALLOC_CTX *ctx, bool *p_success, fr_value_box_list_t *out CC_HINT(warn_unused_result); xlat_action_t unlang_xlat_yield(request_t *request, - xlat_func_t callback, xlat_func_signal_t signal, + xlat_func_t callback, xlat_func_signal_t signal, fr_signal_t sigmask, void *rctx); /* diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index ff048675e40..4f24950ab5f 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -934,7 +934,7 @@ static xlat_action_t xlat_func_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, } - if (unlang_xlat_yield(request, xlat_eval_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto error; + if (unlang_xlat_yield(request, xlat_eval_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto error; if (unlang_xlat_push(ctx, &rctx->last_success, (fr_value_box_list_t *)out->dlist, request, rctx->ex, UNLANG_SUB_FRAME) < 0) goto error; @@ -1013,7 +1013,7 @@ static xlat_action_t xlat_func_expr(TALLOC_CTX *ctx, fr_dcursor_t *out, } - if (unlang_xlat_yield(request, xlat_eval_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto error; + if (unlang_xlat_yield(request, xlat_eval_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto error; if (unlang_xlat_push(ctx, &rctx->last_success, (fr_value_box_list_t *)out->dlist, request, rctx->ex, UNLANG_SUB_FRAME) < 0) goto error; diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index 7ffd3a86ccb..14a5b22f91f 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -773,7 +773,7 @@ static xlat_action_t xlat_exec_resume(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, * @param[in] action What the request should do (the type of signal). */ void xlat_signal(xlat_func_signal_t signal, xlat_exp_t const *exp, - request_t *request, void *rctx, fr_state_signal_t action) + request_t *request, void *rctx, fr_signal_t action) { xlat_thread_inst_t *t = xlat_thread_instance_find(exp); @@ -1184,7 +1184,7 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_head_ xlat_debug_log_expansion(request, node, NULL, __LINE__); - if (unlang_xlat_yield(request, xlat_exec_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto fail; + if (unlang_xlat_yield(request, xlat_exec_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto fail; if (unlang_tmpl_push(ctx, &rctx->list, request, node->vpt, TMPL_ARGS_EXEC(NULL, fr_time_delta_from_sec(EXEC_TIMEOUT), diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index e5d1ecdfdf0..4b8b0531a5f 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -795,7 +795,7 @@ static xlat_action_t xlat_regex_op(TALLOC_CTX *ctx, fr_dcursor_t *out, MEM(rctx = talloc_zero(unlang_interpret_frame_talloc_ctx(request), xlat_regex_rctx_t)); fr_value_box_list_init(&rctx->list); - if (unlang_xlat_yield(request, xlat_regex_resume, NULL, rctx) != XLAT_ACTION_YIELD) { + if (unlang_xlat_yield(request, xlat_regex_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) { fail: talloc_free(rctx); return XLAT_ACTION_FAIL; @@ -1170,7 +1170,7 @@ static xlat_action_t xlat_logical_process_arg(UNUSED TALLOC_CTX *ctx, UNUSED fr_ /* * Push the xlat onto the stack for expansion. */ - if (unlang_xlat_yield(request, xlat_logical_resume, NULL, rctx) != XLAT_ACTION_YIELD) { + if (unlang_xlat_yield(request, xlat_logical_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) { fail: talloc_free(rctx->box); talloc_free(rctx); @@ -1612,7 +1612,7 @@ static xlat_action_t xlat_func_exists(TALLOC_CTX *ctx, fr_dcursor_t *out, MEM(rctx = talloc_zero(unlang_interpret_frame_talloc_ctx(request), xlat_exists_rctx_t)); fr_value_box_list_init(&rctx->list); - if (unlang_xlat_yield(request, xlat_exists_resume, NULL, rctx) != XLAT_ACTION_YIELD) { + if (unlang_xlat_yield(request, xlat_exists_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) { fail: talloc_free(rctx); return XLAT_ACTION_FAIL; diff --git a/src/lib/unlang/xlat_priv.h b/src/lib/unlang/xlat_priv.h index 483626a33cc..053cf804b66 100644 --- a/src/lib/unlang/xlat_priv.h +++ b/src/lib/unlang/xlat_priv.h @@ -329,7 +329,7 @@ extern fr_dict_attr_t const *attr_module_return_code; extern fr_dict_attr_t const *attr_cast_base; void xlat_signal(xlat_func_signal_t signal, xlat_exp_t const *exp, - request_t *request, void *rctx, fr_state_signal_t action); + request_t *request, void *rctx, fr_signal_t action); xlat_action_t xlat_frame_eval_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_head_t const **child, diff --git a/src/lib/unlang/xlat_redundant.c b/src/lib/unlang/xlat_redundant.c index da1bfd5b727..94661719b4e 100644 --- a/src/lib/unlang/xlat_redundant.c +++ b/src/lib/unlang/xlat_redundant.c @@ -106,7 +106,7 @@ static xlat_action_t xlat_redundant_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, goto done; } - if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto error; + if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto error; /* * Push the next child... @@ -152,7 +152,7 @@ static xlat_action_t xlat_redundant(TALLOC_CTX *ctx, fr_dcursor_t *out, */ case XLAT_REDUNDANT: rctx->current = rctx->first = xri->ex; /* First element first */ - if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, rctx) != XLAT_ACTION_YIELD) { + if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) { error: talloc_free(rctx); return XLAT_ACTION_FAIL; @@ -164,7 +164,7 @@ static xlat_action_t xlat_redundant(TALLOC_CTX *ctx, fr_dcursor_t *out, */ case XLAT_LOAD_BALANCE: rctx->first = &xri->ex[(size_t)fr_rand() & (talloc_array_length(xri->ex) - 1)]; /* Random start */ - if (unlang_xlat_yield(request, xlat_load_balance_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto error; + if (unlang_xlat_yield(request, xlat_load_balance_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto error; break; /* @@ -173,7 +173,7 @@ static xlat_action_t xlat_redundant(TALLOC_CTX *ctx, fr_dcursor_t *out, */ case XLAT_REDUNDANT_LOAD_BALANCE: rctx->first = &xri->ex[(size_t)fr_rand() & (talloc_array_length(xri->ex) - 1)]; /* Random start */ - if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, rctx) != XLAT_ACTION_YIELD) goto error; + if (unlang_xlat_yield(request, xlat_redundant_resume, NULL, 0, rctx) != XLAT_ACTION_YIELD) goto error; break; default: diff --git a/src/modules/rlm_delay/rlm_delay.c b/src/modules/rlm_delay/rlm_delay.c index d735fa66657..3b52204e712 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -128,10 +128,8 @@ static unlang_action_t mod_delay_return(rlm_rcode_t *p_result, module_ctx_t cons RETURN_MODULE_OK; } -static void mod_delay_cancel(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_delay_cancel(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Cancelling delay"); (void) unlang_module_timeout_delete(request, mctx->rctx); @@ -175,7 +173,7 @@ static unlang_action_t CC_HINT(nonnull) mod_delay(rlm_rcode_t *p_result, module_ RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_delay_return, mod_delay_cancel, yielded_at); + return unlang_module_yield(request, mod_delay_return, mod_delay_cancel, ~FR_SIGNAL_CANCEL, yielded_at); } static xlat_action_t xlat_delay_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, @@ -199,10 +197,8 @@ static xlat_action_t xlat_delay_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, return XLAT_ACTION_DONE; } -static void xlat_delay_cancel(UNUSED xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action) +static void xlat_delay_cancel(UNUSED xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action) { - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Cancelling delay"); } @@ -261,7 +257,7 @@ yield: return XLAT_ACTION_FAIL; } - return unlang_xlat_yield(request, xlat_delay_resume, xlat_delay_cancel, yielded_at); + return unlang_xlat_yield(request, xlat_delay_resume, xlat_delay_cancel, ~FR_SIGNAL_CANCEL, yielded_at); } static int mod_bootstrap(module_inst_ctx_t const *mctx) diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index bf8cd7712f1..162464401db 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -311,7 +311,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul RETURN_MODULE_FAIL; } - return unlang_module_yield(request, dhcpv4_resume, NULL, d); + return unlang_module_yield(request, dhcpv4_resume, NULL, 0, d); } extern module_rlm_t rlm_dhcpv4; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 0997b4f71e7..1caf7005d92 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -387,12 +387,10 @@ static eap_type_t eap_process_nak(module_ctx_t const *mctx, request_t *request, * @param[in] request The current request. * @param[in] action to perform. */ -static void mod_authenticate_cancel(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_authenticate_cancel(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { eap_session_t *eap_session; - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Request cancelled - Destroying EAP-Session"); eap_session = talloc_get_type_abort(mctx->rctx, eap_session_t); @@ -791,7 +789,7 @@ static unlang_action_t eap_method_select(rlm_rcode_t *p_result, module_ctx_t con * done (after the subrequest frame in the * parent gets popped). */ - (void)unlang_module_yield(request, mod_authenticate_result_async, mod_authenticate_cancel, eap_session); + (void)unlang_module_yield(request, mod_authenticate_result_async, mod_authenticate_cancel, ~FR_SIGNAL_CANCEL, eap_session); /* * This sets up a subrequest frame in the parent diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c index 6b3af638cbb..76e070db68a 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c @@ -511,7 +511,7 @@ static unlang_action_t mod_handshake_process(UNUSED rlm_rcode_t *p_result, UNUSE /* * Setup the resumption frame to process the result */ - (void)unlang_module_yield(request, mod_handshake_resume, NULL, eap_session); + (void)unlang_module_yield(request, mod_handshake_resume, NULL, 0, eap_session); /* * Process TLS layer until done. diff --git a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c index 76b585489a2..133ad114f48 100644 --- a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c +++ b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c @@ -171,7 +171,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc RETURN_MODULE_FAIL; } - return unlang_module_yield_to_section(p_result, request, unlang, RLM_MODULE_FAIL, gtc_resume, NULL, eap_session); + return unlang_module_yield_to_section(p_result, request, unlang, RLM_MODULE_FAIL, gtc_resume, NULL, 0, eap_session); } diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c index 2d45a01a500..447868ffb46 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -746,7 +746,7 @@ packet_ready: RETURN_MODULE_FAIL; } - return unlang_module_yield_to_section(p_result, request, unlang, RLM_MODULE_FAIL, mschap_resume, NULL, eap_session); + return unlang_module_yield_to_section(p_result, request, unlang, RLM_MODULE_FAIL, mschap_resume, NULL, 0, eap_session); } /* diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c index 649d0bb716b..d8378816d8a 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c @@ -269,7 +269,7 @@ static unlang_action_t mod_handshake_process(UNUSED rlm_rcode_t *p_result, UNUSE /* * Setup the resumption frame to process the result */ - (void)unlang_module_yield(request, mod_handshake_resume, NULL, eap_session); + (void)unlang_module_yield(request, mod_handshake_resume, NULL, 0, eap_session); /* * Process TLS layer until done. diff --git a/src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c b/src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c index 124297c5047..452dbd1b1f6 100644 --- a/src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c +++ b/src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c @@ -109,7 +109,7 @@ static unlang_action_t mod_handshake_resume(rlm_rcode_t *p_result, module_ctx_t * Result is always OK, even if we fail to persist the * session data. */ - unlang_module_yield(request, mod_handshake_done, NULL, mctx->rctx); + unlang_module_yield(request, mod_handshake_done, NULL, 0, mctx->rctx); /* * Write the session to the session cache * @@ -173,7 +173,7 @@ static unlang_action_t mod_handshake_process(UNUSED rlm_rcode_t *p_result, UNUSE /* * Setup the resumption frame to process the result */ - (void)unlang_module_yield(request, mod_handshake_resume, NULL, eap_session); + (void)unlang_module_yield(request, mod_handshake_resume, NULL, 0, eap_session); /* * Process TLS layer until done. diff --git a/src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c b/src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c index 39f00deb5b2..3b61352e565 100644 --- a/src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c +++ b/src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c @@ -272,7 +272,7 @@ static unlang_action_t mod_handshake_process(UNUSED rlm_rcode_t *p_result, UNUSE /* * Setup the resumption frame to process the result */ - (void)unlang_module_yield(request, mod_handshake_resume, NULL, eap_session); + (void)unlang_module_yield(request, mod_handshake_resume, NULL, 0, eap_session); /* * Process TLS layer until done. diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index a956a9aa624..31e4a6973bc 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -147,7 +147,7 @@ static xlat_action_t exec_xlat(TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, return XLAT_ACTION_FAIL; } - return unlang_xlat_yield(request, exec_xlat_resume, NULL, exec); + return unlang_xlat_yield(request, exec_xlat_resume, NULL, 0, exec); } /* @@ -444,7 +444,7 @@ static unlang_action_t CC_HINT(nonnull) mod_exec_dispatch(rlm_rcode_t *p_result, fr_value_box_list_init(box); return unlang_module_yield_to_xlat(request, NULL, box, request, tmpl_xlat(inst->tmpl), - mod_exec_nowait_resume, NULL, box); + mod_exec_nowait_resume, NULL, 0, box); } /* @@ -469,7 +469,7 @@ static unlang_action_t CC_HINT(nonnull) mod_exec_dispatch(rlm_rcode_t *p_result, request, inst->tmpl, TMPL_ARGS_EXEC(env_pairs, inst->timeout, true, &m->status), mod_exec_wait_resume, - NULL, &m->box); + NULL, 0, &m->box); } diff --git a/src/modules/rlm_icmp/rlm_icmp.c b/src/modules/rlm_icmp/rlm_icmp.c index d6c1a099b99..568ced49722 100644 --- a/src/modules/rlm_icmp/rlm_icmp.c +++ b/src/modules/rlm_icmp/rlm_icmp.c @@ -129,13 +129,11 @@ static xlat_action_t xlat_icmp_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, return XLAT_ACTION_DONE; } -static void xlat_icmp_cancel(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action) +static void xlat_icmp_cancel(xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action) { rlm_icmp_echo_t *echo = talloc_get_type_abort(xctx->rctx, rlm_icmp_echo_t); rlm_icmp_thread_t *t = talloc_get_type_abort(xctx->mctx->thread, rlm_icmp_thread_t); - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Cancelling ICMP request for %pV (counter=%d)", echo->ip, echo->counter); (void) fr_rb_delete(t->tree, echo); @@ -262,7 +260,7 @@ static xlat_action_t xlat_icmp(TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, return XLAT_ACTION_FAIL; } - return unlang_xlat_yield(request, xlat_icmp_resume, xlat_icmp_cancel, echo); + return unlang_xlat_yield(request, xlat_icmp_resume, xlat_icmp_cancel, ~FR_SIGNAL_CANCEL, echo); } static int8_t echo_cmp(void const *one, void const *two) diff --git a/src/modules/rlm_imap/rlm_imap.c b/src/modules/rlm_imap/rlm_imap.c index d032ef61e66..10f7fb5662a 100644 --- a/src/modules/rlm_imap/rlm_imap.c +++ b/src/modules/rlm_imap/rlm_imap.c @@ -80,14 +80,12 @@ static const CONF_PARSER module_config[] = { CONF_PARSER_TERMINATOR }; -static void imap_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void imap_io_module_signal(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { fr_curl_io_request_t *randle = talloc_get_type_abort(mctx->rctx, fr_curl_io_request_t); rlm_imap_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_imap_thread_t); CURLMcode ret; - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Forcefully cancelling pending IMAP request"); ret = curl_multi_remove_handle(t->mhandle->mandle, randle->candle); /* Gracefully terminate the request */ @@ -192,7 +190,7 @@ static unlang_action_t CC_HINT(nonnull(1,2)) mod_authenticate(rlm_rcode_t *p_res RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_authenticate_resume, imap_io_module_signal, randle); + return unlang_module_yield(request, mod_authenticate_resume, imap_io_module_signal, ~FR_SIGNAL_CANCEL, randle); } /** Clean up CURL handle on freeing diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 89c07ad1101..33336250b67 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -357,12 +357,10 @@ static xlat_action_t ldap_xlat_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, /** Callback for signalling async ldap query * */ -static void ldap_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action) +static void ldap_xlat_signal(xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action) { fr_ldap_query_t *query = talloc_get_type_abort(xctx->rctx, fr_ldap_query_t); - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Forcefully cancelling pending LDAP query"); fr_trunk_request_signal_cancel(query->treq); @@ -496,7 +494,7 @@ static xlat_action_t ldap_xlat(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, goto error; } - return unlang_xlat_yield(request, ldap_xlat_resume, ldap_xlat_signal, query); + return unlang_xlat_yield(request, ldap_xlat_resume, ldap_xlat_signal, ~FR_SIGNAL_CANCEL, query); } /* diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 846b291cd59..e1801a2dfda 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -330,7 +330,7 @@ static int status_check_update_parse(TALLOC_CTX *ctx, void *out, UNUSED void *pa } -static void mod_radius_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_radius_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action) { rlm_radius_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_radius_t); rlm_radius_io_t const *io = (rlm_radius_io_t const *)inst->io_submodule->module; /* Public symbol exported by the module */ @@ -449,7 +449,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul RETURN_MODULE_RCODE(rcode); } - return unlang_module_yield(request, inst->io->resume, mod_radius_signal, rctx); + return unlang_module_yield(request, inst->io->resume, mod_radius_signal, 0, rctx); } static int mod_bootstrap(module_inst_ctx_t const *mctx) diff --git a/src/modules/rlm_radius/rlm_radius_udp.c b/src/modules/rlm_radius/rlm_radius_udp.c index dcee692ed44..5d6bd6e1f78 100644 --- a/src/modules/rlm_radius/rlm_radius_udp.c +++ b/src/modules/rlm_radius/rlm_radius_udp.c @@ -2620,7 +2620,7 @@ static unlang_action_t mod_resume(rlm_rcode_t *p_result, module_ctx_t const *mct RETURN_MODULE_RCODE(rcode); } -static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_state_signal_t action) +static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_signal_t action) { udp_thread_t *t = talloc_get_type_abort(mctx->thread, udp_thread_t); udp_result_t *r = talloc_get_type_abort(mctx->rctx, udp_result_t); diff --git a/src/modules/rlm_rest/io.c b/src/modules/rlm_rest/io.c index 9fcc0f57935..ee781ca56d8 100644 --- a/src/modules/rlm_rest/io.c +++ b/src/modules/rlm_rest/io.c @@ -30,14 +30,12 @@ * If we're signalled that the request has been cancelled (FR_SIGNAL_CANCEL). * Cleanup any pending state and release the connection handle back into the pool. */ -void rest_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +void rest_io_module_signal(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { fr_curl_io_request_t *randle = talloc_get_type_abort(mctx->rctx, fr_curl_io_request_t); rlm_rest_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_rest_thread_t); CURLMcode ret; - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Forcefully cancelling pending REST request"); ret = curl_multi_remove_handle(t->mhandle->mandle, randle->candle); /* Gracefully terminate the request */ @@ -55,7 +53,7 @@ void rest_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_stat * If we're signalled that the request has been cancelled (FR_SIGNAL_CANCEL). * Cleanup any pending state and release the connection handle back into the pool. */ -void rest_io_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action) +void rest_io_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_signal_t action) { rlm_rest_t *mod_inst = talloc_get_type_abort(xctx->mctx->inst->data, rlm_rest_t); rlm_rest_thread_t *t = talloc_get_type_abort(xctx->mctx->thread, rlm_rest_thread_t); @@ -63,6 +61,10 @@ void rest_io_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_state_si rlm_rest_xlat_rctx_t *our_rctx = talloc_get_type_abort(xctx->rctx, rlm_rest_xlat_rctx_t); fr_curl_io_request_t *randle = talloc_get_type_abort(our_rctx->handle, fr_curl_io_request_t); - rest_io_module_signal(MODULE_CTX(dl_module_instance_by_data(mod_inst), t, xctx->mctx->env_data, randle), - request, action); + rest_io_module_signal(MODULE_CTX(dl_module_instance_by_data(mod_inst), + t, + xctx->mctx->env_data, + randle), + request, + action); } diff --git a/src/modules/rlm_rest/rest.h b/src/modules/rlm_rest/rest.h index 9533d05bf0e..75777376e3c 100644 --- a/src/modules/rlm_rest/rest.h +++ b/src/modules/rlm_rest/rest.h @@ -312,5 +312,5 @@ ssize_t rest_uri_host_unescape(char **out, UNUSED rlm_rest_t const *mod_inst, re /* * Async IO helpers */ -void rest_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action); -void rest_io_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action); +void rest_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action); +void rest_io_xlat_signal(xlat_ctx_t const *xctx, request_t *request, fr_signal_t action); diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index 1df7adca6f2..2e4ec13610e 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -533,7 +533,7 @@ static xlat_action_t rest_xlat(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, ret = fr_curl_io_request_enqueue(t->mhandle, request, randle); if (ret < 0) goto error; - return unlang_xlat_yield(request, rest_xlat_resume, rest_io_xlat_signal, rctx); + return unlang_xlat_yield(request, rest_xlat_resume, rest_io_xlat_signal, ~FR_SIGNAL_CANCEL, rctx); } static unlang_action_t mod_authorize_result(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) @@ -643,7 +643,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_authorize_result, rest_io_module_signal, handle); + return unlang_module_yield(request, mod_authorize_result, rest_io_module_signal, ~FR_SIGNAL_CANCEL, handle); } static unlang_action_t mod_authenticate_result(rlm_rcode_t *p_result, @@ -789,7 +789,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authenticate(rlm_rcode_t *p_result, RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_authenticate_result, rest_io_module_signal, handle); + return unlang_module_yield(request, mod_authenticate_result, rest_io_module_signal, ~FR_SIGNAL_CANCEL, handle); } static unlang_action_t mod_accounting_result(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) @@ -864,7 +864,7 @@ static unlang_action_t CC_HINT(nonnull) mod_accounting(rlm_rcode_t *p_result, mo RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_accounting_result, rest_io_module_signal, handle); + return unlang_module_yield(request, mod_accounting_result, rest_io_module_signal, ~FR_SIGNAL_CANCEL, handle); } static unlang_action_t mod_post_auth_result(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) @@ -939,7 +939,7 @@ static unlang_action_t CC_HINT(nonnull) mod_post_auth(rlm_rcode_t *p_result, mod RETURN_MODULE_FAIL; } - return unlang_module_yield(request, mod_post_auth_result, rest_io_module_signal, handle); + return unlang_module_yield(request, mod_post_auth_result, rest_io_module_signal, ~FR_SIGNAL_CANCEL, handle); } static int parse_sub_section(rlm_rest_t *inst, CONF_SECTION *parent, CONF_PARSER const *config_items, diff --git a/src/modules/rlm_sigtran/client.c b/src/modules/rlm_sigtran/client.c index e22c9627a6a..1699159238e 100644 --- a/src/modules/rlm_sigtran/client.c +++ b/src/modules/rlm_sigtran/client.c @@ -269,15 +269,10 @@ int sigtran_client_link_down(sigtran_conn_t const **conn) return 0; } -static void sigtran_client_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_state_signal_t action) +static void sigtran_client_signal(module_ctx_t const *mctx, UNUSED request_t *request, UNUSED fr_signal_t action) { sigtran_transaction_t *txn = talloc_get_type_abort(mctx->rctx, sigtran_transaction_t); - /* - * Ignore DUP signals, along with all others. - */ - if (action != FR_SIGNAL_CANCEL) return; - txn->ctx.defunct = true; /* Mark the transaction up as needing to be freed */ txn->ctx.request = NULL; /* remove the link to the (now dead) request */ } @@ -475,5 +470,5 @@ unlang_action_t sigtran_client_map_send_auth_info(rlm_rcode_t *p_result, rlm_sig goto error; } - return unlang_module_yield(request, sigtran_client_map_resume, sigtran_client_signal, txn); + return unlang_module_yield(request, sigtran_client_map_resume, sigtran_client_signal, ~FR_SIGNAL_CANCEL, txn); } diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index 52eb1565734..621eaf7e9e1 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -760,14 +760,12 @@ static int attachments_source(fr_mail_ctx_t *uctx, curl_mime *mime, rlm_smtp_t c return attachments_set; } -static void smtp_io_module_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void smtp_io_module_signal(module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) { fr_curl_io_request_t *randle = talloc_get_type_abort(mctx->rctx, fr_curl_io_request_t); rlm_smtp_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_smtp_thread_t); CURLMcode ret; - if (action != FR_SIGNAL_CANCEL) return; - RDEBUG2("Forcefully cancelling pending SMTP request"); ret = curl_multi_remove_handle(t->mhandle->mandle, randle->candle); /* Gracefully terminate the request */ @@ -944,7 +942,7 @@ skip_auth: if (fr_curl_io_request_enqueue(t->mhandle, request, randle)) RETURN_MODULE_INVALID; - return unlang_module_yield(request, smtp_io_module_resume, smtp_io_module_signal, randle); + return unlang_module_yield(request, smtp_io_module_resume, smtp_io_module_signal, ~FR_SIGNAL_CANCEL, randle); } /* @@ -991,7 +989,7 @@ static unlang_action_t CC_HINT(nonnull(1,2)) mod_authenticate(rlm_rcode_t *p_res if (fr_curl_io_request_enqueue(t->mhandle, request, randle)) RETURN_MODULE_INVALID; - return unlang_module_yield(request, smtp_io_module_resume, smtp_io_module_signal, randle); + return unlang_module_yield(request, smtp_io_module_resume, smtp_io_module_signal, ~FR_SIGNAL_CANCEL, randle); } static int mod_bootstrap(module_inst_ctx_t const *mctx) diff --git a/src/modules/rlm_tacacs/rlm_tacacs.c b/src/modules/rlm_tacacs/rlm_tacacs.c index 83bb3b3f682..520efff2ca3 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs.c +++ b/src/modules/rlm_tacacs/rlm_tacacs.c @@ -128,7 +128,7 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, return 0; } -static void mod_tacacs_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_tacacs_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action) { rlm_tacacs_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_tacacs_t); rlm_tacacs_io_t const *io = (rlm_tacacs_io_t const *)inst->io_submodule->module; /* Public symbol exported by the module */ @@ -182,7 +182,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul RETURN_MODULE_RCODE(rcode); } - return unlang_module_yield(request, inst->io->resume, mod_tacacs_signal, rctx); + return unlang_module_yield(request, inst->io->resume, mod_tacacs_signal, 0, rctx); } static int mod_bootstrap(module_inst_ctx_t const *mctx) diff --git a/src/modules/rlm_tacacs/rlm_tacacs_tcp.c b/src/modules/rlm_tacacs/rlm_tacacs_tcp.c index 8e4877dfb7f..2b0d14ff412 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs_tcp.c +++ b/src/modules/rlm_tacacs/rlm_tacacs_tcp.c @@ -1302,7 +1302,7 @@ static unlang_action_t mod_resume(rlm_rcode_t *p_result, module_ctx_t const *mct RETURN_MODULE_RCODE(rcode); } -static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_state_signal_t action) +static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_signal_t action) { // udp_thread_t *t = talloc_get_type_abort(mctx->thread, udp_thread_t); udp_result_t *r = talloc_get_type_abort(mctx->rctx, udp_result_t); diff --git a/src/modules/rlm_test/rlm_test.c b/src/modules/rlm_test/rlm_test.c index 3dd12809efa..d26cb8e0318 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -283,7 +283,7 @@ static unlang_action_t CC_HINT(nonnull) mod_return(rlm_rcode_t *p_result, UNUSED RETURN_MODULE_OK; } -static void mod_retry_signal(module_ctx_t const *mctx, request_t *request, fr_state_signal_t action); +static void mod_retry_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action); /** Continue after marked runnable * @@ -302,7 +302,7 @@ static unlang_action_t mod_retry_resume_retry(UNUSED rlm_rcode_t *p_result, UNUS { RDEBUG("Test retry"); - return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, NULL); + return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, 0, NULL); } /** Continue after FR_SIGNAL_TIMEOUT @@ -315,7 +315,7 @@ static unlang_action_t mod_retry_resume_timeout(rlm_rcode_t *p_result, UNUSED mo RETURN_MODULE_OK; } -static void mod_retry_signal(UNUSED module_ctx_t const *mctx, request_t *request, fr_state_signal_t action) +static void mod_retry_signal(UNUSED module_ctx_t const *mctx, request_t *request, fr_signal_t action) { switch (action) { case FR_SIGNAL_RETRY: @@ -344,7 +344,7 @@ static void mod_retry_signal(UNUSED module_ctx_t const *mctx, request_t *request */ static unlang_action_t CC_HINT(nonnull) mod_retry(UNUSED rlm_rcode_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request) { - return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, NULL); + return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, 0, NULL); } diff --git a/src/modules/rlm_unbound/rlm_unbound.c b/src/modules/rlm_unbound/rlm_unbound.c index 319860a1e75..1085ea2030f 100644 --- a/src/modules/rlm_unbound/rlm_unbound.c +++ b/src/modules/rlm_unbound/rlm_unbound.c @@ -266,12 +266,10 @@ static void xlat_unbound_timeout(UNUSED fr_event_list_t *el, UNUSED fr_time_t no /* * Xlat signal callback if an unbound request needs cancelling */ -static void xlat_unbound_signal(xlat_ctx_t const *xctx, request_t *request, fr_state_signal_t action) +static void xlat_unbound_signal(xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action) { unbound_request_t *ur = talloc_get_type_abort(xctx->rctx, unbound_request_t); - if (action != FR_SIGNAL_CANCEL) return; - if (ur->ev) (void)fr_event_timer_delete(&ur->ev); RDEBUG2("Forcefully cancelling pending unbound request"); @@ -413,7 +411,7 @@ static xlat_action_t xlat_unbound(TALLOC_CTX *ctx, fr_dcursor_t *out, return XLAT_ACTION_FAIL; } - return unlang_xlat_yield(request, xlat_unbound_resume, xlat_unbound_signal, ur); + return unlang_xlat_yield(request, xlat_unbound_resume, xlat_unbound_signal, ~FR_SIGNAL_CANCEL, ur); } static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) diff --git a/src/process/dhcpv6/base.c b/src/process/dhcpv6/base.c index 18cf29769ec..a1dbcb9cb64 100644 --- a/src/process/dhcpv6/base.c +++ b/src/process/dhcpv6/base.c @@ -412,7 +412,7 @@ RECV(for_any_server) return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->resume, - NULL, rctx); + NULL, 0, rctx); } /** Validate a request/renew/decline/release @@ -447,7 +447,7 @@ RECV(for_this_server) return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->resume, - NULL, rctx); + NULL, 0, rctx); } /** Copy a reply pair back into the response @@ -673,7 +673,7 @@ RECV(from_relay) return unlang_module_yield_to_section(p_result, request, cs, state->rcode, state->resume, - NULL, rctx); + NULL, 0, rctx); } /** Restore our copy of the header fields into the reply list diff --git a/src/process/radius/base.c b/src/process/radius/base.c index 28ac69c42aa..bed75995296 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -480,7 +480,7 @@ RESUME(access_request) RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(p_result, request, cs, RLM_MODULE_NOOP, resume_auth_type, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME(auth_type) @@ -742,7 +742,7 @@ RESUME(accounting_request) */ return unlang_module_yield_to_section(p_result, request, cs, RLM_MODULE_NOOP, resume_acct_type, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } #if 0 diff --git a/src/process/tacacs/base.c b/src/process/tacacs/base.c index 75020633835..eae72768c48 100644 --- a/src/process/tacacs/base.c +++ b/src/process/tacacs/base.c @@ -672,7 +672,7 @@ RESUME(auth_start) RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(p_result, request, cs, RLM_MODULE_NOOP, resume_auth_type, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME(auth_type) @@ -1101,7 +1101,7 @@ RESUME(accounting_request) */ return unlang_module_yield_to_section(p_result, request, cs, RLM_MODULE_NOOP, resume_acct_type, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) diff --git a/src/process/ttls/base.c b/src/process/ttls/base.c index 6aaef35f503..df6f8c27832 100644 --- a/src/process/ttls/base.c +++ b/src/process/ttls/base.c @@ -422,7 +422,7 @@ RESUME(access_request) RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(p_result, request, cs, RLM_MODULE_NOOP, resume_auth_type, - NULL, mctx->rctx); + NULL, 0, mctx->rctx); } RESUME(auth_type)