]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fix use of mod_rcode_table
authorAlan T. DeKok <aland@freeradius.org>
Fri, 27 Dec 2019 13:53:48 +0000 (08:53 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 27 Dec 2019 13:53:48 +0000 (08:53 -0500)
the definition for it shouldn't be in src/lib/server, but in
src/lib/unlang, where it's defined.

Since that definition has move, update the rest of the server
to use the src/lib/server "rcode_table", instead of the
unlang-specific "mod_rcode_table".

We should probably just get rid of the mod_rcode_table entirely,
unless we want unlang tests which don't include any server
functionality

src/lib/server/module.h
src/lib/server/virtual_servers.c
src/lib/unlang/unlang_priv.h
src/modules/proto_radius/proto_radius_acct.c
src/modules/rlm_always/rlm_always.c
src/modules/rlm_lua/lua.c
src/modules/rlm_sometimes/rlm_sometimes.c

index 05377fe388ac5394b8c82fd3991e395c239b59c9..2116c02590bddef4e38f558a3ac2a68d85520bf4 100644 (file)
@@ -52,9 +52,6 @@ typedef struct module_thread_instance_s  module_thread_instance_t;
 extern "C" {
 #endif
 
-extern fr_table_num_sorted_t const mod_rcode_table[];
-extern size_t mod_rcode_table_len;
-
 /** Mappings between section names, and control attributes
  *
  * Defined in module.c.
index f06c21ea2768be5e91597a5b667567cc01e784ec..489441a77b73381245fd7924e8c82840a984f24e 100644 (file)
@@ -1055,7 +1055,7 @@ rlm_rcode_t process_authenticate(int auth_type, REQUEST *request)
        if (!cs) {
                RDEBUG2("Empty 'authenticate' section in virtual server \"%s\".  Using default return value (%s)",
                        cf_section_name2(request->server_cs),
-                       fr_table_str_by_value(mod_rcode_table, RLM_MODULE_REJECT, "<invalid>"));
+                       fr_table_str_by_value(rcode_table, RLM_MODULE_REJECT, "<invalid>"));
                return RLM_MODULE_REJECT;
        }
 
index 9e1e7ee955857badd529810e24ee3282117b5042..19374e796ea55332b3d68e0e2856ef426dcba1e7 100644 (file)
@@ -291,6 +291,9 @@ extern unlang_op_t unlang_ops[];
 
 extern char const *const comp2str[];
 
+extern fr_table_num_sorted_t const mod_rcode_table[];
+extern size_t mod_rcode_table_len;
+
 /** @name Conversion functions for converting #unlang_t to its specialisations
  *
  * Simple conversions: #unlang_module_t and #unlang_group_t are subclasses of #unlang_t,
index b63028186d394a6f06d5df8bd1eb1b95560c413a..728ee100c6f87e8e9ee3cedaefc8d6d5edb9df43 100644 (file)
@@ -111,7 +111,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request)
                case RLM_MODULE_DISALLOW:
                default:
                        RDEBUG("The 'recv Accounting-Request' section returned %s - not sending a response",
-                              fr_table_str_by_value(mod_rcode_table, rcode, "???"));
+                              fr_table_str_by_value(rcode_table, rcode, "???"));
                        request->reply->code = FR_CODE_DO_NOT_RESPOND;
                        goto send_reply;
                }
@@ -167,7 +167,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request)
                case RLM_MODULE_DISALLOW:
                default:
                        RDEBUG("The 'accounting' section returned %s - not sending a response",
-                              fr_table_str_by_value(mod_rcode_table, rcode, "???"));
+                              fr_table_str_by_value(rcode_table, rcode, "???"));
                        request->reply->code = FR_CODE_DO_NOT_RESPOND;
                        goto send_reply;
                }
@@ -210,7 +210,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request)
 
                default:
                        RDEBUG("The 'send Accounting-Response' section returned %s - not sending a response",
-                              fr_table_str_by_value(mod_rcode_table, rcode, "???"));
+                              fr_table_str_by_value(rcode_table, rcode, "???"));
                        request->reply->code = FR_CODE_DO_NOT_RESPOND;
                        break;
                }
index 57bdfb20c55877822fa0e4898a7ca911bd1a1077..fd67d90edaa746ea022202b763155ed5771ca78e 100644 (file)
@@ -59,7 +59,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        /*
         *      Convert the rcode string to an int
         */
-       inst->rcode = fr_table_value_by_str(mod_rcode_table, inst->rcode_str, RLM_MODULE_UNKNOWN);
+       inst->rcode = fr_table_value_by_str(rcode_table, inst->rcode_str, RLM_MODULE_UNKNOWN);
        if (inst->rcode == RLM_MODULE_UNKNOWN) {
                cf_log_err(conf, "rcode value \"%s\" is invalid", inst->rcode_str);
                return -1;
index 435205813382092c2ea806a41bff34c9fb69836a..3fa7ec06d85aa244933262a60098bec565fbbf49 100644 (file)
@@ -783,14 +783,14 @@ error:
                 */
                if (lua_isnumber(L, -1)) {
                        ret = lua_tointeger(L, -1);
-                       if (fr_table_str_by_value(mod_rcode_table, ret, NULL) != NULL) goto done;
+                       if (fr_table_str_by_value(rcode_table, ret, NULL) != NULL) goto done;
                }
 
                /*
                 *      e.g: return "handled", "ok", "fail", ...
                 */
                if (lua_isstring(L, -1)) {
-                       ret = fr_table_value_by_str(mod_rcode_table, lua_tostring(L, -1), -1);
+                       ret = fr_table_value_by_str(rcode_table, lua_tostring(L, -1), -1);
                        if (ret != -1) goto done;
                }
 
@@ -822,7 +822,7 @@ static int _lua_rcode_table_index(lua_State *L)
        char const *key = lua_tostring(L, -1);
        int ret;
 
-       ret = fr_table_value_by_str(mod_rcode_table, key, -1);
+       ret = fr_table_value_by_str(rcode_table, key, -1);
        if (ret != -1) {
                lua_pushinteger(L, ret);
                return 1;
index 95d0ed76e2f2fea06fd64dbe206156473e70d454..7cfeae3451840e1ec9f7ee71e9739014a3831da5 100644 (file)
@@ -52,7 +52,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        /*
         *      Convert the rcode string to an int, and get rid of it
         */
-       inst->rcode = fr_table_value_by_str(mod_rcode_table, inst->rcode_str, RLM_MODULE_UNKNOWN);
+       inst->rcode = fr_table_value_by_str(rcode_table, inst->rcode_str, RLM_MODULE_UNKNOWN);
        if (inst->rcode == RLM_MODULE_UNKNOWN) {
                cf_log_err(conf, "Unknown module return code '%s'", inst->rcode_str);
                return -1;