From: Alan T. DeKok Date: Wed, 6 Sep 2017 19:13:20 +0000 (-0400) Subject: remove packet_type. Use unlang instead X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be91efa6c9f6833406d8fe3b0518f50ce2954652;p=thirdparty%2Ffreeradius-server.git remove packet_type. Use unlang instead --- diff --git a/raddb/README.md b/raddb/README.md index b6f7750c4e0..536267880ce 100644 --- a/raddb/README.md +++ b/raddb/README.md @@ -342,6 +342,9 @@ module now looks for &request.control:Cleartext-Password. Exec-Program and Exec-Program-Wait have been removed. +The `packet_type` configuration has been removed. Use `unlang` checks +to see if you want to execute the module. + ### rlm_expr Allow `&Attr-Name[*]` to mean "sum". Previously, it just referred to diff --git a/raddb/mods-available/echo b/raddb/mods-available/echo index ad3e15933f9..80c27052312 100644 --- a/raddb/mods-available/echo +++ b/raddb/mods-available/echo @@ -81,22 +81,6 @@ exec echo { # output_pairs = reply - # - # When to execute the program. If the packet - # type does NOT match what's listed here, then - # the module does NOT execute the program. - # - # For a list of allowed packet types, see - # the 'dictionary' file, and look for VALUEs - # of the Packet-Type attribute. - # - # By default, the module executes on ANY packet. - # Un-comment out the following line to tell the - # module to execute only if an Access-Accept is - # being sent to the NAS. - # - #packet_type = Access-Accept - # # Should we escape the environment variables? # diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index 55418eef8a3..9072bf2a238 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -43,8 +43,6 @@ typedef struct rlm_exec_t { char const *output; pair_lists_t input_list; pair_lists_t output_list; - char const *packet_type; - unsigned int packet_code; bool shell_escape; uint32_t timeout; } rlm_exec_t; @@ -54,7 +52,6 @@ static const CONF_PARSER module_config[] = { { FR_CONF_OFFSET("program", FR_TYPE_STRING | FR_TYPE_XLAT, rlm_exec_t, program) }, { FR_CONF_OFFSET("input_pairs", FR_TYPE_STRING, rlm_exec_t, input) }, { FR_CONF_OFFSET("output_pairs", FR_TYPE_STRING, rlm_exec_t, output) }, - { FR_CONF_OFFSET("packet_type", FR_TYPE_STRING, rlm_exec_t, packet_type) }, { FR_CONF_OFFSET("shell_escape", FR_TYPE_BOOL, rlm_exec_t, shell_escape), .dflt = "yes" }, { FR_CONF_OFFSET("timeout", FR_TYPE_UINT32, rlm_exec_t, timeout) }, CONF_PARSER_TERMINATOR @@ -234,23 +231,6 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) return -1; } - /* - * Get the packet type on which to execute - */ - if (!inst->packet_type) { - inst->packet_code = 0; - } else { - fr_dict_enum_t *dval; - - dval = fr_dict_enum_by_alias(NULL, fr_dict_attr_by_num(NULL, 0, FR_PACKET_TYPE), inst->packet_type); - if (!dval) { - cf_log_err(conf, "Unknown packet type %s: See list of VALUEs for Packet-Type in " - "share/dictionary", inst->packet_type); - return -1; - } - inst->packet_code = dval->value->vb_uint32; - } - /* * Get the time to wait before killing the child */ @@ -295,22 +275,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_exec_dispatch(void *instance, UNUSED voi return RLM_MODULE_FAIL; } - /* - * See if we're supposed to execute it now. - */ - if (!((inst->packet_code == 0) || (request->packet->code == inst->packet_code) || - (request->reply->code == inst->packet_code) -#ifdef WITH_PROXY - || (request->proxy && - ((request->proxy->packet->code == inst->packet_code) || - (request->proxy->reply && (request->proxy->reply->code == inst->packet_code)))) -#endif - )) { - RDEBUG2("Packet type is not %s. Not executing", inst->packet_type); - - return RLM_MODULE_NOOP; - } - /* * Decide what input/output the program takes. */