]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove unnecessary "reject" field
authorAlan T. DeKok <aland@freeradius.org>
Sun, 21 Mar 2021 18:42:19 +0000 (14:42 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:07:43 +0000 (16:07 +0100)
src/lib/server/process.h
src/process/radius/base.c

index 21598e9b0203d27a71e99983b2984cb570404e67..afa3a7298623db28b98447ce7c277ecb5a03031a 100644 (file)
@@ -67,7 +67,6 @@ typedef struct {
        size_t                  section_offset; //!< Where to look in the process instance for
                                                ///< a pointer to the section we should execute.
        rlm_rcode_t             rcode;          //!< Default rcode
-       PROCESS_PACKET_TYPE     reject;         //!< Reject packet type.
        module_method_t         recv;           //!< Method to call when receiving this type of packet.
        unlang_module_resume_t  resume;         //!< Function to call after running a recv section.
        unlang_module_resume_t  send;           //!< Method to call when sending this type of packet.
@@ -208,11 +207,17 @@ RESUME(send_generic)
 
        default:
                /*
-                *      ACK can turn into NAK, but not vice versa.
-                *      And anything can say "don't respond".
+                *      If we're in the "do not respond" situation,
+                *      then don't change the packet code to something
+                *      else.  However, if we're in (say) Accept, and
+                *      the code says Reject, then go do reject.
+                *
+                *      The author of the state machine MUST ensure
+                *      that there isn't a loop in the state machine
+                *      definitions.
                 */
-               if ((state->packet_type[rcode] != request->reply->code) &&
-                   ((state->packet_type[rcode] == state->reject) || (state->packet_type[rcode] == PROCESS_CODE_DO_NOT_RESPOND))) {
+               if ((request->reply->code != PROCESS_CODE_DO_NOT_RESPOND) &&
+                   (state->packet_type[rcode] != request->reply->code)) {
                        char const *old = cf_section_name2(cs);
 
                        request->reply->code = state->packet_type[rcode];
index 61b3378bcd32107482bf4dd2b4ef620d686e9a1d..a0c87fd0d5e849c080e4a47361e4c9cb56a603b2 100644 (file)
@@ -744,7 +744,6 @@ static fr_process_state_t const process_state[PROCESS_CODE_MAX] = {
                        [RLM_MODULE_DISALLOW] = FR_RADIUS_CODE_ACCESS_REJECT
                },
                .rcode = RLM_MODULE_NOOP,
-               .reject = FR_RADIUS_CODE_ACCESS_REJECT,
                .send = send_generic,
                .resume = resume_access_accept,
                .section_offset = offsetof(process_radius_sections_t, access_accept),
@@ -769,7 +768,6 @@ static fr_process_state_t const process_state[PROCESS_CODE_MAX] = {
                        [RLM_MODULE_DISALLOW] = FR_RADIUS_CODE_ACCESS_REJECT
                },
                .rcode = RLM_MODULE_NOOP,
-               .reject = FR_RADIUS_CODE_ACCESS_REJECT,
                .send = send_generic,
                .resume = resume_access_challenge,
                .section_offset = offsetof(process_radius_sections_t, access_challenge),
@@ -848,7 +846,6 @@ static fr_process_state_t const process_state[PROCESS_CODE_MAX] = {
                        [RLM_MODULE_DISALLOW] = FR_RADIUS_CODE_COA_NAK
                },
                .rcode = RLM_MODULE_NOOP,
-               .reject = FR_RADIUS_CODE_COA_NAK,
                .send = send_generic,
                .resume = resume_send_generic,
                .section_offset = offsetof(process_radius_sections_t, coa_ack),
@@ -890,7 +887,6 @@ static fr_process_state_t const process_state[PROCESS_CODE_MAX] = {
                        [RLM_MODULE_DISALLOW] = FR_RADIUS_CODE_DISCONNECT_NAK
                },
                .rcode = RLM_MODULE_NOOP,
-               .reject = FR_RADIUS_CODE_DISCONNECT_NAK,
                .send = send_generic,
                .resume = resume_send_generic,
                .section_offset = offsetof(process_radius_sections_t, disconnect_ack),