]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
unlang_push_section should take a top_frame argument
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 30 Jan 2018 20:25:47 +0000 (13:25 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 30 Jan 2018 20:27:00 +0000 (13:27 -0700)
14 files changed:
src/include/unlang.h
src/main/unlang_interpret.c
src/modules/proto_detail/proto_detail_process.c
src/modules/proto_ldap_sync/proto_ldap_sync.c
src/modules/proto_radius/proto_radius_acct.c
src/modules/proto_radius/proto_radius_auth.c
src/modules/proto_radius/proto_radius_coa.c
src/modules/proto_radius/proto_radius_dynamic_client.c
src/modules/proto_radius/proto_radius_status.c
src/modules/proto_tacacs/proto_tacacs.c
src/modules/proto_vmps/proto_vmps_all.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/peap.c

index d5df048b91df691e691e03b5192e7dfdf49d00f2..8033ca6256949feae0edcfbefa682e7da05a3f0a 100644 (file)
@@ -40,6 +40,9 @@ typedef enum {
        UNLANG_ACTION_STOP_PROCESSING           //!< Break out of processing the current request (unwind).
 } unlang_action_t;
 
+#define UNLANG_TOP_FRAME (true)
+#define UNLANG_SUB_FRAME (false)
+
 /** Function to call when first evaluating a frame
  *
  * @param[in] request          The current request.
@@ -120,7 +123,7 @@ typedef struct {
 
 void           unlang_push_function(REQUEST *request, unlang_function_t func, unlang_function_t repeat, void *uctx);
 
-void           unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t default_action);
+void           unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t default_action, bool top_frame);
 
 rlm_rcode_t    unlang_interpret_continue(REQUEST *request);
 
index 20cbd9e988a3f0d67d94bbea2348cdf35c28ba2d..d23730e49ec839e467ef40f45f514132fc670b8d 100644 (file)
@@ -666,7 +666,7 @@ static unlang_group_t empty_group = {
 /** Push a configuration section onto the request stack for later interpretation.
  *
  */
-void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action)
+void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action, bool top_frame)
 {
        unlang_t        *instruction = NULL;
        unlang_stack_t  *stack = request->stack;
@@ -678,7 +678,7 @@ void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action)
        if (cs) {
                instruction = (unlang_t *)cf_data_value(cf_data_find(cs, unlang_group_t, NULL));
                if (!instruction) {
-                       RPEDEBUG("Failed to find pre-compiled unlang for section %s %s { ... }",
+                       REDEBUG("Failed to find pre-compiled unlang for section %s %s { ... }",
                                cf_section_name1(cs), cf_section_name2(cs));
                }
        }
@@ -689,7 +689,7 @@ void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action)
         *      Push the default action, and the instruction which has
         *      no action.
         */
-       unlang_push(stack, NULL, action, UNLANG_NEXT_STOP, UNLANG_TOP_FRAME);
+       if (top_frame) unlang_push(stack, NULL, action, UNLANG_NEXT_STOP, UNLANG_TOP_FRAME);
        if (instruction) unlang_push(stack, instruction, RLM_MODULE_UNKNOWN, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME);
 
        RDEBUG4("** [%i] %s - substack begins", stack->depth, __FUNCTION__);
@@ -715,7 +715,7 @@ rlm_rcode_t unlang_interpret(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t act
         *      This pushes a new frame onto the stack, which is the
         *      start of a new unlang section...
         */
-       unlang_push_section(request, cs, action);
+       unlang_push_section(request, cs, action, UNLANG_TOP_FRAME);
 
        return unlang_run(request);
 }
index 8e1c0cb46671803dd3c1685cef28e67661127440..fadff4f4ba5d452e47126f1957b998037f30fede 100644 (file)
@@ -68,7 +68,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'recv' from file %s", cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -139,7 +139,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                if (!unlang) goto send_reply;
 
                RDEBUG("Running 'send %s { ... }' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index 6d17a3795311ec2e34b532c4cab92c396f6d293f..3cec5aaa36d3d65503be6018447327d846957eed 100644 (file)
@@ -374,7 +374,7 @@ static void request_running(REQUEST *request, fr_state_signal_t action)
 
                RDEBUG("Running '%s %s' from file %s", cf_section_name1(unlang),
                       cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
index cbd5e4a4061304e7574c22948002b3c4220c3956..b72b06cc238f2f870fed1f11a63a3c1faa14488d 100644 (file)
@@ -64,7 +64,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'recv Accounting-Request' from file %s", cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -118,7 +118,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                if (!unlang) goto send_reply;
 
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index aeacf54ae75ef57da39c8131a5337bf7aa8981e7..e722b395330d1364a6698b2fc0c9dd3a62fa2c52 100644 (file)
@@ -166,7 +166,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                 *      Push the conf section into the unlang stack.
                 */
                RDEBUG("Running 'recv Access-Request' from file %s", cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_REJECT);
+               unlang_push_section(request, unlang, RLM_MODULE_REJECT, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -291,7 +291,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOTFOUND);
+               unlang_push_section(request, unlang, RLM_MODULE_NOTFOUND, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_PROCESS;
                /* FALL-THROUGH */
@@ -425,7 +425,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index 2793c2f3f3a3b757fb95b0a4268c62a31775e7c8..c71612c774912f0623b8ab2122a52e2e1cab36e6 100644 (file)
@@ -74,7 +74,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'recv %s' from file %s", dv->alias, cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -132,7 +132,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                 */
        rerun_nak:
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
                rad_assert(request->log.unlang_indent == 0);
 
                request->request_state = REQUEST_SEND;
index d0ad96b85d6d3a0f4b07a41693ed37fe5bdad5dd..0a65d94326ee1599bec5cb1c2bc763bafa724af6 100644 (file)
@@ -61,7 +61,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'new client' from file %s", cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -97,7 +97,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
 
        rerun_nak:
                RDEBUG("Running '%s client' from file %s", cf_section_name1(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index 8b9317329e022b73e01935596b6877e9d221ddc2..a81072cfee4edb0162f164b92bec1342abb3fec8 100644 (file)
@@ -64,7 +64,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                }
 
                RDEBUG("Running 'recv Status-Server' from file %s", cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -112,7 +112,7 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
 
        rerun_nak:
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index c87aad70eb9f5915b6948063a86bd95b912db14d..a56dc27f48227706c0da993e3e2649007b190502 100644 (file)
@@ -195,7 +195,7 @@ static void tacacs_running(REQUEST *request, fr_state_signal_t action)
                }
 
                RDEBUG("Running 'recv %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_REJECT);
+               unlang_push_section(request, unlang, RLM_MODULE_REJECT, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -291,7 +291,7 @@ stop_processing:
                }
 
                RDEBUG("Running 'process %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOTFOUND);
+               unlang_push_section(request, unlang, RLM_MODULE_NOTFOUND, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_PROCESS;
                /* FALL-THROUGH */
@@ -341,7 +341,7 @@ setup_send:
                if (!unlang) goto send_reply;
 
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index 8fa5f35f511b5929b80a42b11a819216a5f92e70..9e41fc500c1c04d1051c8c2ad4962e966d18e624 100644 (file)
@@ -62,7 +62,7 @@ static fr_io_final_t mod_process(REQUEST *request, UNUSED fr_io_action_t action)
                }
 
                RDEBUG("Running 'recv %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_RECV;
                /* FALL-THROUGH */
@@ -109,7 +109,7 @@ static fr_io_final_t mod_process(REQUEST *request, UNUSED fr_io_action_t action)
 
        rerun_nak:
                RDEBUG("Running 'send %s' from file %s", cf_section_name2(unlang), cf_filename(unlang));
-               unlang_push_section(request, unlang, RLM_MODULE_NOOP);
+               unlang_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME);
 
                request->request_state = REQUEST_SEND;
                /* FALL-THROUGH */
index 73290c8ddf3e4604c6e93176922efbec7cd15c0d..de330511e46372b83f382106fe69ea51e791b063 100644 (file)
@@ -143,7 +143,7 @@ static rlm_rcode_t mod_process(void *instance, eap_session_t *eap_session)
                return RLM_MODULE_OK;
        }
 
-       unlang_push_section(request, unlang, RLM_MODULE_FAIL);
+       unlang_push_section(request, unlang, RLM_MODULE_FAIL, UNLANG_TOP_FRAME);
 
        eap_session->process = mod_process_auth_type;
 
index b17978d1facfecab5664130fb1d3794142916034..e13eaf5145652c324805db1fc53e6fd65a8a38cb 100644 (file)
@@ -670,7 +670,7 @@ packet_ready:
        if (!unlang) {
                rcode = process_authenticate(inst->auth_type_mschap, request);
        } else {
-               unlang_push_section(request, unlang, RLM_MODULE_FAIL);
+               unlang_push_section(request, unlang, RLM_MODULE_FAIL, UNLANG_TOP_FRAME);
                rcode = unlang_interpret_continue(request);
 
                /*
index 3cfe530f03bb54a3a1a4021845cc61b0ecddec22..0c202d20e8ef250f2ee41b8d3442965321a3ad74 100644 (file)
@@ -939,7 +939,7 @@ rlm_rcode_t eap_peap_process(eap_session_t *eap_session, tls_session_t *tls_sess
                                if (!unlang) {
                                        rcode = process_authenticate(enumv->value->vb_uint32, fake);
                                } else {
-                                       unlang_push_section(request, unlang, RLM_MODULE_FAIL);
+                                       unlang_push_section(request, unlang, RLM_MODULE_FAIL, UNLANG_TOP_FRAME);
                                        rcode = unlang_interpret_continue(request);
                                }