]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove packet_type. Use unlang instead
authorAlan T. DeKok <aland@freeradius.org>
Wed, 6 Sep 2017 19:13:20 +0000 (15:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 6 Sep 2017 19:14:21 +0000 (15:14 -0400)
raddb/README.md
raddb/mods-available/echo
src/modules/rlm_exec/rlm_exec.c

index b6f7750c4e05d0cd64a3f2ace4418d9ebad1f48c..536267880ce6acc0c7f43c65142cd4edf6bff377 100644 (file)
@@ -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
index ad3e15933f9e85c5566810432a5fec8f23d877c1..80c270523125681d7d02a1f97a4d6e1ecd429b00 100644 (file)
@@ -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?
        #
index 55418eef8a316987c7ef0a00c8e9ea8f92cc883c..9072bf2a2387a0438712db95b017f9588836b016 100644 (file)
@@ -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.
         */