]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add sigmask to xlat/module/func signal handler registration
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 30 Mar 2023 00:26:40 +0000 (18:26 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 30 Mar 2023 00:32:16 +0000 (18:32 -0600)
60 files changed:
src/lib/eap/tls.c
src/lib/eap_aka_sim/module.c
src/lib/eap_aka_sim/state_machine.c
src/lib/ldap/base.c
src/lib/ldap/bind.c
src/lib/server/process.h
src/lib/server/request.h
src/lib/server/signal.h
src/lib/server/trigger.c
src/lib/tls/session.c
src/lib/tls/virtual_server.c
src/lib/unlang/function.c
src/lib/unlang/function.h
src/lib/unlang/interpret.c
src/lib/unlang/interpret.h
src/lib/unlang/limit.c
src/lib/unlang/module.c
src/lib/unlang/module.h
src/lib/unlang/module_priv.h
src/lib/unlang/parallel.c
src/lib/unlang/subrequest.c
src/lib/unlang/subrequest_child.c
src/lib/unlang/tmpl.c
src/lib/unlang/tmpl.h
src/lib/unlang/unlang_priv.h
src/lib/unlang/xlat.c
src/lib/unlang/xlat.h
src/lib/unlang/xlat_builtin.c
src/lib/unlang/xlat_eval.c
src/lib/unlang/xlat_expr.c
src/lib/unlang/xlat_priv.h
src/lib/unlang/xlat_redundant.c
src/modules/rlm_delay/rlm_delay.c
src/modules/rlm_dhcpv4/rlm_dhcpv4.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c
src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c
src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c
src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_icmp/rlm_icmp.c
src/modules/rlm_imap/rlm_imap.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_radius/rlm_radius.c
src/modules/rlm_radius/rlm_radius_udp.c
src/modules/rlm_rest/io.c
src/modules/rlm_rest/rest.h
src/modules/rlm_rest/rlm_rest.c
src/modules/rlm_sigtran/client.c
src/modules/rlm_smtp/rlm_smtp.c
src/modules/rlm_tacacs/rlm_tacacs.c
src/modules/rlm_tacacs/rlm_tacacs_tcp.c
src/modules/rlm_test/rlm_test.c
src/modules/rlm_unbound/rlm_unbound.c
src/process/dhcpv6/base.c
src/process/radius/base.c
src/process/tacacs/base.c
src/process/ttls/base.c

index 436c3675c99e96476f1a51e022905335bfec2b71..749ef7c740d8055608646dbe2a1b918129f7112f 100644 (file)
@@ -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;
 
index f7bb8e3f98e049bd62bd89e9f2e7648ab637145f..0f7bb21b3698ba957fdc7cc8bdcd0154f7350182 100644 (file)
@@ -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);
index 55fb0cabc07357313702f50bc4a67ead18692b33..ceee377cd55b76b00701f416dc711b0ea678f30b 100644 (file)
@@ -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);
 }
 
index 17209ed9b0c00527249b7a58897a3c09cda4bc2d..8d8f2470cde9ae9c4a4eb8987dce174b8b29ea8f 100644 (file)
@@ -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;
 
index 729d92d18984f28583c571a48f1dccf89a9b79bc..5b36193816aca2afa6e58ac79649386eae0d410a 100644 (file)
@@ -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);
 }
index 997efb05de6d5aa0d595388e2110684b5212ba78..9be07e1138890b0bf05a436ec393f0d73fa246fa 100644 (file)
@@ -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));
index 9e925908a50085173145d20965065d30dc1dcb5a..65b6cb23ead38ca32cb76133a9e410ea2e666371 100644 (file)
@@ -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;
index bfc0dd2a8591dbbcc18135c7a0eed0971ec5c5e0..f108e7af2f3f99ad74f63dc6c6ff8bfbda320bce 100644 (file)
@@ -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
 }
index 8a71b2c9d7a2cbc1c7cb8ecf2e5b4adf11cb2287..57a09349fd3fa8420ff4ce96a4508bb20adf2800 100644 (file)
@@ -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) {
                /*
index c2b5096531ea4464ebd7835e014f598108a250a1..222a4731d708babfe1cfa1f539373e2a87014767 100644 (file)
@@ -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);
 }
index ca4bd7203bac590b765fb20e9f44fe297dbce304..82a9602d2fc9518b56ca029bfa12932e9c46609f 100644 (file)
@@ -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
index f51e76528d2c5cbf3567f8f9dcebe0755ee6d8c5..3161056893485bf0f96d99495866bbcf0a67a59d 100644 (file)
@@ -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;
 
index 797c25ee9a99df42b7d88718c8ee364bc664d92f..40aeb3b5fb1d8012097786558231ebc49882127d 100644 (file)
@@ -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);
 
index 9af403d6cd11fbce8eba27debb4b2ade6fea07ff..6dcd4a4437321c6f119bafc4cda50890b15a7c7c 100644 (file)
@@ -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));
index cf2be144fb7005eecdd8c38244a8e9e43b5e9a4b..558d96d846d5a8966319d01af77c43ac1eadaa48 100644 (file)
@@ -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);
 
index 058fb7f2666c08f1fffa026b980eb9bfb63b338c..aececa084d913979bbdfad6a2864ccc520eafb49 100644 (file)
@@ -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);
 
index 7f2752aa1561821e0a1b9c62ffca2d10f35187fd..e1355f0fb4c0de839c93e2e5d60e1d8384b4021c 100644 (file)
@@ -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;
 
index 64caa339fd2c0f7ace0005264d883599baf7d219..a4c6f14d22f1d70a34c16a7439f45c92f8301ae7 100644 (file)
@@ -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
 }
index 48e5fc06ea2839f922a752ed5e513abed9634344..1faf1f294bf62147b26079874945aec2803cf02b 100644 (file)
@@ -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.
 
        /** @} */
 
index 0524823974e827fb53e13a67aab346b244eff74b..f7c0077947978ac6cdcb6c9539991dbeb4b91468 100644 (file)
@@ -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;
index 276abab71d82317326231261cf102116c98e582d..bc1a93851ce38ba754e48e0480f4198306411ea1 100644 (file)
@@ -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);
index 2ae15804e5349895e878939a703103f7a58162df..b53f5fd21896d5095ef4251b836cd0717543595f 100644 (file)
@@ -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 */
 
index 7a3f9f2a9c24e4cd6fc9227197b3fddc17702831..12af6586a9c1d42cbd7021c7e7c474b713e285b2 100644 (file)
@@ -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);
index 230f8ce52cfa26562769be88288faeb3a932cfee..f9ce7ac95985e3d133fc19384637fb804b8965e7 100644 (file)
@@ -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.
  *
index 35bbc5062d34e1281d7271785136a8bd94de781c..d4c2f4727c6973d43892aee05abf1cf3aae7a401 100644 (file)
@@ -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;
index cfe9ee120d1f3174da30ef13358d90488048741f..91720793a0787cf2d426028b77ec0c612c790693 100644 (file)
@@ -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;
index 7b15c691c99a475d79a94e831b8dbae81e71727a..28a564e6eff24a3cfcbe7003c8fbbbafc7607f50 100644 (file)
@@ -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);
 
 /*
index ff048675e402205ec740896faadc9249c88de647..4f24950ab5fad637544f8e99b43926b2ef0b102c 100644 (file)
@@ -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;
index 7ffd3a86ccb0dc7adff7d5cba139f74f4bed216b..14a5b22f91f0fb4a2614bd5f71d06d1ca6f1547b 100644 (file)
@@ -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),
index e5d1ecdfdf0f9997932a37119aa33b4a0b6f138c..4b8b0531a5f0e5dc32e0366f64b2480f5e94eb24 100644 (file)
@@ -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;
index 483626a33cc7426e13b78c0477092c5b53d85de0..053cf804b66a5ddc936ff1dd000911eb94989175 100644 (file)
@@ -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,
index da1bfd5b727ab448d91058abd552a836577e41ca..94661719b4e27980600cb3ea003575fdd5241542 100644 (file)
@@ -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:
index d735fa66657dd8e73b92d5f4152b756f5976d469..3b52204e71274208ebac5beebcae7d016f52a19d 100644 (file)
@@ -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)
index bf8cd7712f10a586f5a6f84ecae67891f411b6c4..162464401dbb13b42c819ce6806bbd952406fcb3 100644 (file)
@@ -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;
index 0997b4f71e7dc8e10842d6b12977ae79df48f297..1caf7005d921d8de21ad595354cb113b78e7ce71 100644 (file)
@@ -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
index 6b3af638cbb7114adb17c0b56c7deb2e16f686b0..76e070db68ad6baacb5b923fcea51f6e69e475de 100644 (file)
@@ -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.
index 76b585489a2d6dc89ec58f0fba756d4182112e91..133ad114f48f62b0941b343cf905ab1c13d758a0 100644 (file)
@@ -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);
 }
 
 
index 2d45a01a50040c2c40909f352f3612dcfdb502e7..447868ffb4682aedc2d858673a208cac0f7ed85e 100644 (file)
@@ -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);
 }
 
 /*
index 649d0bb716be14cdd561fa8fab24b21856f1e3ec..d8378816d8af88975ccbe705797fda6e4dbf9781 100644 (file)
@@ -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.
index 124297c50479150479ec526d9579e2ff121806af..452dbd1b1f6bc6c92670990982627601d4726fcc 100644 (file)
@@ -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.
index 39f00deb5b2bedcd5bcbf477ce34f9d04d8c0783..3b61352e5655d4a4c7a72ed6b53b498fdeefe9ca 100644 (file)
@@ -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.
index a956a9aa62412ae98b48d155fa23fce8c193202d..31e4a6973bc36c6e192bd7507a761434c6503e44 100644 (file)
@@ -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);
 }
 
 
index d6c1a099b99ba6c058ef6511503410b6d4caab75..568ced497226901ee38dbada378409024135b538 100644 (file)
@@ -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)
index d032ef61e66e9c67960ec3a3e6182a305dc7c67e..10f7fb5662a16bcaa8255f80fb1d0430b5771513 100644 (file)
@@ -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
index 89c07ad1101a81a53788fa11b299ef0bf66c7392..33336250b67158e0f24bc0e48837c61edcad42cd 100644 (file)
@@ -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);
 }
 
 /*
index 846b291cd593fabbd5522966c7e7dcea4ec42db9..e1801a2dfda7e6321eb8774f779ad2770e879343 100644 (file)
@@ -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)
index dcee692ed443497b41f8d7a7a64496f4d0dcc59c..5d6bd6e1f78eda497bc680f7716b33364d1a7d7c 100644 (file)
@@ -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);
index 9fcc0f57935f5c2db906f923396ec20ebe92b4fe..ee781ca56d85b560c47cda52ef76426ad21382e8 100644 (file)
  * 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);
 }
index 9533d05bf0e714d91f639a6b55282455cd9a1fcf..75777376e3c469f68d5ef0a7b41530bd2365ca5f 100644 (file)
@@ -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);
index 1df7adca6f2ded678f62bc55cbe7e06abeb941a2..2e4ec13610e3cd5150ce07a3068df02c618d440c 100644 (file)
@@ -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,
index e22c9627a6a73a5a9883ec2de79e748d53159300..1699159238ecfd5f85d4531a67d227aa1b240384 100644 (file)
@@ -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);
 }
index 52eb156573459ddec80be66db663033305ff3535..621eaf7e9e106751ad9167ea64adaf2fc70e1928 100644 (file)
@@ -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)
index 83bb3b3f682ce2ffe869311b05e922feb774a53c..520efff2ca3953e4423d5c23698b85045ea3825b 100644 (file)
@@ -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)
index 8e4877dfb7fcbda7d0d8bba2ec70cf31042f68fe..2b0d14ff4127c1b0e133e874d00af4d011b45b82 100644 (file)
@@ -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);
index 3dd12809efab794a0db4f0825590e4ab501b9589..d26cb8e0318f46b86e4bf33a39ca2e34939aae93 100644 (file)
@@ -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);
 }
 
 
index 319860a1e7597deb8a1bbdfcd3da7dc2dbbeca37..1085ea2030f1982c26b4c1fa1695660f9135f8b9 100644 (file)
@@ -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)
index 18cf29769ec194ba357dbe935976ad921b46ab46..a1dbcb9cb64137f069c8673a28214622f7109325 100644 (file)
@@ -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
index 28ac69c42aa02499e49a575872205209743e0f4c..bed759952962b06e73ee7f76d5706ec6e631a88d 100644 (file)
@@ -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
index 75020633835756b63be1c4fed053efd88553c8a8..eae72768c48aa1ef5b98e88c51bc680d4020ec35 100644 (file)
@@ -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)
index 6aaef35f50349495822f9fd86ee1d713b2c0f6f5..df6f8c2783224f442a2d3d7eafd962162517af0f 100644 (file)
@@ -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)