From: Alan T. DeKok Date: Sun, 21 Mar 2021 18:42:19 +0000 (-0400) Subject: remove unnecessary "reject" field X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0e9c7b2d8d73f4ecd60ad97f5cf9a99f04b8d93;p=thirdparty%2Ffreeradius-server.git remove unnecessary "reject" field --- diff --git a/src/lib/server/process.h b/src/lib/server/process.h index 21598e9b020..afa3a729862 100644 --- a/src/lib/server/process.h +++ b/src/lib/server/process.h @@ -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]; diff --git a/src/process/radius/base.c b/src/process/radius/base.c index 61b3378bcd3..a0c87fd0d5e 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -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),