From: Alan T. DeKok Date: Fri, 27 Dec 2019 13:53:48 +0000 (-0500) Subject: fix use of mod_rcode_table X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1814f399023ebcb4e72fefcffe95b6b0039912d4;p=thirdparty%2Ffreeradius-server.git fix use of mod_rcode_table 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 --- diff --git a/src/lib/server/module.h b/src/lib/server/module.h index 05377fe388a..2116c02590b 100644 --- a/src/lib/server/module.h +++ b/src/lib/server/module.h @@ -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. diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index f06c21ea276..489441a77b7 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -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, "")); + fr_table_str_by_value(rcode_table, RLM_MODULE_REJECT, "")); return RLM_MODULE_REJECT; } diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 9e1e7ee9558..19374e796ea 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -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, diff --git a/src/modules/proto_radius/proto_radius_acct.c b/src/modules/proto_radius/proto_radius_acct.c index b63028186d3..728ee100c6f 100644 --- a/src/modules/proto_radius/proto_radius_acct.c +++ b/src/modules/proto_radius/proto_radius_acct.c @@ -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; } diff --git a/src/modules/rlm_always/rlm_always.c b/src/modules/rlm_always/rlm_always.c index 57bdfb20c55..fd67d90edaa 100644 --- a/src/modules/rlm_always/rlm_always.c +++ b/src/modules/rlm_always/rlm_always.c @@ -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; diff --git a/src/modules/rlm_lua/lua.c b/src/modules/rlm_lua/lua.c index 43520581338..3fa7ec06d85 100644 --- a/src/modules/rlm_lua/lua.c +++ b/src/modules/rlm_lua/lua.c @@ -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; diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index 95d0ed76e2f..7cfeae34518 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -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;