From: Arran Cudbard-Bell Date: Mon, 27 May 2024 03:38:35 +0000 (-0400) Subject: Sort module methods to ensure a consistent order X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdc50c0affefdc9cbc01f1131c4768e71e896c5b;p=thirdparty%2Ffreeradius-server.git Sort module methods to ensure a consistent order --- diff --git a/src/lib/server/libfreeradius-server.mk b/src/lib/server/libfreeradius-server.mk index 4bed684a717..250c1586422 100644 --- a/src/lib/server/libfreeradius-server.mk +++ b/src/lib/server/libfreeradius-server.mk @@ -33,6 +33,7 @@ SOURCES := \ regex.c \ request.c \ request_data.c \ + section.c \ snmp.c \ state.c \ stats.c \ diff --git a/src/lib/server/module.h b/src/lib/server/module.h index d15ecc6ae88..48d29ab28de 100644 --- a/src/lib/server/module.h +++ b/src/lib/server/module.h @@ -153,12 +153,20 @@ extern "C" { * */ struct module_method_binding_s { - fr_dict_t const **proto; //!< Only allow this method to be called in this namespace. - section_name_t const *section; //!< Identifier for a section. module_method_t method; //!< Module method to call - call_env_method_t const * const method_env; //!< Call specific conf parsing. + call_env_method_t const *method_env; //!< Method specific call_env. + + fr_dlist_head_t name2_list; //!< List of bindings with the same name1. Only initialised + ///< for the the first name1 binding. + ///< DO NOT INITIALISE IN THE MODULE. + fr_dlist_t name2_entry; //!< Linked list of bindings with the same name1. + ///< Allows us to more quickly iterate over all + ///< name2 entries after finding a matching name1. + ///< This is also temporarily used to verify the ordering + ///< of name bindings. + ///< DO NOT INITIALISE IN THE MODULE. }; /** Struct exported by a rlm_* module diff --git a/src/lib/server/module_rlm.c b/src/lib/server/module_rlm.c index ee1ee1b5d3b..79342b40b99 100644 --- a/src/lib/server/module_rlm.c +++ b/src/lib/server/module_rlm.c @@ -25,7 +25,6 @@ * @copyright 2000 Alan DeKok (aland@freeradius.org) * @copyright 2000 Alan Curry (pacman@world.std.com) */ - RCSID("$Id$") #include @@ -37,7 +36,10 @@ RCSID("$Id$") #include #include #include + #include +#include +#include #include #include @@ -961,6 +963,138 @@ int modules_rlm_instantiate(void) return modules_instantiate(rlm_modules_static); } +/** Compare the section names of two module_method_binding_t structures + */ +static int8_t binding_name_cmp(void const *one, void const *two) +{ + module_method_binding_t const *a = one; + module_method_binding_t const *b = two; + + return section_name_cmp(a->section, b->section); +} + +static int module_method_validate(module_instance_t *mi) +{ + module_method_binding_t *p, *srt_p; + module_rlm_t const *mrlm; + fr_dlist_head_t bindings; + bool in_order = true; + + mrlm = module_rlm_from_module(mi->exported); + + fr_dlist_init(&bindings, module_method_binding_t, name2_entry); + + /* + * Not all modules export module method bindings + */ + if (!mrlm->bindings) return 0; + + for (p = mrlm->bindings; p->section; p++) { + if (!fr_cond_assert_msg(p->section->name1, + "%s: First section identifier can't be NULL", mi->name)) return -1; + if (!fr_cond_assert_msg(p->section->name1 || p->section->name2, + "%s: Section identifiers can't both be null", mi->name)) return -1; + + /* + * All the bindings go in a list so we can sort them + * and produce the list in the correct order. + */ + fr_dlist_insert_tail(&bindings, p); + } + + fr_dlist_sort(&bindings, binding_name_cmp); + + /* + * Iterate over the sorted list of bindings, + * and the original list, to ensure they're + * in the correct order. + */ + for (srt_p = fr_dlist_head(&bindings), p = mrlm->bindings; + srt_p; + srt_p = fr_dlist_next(&bindings, srt_p), p++) { + if (p != srt_p) { + in_order = false; + break; + } +#if 0 + { + module_method_binding_t const *pp; + /* + * Print the correct order of bindings + */ + FR_FAULT_LOG("%s: Module method bindings are not in the correct order, the correct order is:", mi->name); + FR_FAULT_LOG(".bindings = (module_method_binding_t[]){"); + for (pp = fr_dlist_head(&bindings); + pp; + pp = fr_dlist_next(&bindings, pp)) { + char const *name1_quote = (pp->section->name1 && (pp->section->name1 != CF_IDENT_ANY)) ? "\"" : ""; + char const *name2_quote = (pp->section->name2 && (pp->section->name2 != CF_IDENT_ANY)) ? "\"" : ""; + char const *name1 = pp->section->name1; + char const *name2 = pp->section->name2; + + if (name1 == CF_IDENT_ANY) { + name1 = "CF_IDENT_ANY"; + } else if (!name1) { + name1 = "NULL"; + } + if (name2 == CF_IDENT_ANY) { + name2 = "CF_IDENT_ANY"; + } else if (!name2) { + name2 = "NULL"; + } + + FR_FAULT_LOG("\t.section = SECTION_NAME(%s%s%s, %s%s%s)", + name1_quote, name1, name1_quote, + name2_quote, name2, name2_quote); + } + FR_FAULT_LOG("}"); + } +#endif + } + + /* + * Rebuild the binding list in the correct order. + */ + if (!in_order) { + module_method_binding_t *ordered; + + MEM(ordered = talloc_array(NULL, module_method_binding_t, fr_dlist_num_elements(&bindings))); + for (srt_p = fr_dlist_head(&bindings), p = ordered; + srt_p; + srt_p = fr_dlist_next(&bindings, srt_p), p++) { + *p = *srt_p; + } + memcpy(mrlm->bindings, ordered, fr_dlist_num_elements(&bindings) * sizeof(*ordered)); + talloc_free(ordered); + } + + /* + * Build the "skip" list of name1 entries + */ + { + module_method_binding_t *last_binding = NULL; + + for (p = mrlm->bindings; p->section; p++) { + if (!last_binding || + ( + (last_binding->section->name1 != p->section->name1) && + ( + (last_binding->section->name1 == CF_IDENT_ANY) || + (p->section->name1 == CF_IDENT_ANY) || + (strcmp(last_binding->section->name1, p->section->name1) != 0) + ) + ) + ) { + fr_dlist_init(&p->name2_list, module_method_binding_t, name2_entry); + last_binding = p; + } + fr_dlist_insert_tail(&last_binding->name2_list, p); + } + } + + return 0; +} + static int module_conf_parse(module_list_t *ml, CONF_SECTION *mod_conf) { char const *name; @@ -1006,7 +1140,17 @@ static int module_conf_parse(module_list_t *ml, CONF_SECTION *mod_conf) if (unlikely(mi == NULL)) { cf_log_perr(mod_conf, "Failed loading module"); return -1; + } + /* + * First time we've loaded the dl module, so we need to + * check the module methods to make sure they're ordered + * correctly, and to add the "skip list" style name2 + * entries. + */ + if ((mi->module->refs == 1) && (module_method_validate(mi) < 0)) { + talloc_free(mi); + return -1; } if (module_instance_conf_parse(mi, mod_conf) < 0) { diff --git a/src/lib/server/module_rlm.h b/src/lib/server/module_rlm.h index 221960141e3..fd175057cae 100644 --- a/src/lib/server/module_rlm.h +++ b/src/lib/server/module_rlm.h @@ -34,7 +34,7 @@ extern "C" { typedef struct { module_t common; //!< Common fields presented by all modules. - module_method_binding_t const *bindings; //!< named methods + module_method_binding_t *bindings; //!< named methods } module_rlm_t; /** Cast a module_t to a module_rlm_t diff --git a/src/lib/server/section.c b/src/lib/server/section.c new file mode 100644 index 00000000000..8745e17cd5a --- /dev/null +++ b/src/lib/server/section.c @@ -0,0 +1,119 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * $Id$ + * + * @file lib/server/section.c + * @brief Comparison functions for sections + * + * @copyright 2024 Arran Cudbard-Bell (a.cudbardb@freeradius.org) + */ +RCSID("$Id$") + +#include +#include + +#define IDENT_ANY_CMP(_a, _b) \ + (((_a) == CF_IDENT_ANY) < ((_b) == CF_IDENT_ANY)) - (((_a) == CF_IDENT_ANY) > ((_b) == CF_IDENT_ANY)) + +#define NULL_CMP(_a, _b) \ + (((_a) == NULL) < ((_b) == NULL)) - (((_a) == NULL) > ((_b) == NULL)) + +/** Compare two sections + * + * - Sections are sorted by name1, then name2. + * - NULLs sort before non-NULLs. + * - CF_IDENT_ANY sort after non-CF_IDENT_ANY. + * - Any other comparisons are lexicographic. + * + * @param[in] one First section name. + * @param[in] two Second section name. + * + * @return < 0 if one < two, 0 if one == two, > 0 if one > two. + */ +int8_t section_name_cmp(void const *one, void const *two) +{ + section_name_t const *a = one; + section_name_t const *b = two; + int ret; + + /* + * name1 isn't allowed to be NULL, for wildcard matches + * we use CF_IDENT_ANY. + */ + fr_assert(a->name1 && b->name1); + + /* + * Straight comparison between sections. + */ + ret = CMP(a, b); + if (ret == 0) return 0; + + /* + * Fastpath for static strings and CF_IDENT_ANY + */ + if (a->name1 == b->name1) goto name2; + + /* + * If either identifier is CF_IDENT_ANY, we can't strcmp. + */ + if ((a->name1 == CF_IDENT_ANY) || (b->name1 == CF_IDENT_ANY)) { + ret = IDENT_ANY_CMP(b->name1, a->name1); + if (ret != 0) return ret; + } else { + ret = strcmp(a->name1, b->name1); + if (ret != 0) return CMP(ret, 0); + } + +name2: + /* + * Second identifier can be NULL. + * + * NULL name2s sort first. + */ + ret = NULL_CMP(a->name2, b->name2); + if (ret != 0) return ret; + + if (a->name2 == b->name2) return 0; + + if ((a->name2 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) { + return IDENT_ANY_CMP(b->name2, a->name2); /* Can't strcmp */ + } + + return CMP(strcmp(a->name2, b->name2), 0); +} + +/* Compare two section names + * + * Respects CF_IDENT_ANY values + * + * @param[in] a First section name. + * @param[in] b Second section name. + * + * @return true if the section names match, false otherwise. + */ +bool section_name_match(section_name_t const *a, section_name_t const *b) +{ + if ((a->name1 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) goto name2; + + if (strcmp(a->name1, b->name1) != 0) return false; + +name2: + if ((a->name2 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) return true; + + return (strcmp(a->name2, b->name2) == 0); +} diff --git a/src/lib/server/section.h b/src/lib/server/section.h index 14cc91fddc6..34b502fb2bf 100644 --- a/src/lib/server/section.h +++ b/src/lib/server/section.h @@ -25,6 +25,8 @@ */ RCSIDH(section_h, "$Id$") +#include + #ifdef __cplusplus extern "C" { #endif @@ -43,6 +45,10 @@ typedef struct { char const *name2; //!< Second section name. Usually a packet type like 'access-request', 'access-accept', etc... } section_name_t; +int8_t section_name_cmp(void const *one, void const *two); + +bool section_name_match(section_name_t const *a, section_name_t const *b); + #ifdef __cplusplus } #endif diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index df3c6da5e40..c9e63739839 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -384,11 +384,12 @@ module_rlm_t rlm_attr_filter = { /* * Hack to support old configurations */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index 235a1c31d38..999dd4281c3 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -1517,12 +1517,12 @@ module_rlm_t rlm_cache = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env }, + { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env }, { .section = SECTION_NAME("load", CF_IDENT_ANY), .method = mod_method_load, .method_env = &cache_method_env }, - { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env }, + { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env }, { .section = SECTION_NAME("store", CF_IDENT_ANY), .method = mod_method_store, .method_env = &cache_method_env }, - { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env }, - { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env }, + { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env }, + { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env }, { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_cache_it, .method_env = &cache_method_env }, MODULE_BINDING_TERMINATOR } diff --git a/src/modules/rlm_chap/rlm_chap.c b/src/modules/rlm_chap/rlm_chap.c index 334d0a2d1ba..3dc3476051b 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -389,10 +389,8 @@ module_rlm_t rlm_chap = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize, - .method_env = &chap_autz_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &chap_auth_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &chap_auth_method_env }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize, .method_env = &chap_autz_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_couchbase/rlm_couchbase.c b/src/modules/rlm_couchbase/rlm_couchbase.c index a3240e4fdb4..c26926a15b2 100644 --- a/src/modules/rlm_couchbase/rlm_couchbase.c +++ b/src/modules/rlm_couchbase/rlm_couchbase.c @@ -556,8 +556,8 @@ module_rlm_t rlm_couchbase = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 1cc1b8b72cb..62c7e1c8e15 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -509,14 +509,10 @@ module_rlm_t rlm_detail = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, - .method_env = &method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &method_env }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, - .method_env = &method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, - .method_env = &method_env }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_digest/rlm_digest.c b/src/modules/rlm_digest/rlm_digest.c index e832859ba14..ce09465c30a 100644 --- a/src/modules/rlm_digest/rlm_digest.c +++ b/src/modules/rlm_digest/rlm_digest.c @@ -481,8 +481,8 @@ module_rlm_t rlm_digest = { .instantiate = mod_instantiate, }, .bindings = (module_method_binding_t[]){ - { .proto = &dict_radius, .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, - { .proto = &dict_radius, .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, MODULE_BINDING_TERMINATOR }, }; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index ded2843ebd1..36882ade2ec 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -1197,9 +1197,9 @@ module_rlm_t rlm_eap = { .instantiate = mod_instantiate, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index 7cbe9ab59cb..2463afe9a0c 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -532,8 +532,7 @@ module_rlm_t rlm_exec = { .instantiate = mob_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot, - .method_env = &exec_method_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot, .method_env = &exec_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index 61e81d95e24..79cd5ee539b 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -676,8 +676,7 @@ module_rlm_t rlm_files = { .config = module_config, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, - .method_env = &method_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, .method_env = &method_env }, MODULE_BINDING_TERMINATOR } diff --git a/src/modules/rlm_imap/rlm_imap.c b/src/modules/rlm_imap/rlm_imap.c index 86b9344c09a..ccc5a5ee770 100644 --- a/src/modules/rlm_imap/rlm_imap.c +++ b/src/modules/rlm_imap/rlm_imap.c @@ -293,7 +293,7 @@ module_rlm_t rlm_imap = { .thread_detach = mod_thread_detach, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c b/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c index a1677232768..0619c7bcf5e 100644 --- a/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c +++ b/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c @@ -2241,8 +2241,8 @@ module_rlm_t rlm_isc_dhcp = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 150272bc3ef..0e4e3631bef 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -2734,17 +2734,12 @@ module_rlm_t rlm_ldap = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &authorize_method_env }, - - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &authorize_method_env }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, - .method_env = &usermod_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &authenticate_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, - .method_env = &usermod_method_env }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &usermod_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &authenticate_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &usermod_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_lua/rlm_lua.c b/src/modules/rlm_lua/rlm_lua.c index c1c3ec2b86c..fc78a855bc9 100644 --- a/src/modules/rlm_lua/rlm_lua.c +++ b/src/modules/rlm_lua/rlm_lua.c @@ -184,13 +184,13 @@ module_rlm_t rlm_lua = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_mruby/rlm_mruby.c b/src/modules/rlm_mruby/rlm_mruby.c index e5181373bad..3bd497243c5 100644 --- a/src/modules/rlm_mruby/rlm_mruby.c +++ b/src/modules/rlm_mruby/rlm_mruby.c @@ -521,13 +521,14 @@ module_rlm_t rlm_mruby = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index cb060f0e3a7..57e15001f5d 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -2528,10 +2528,8 @@ module_rlm_t rlm_mschap = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &mschap_autz_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &mschap_auth_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &mschap_auth_method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &mschap_autz_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_opendirectory/rlm_opendirectory.c b/src/modules/rlm_opendirectory/rlm_opendirectory.c index a75f02ced2d..91f7c342ec1 100644 --- a/src/modules/rlm_opendirectory/rlm_opendirectory.c +++ b/src/modules/rlm_opendirectory/rlm_opendirectory.c @@ -537,8 +537,8 @@ module_rlm_t rlm_opendirectory = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_pam/rlm_pam.c b/src/modules/rlm_pam/rlm_pam.c index 83bb4a55bfc..0c47b006ae8 100644 --- a/src/modules/rlm_pam/rlm_pam.c +++ b/src/modules/rlm_pam/rlm_pam.c @@ -278,7 +278,7 @@ module_rlm_t rlm_pam = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_pap/rlm_pap.c b/src/modules/rlm_pap/rlm_pap.c index 085aa02324a..67a363fb7df 100644 --- a/src/modules/rlm_pap/rlm_pap.c +++ b/src/modules/rlm_pap/rlm_pap.c @@ -1067,13 +1067,10 @@ module_rlm_t rlm_pap = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &pap_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &pap_method_env }, - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, - .method_env = &pap_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index ac3e1a1e407..d295a061ced 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -617,7 +617,7 @@ module_rlm_t rlm_passwd = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index f87d05fb086..53a7e9e799d 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -1186,13 +1186,14 @@ module_rlm_t rlm_perl = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_python/rlm_python.c b/src/modules/rlm_python/rlm_python.c index 48e65f84eae..6ef78a38d1e 100644 --- a/src/modules/rlm_python/rlm_python.c +++ b/src/modules/rlm_python/rlm_python.c @@ -1186,13 +1186,14 @@ module_rlm_t rlm_python = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_radutmp/rlm_radutmp.c b/src/modules/rlm_radutmp/rlm_radutmp.c index 5437a15c182..1d516b783b8 100644 --- a/src/modules/rlm_radutmp/rlm_radutmp.c +++ b/src/modules/rlm_radutmp/rlm_radutmp.c @@ -587,8 +587,7 @@ module_rlm_t rlm_radutmp = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, - .method_env = &method_env }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 217cc713f9d..598b0f331ae 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -1292,59 +1292,27 @@ module_rlm_t rlm_redis_ippool = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - /* - * RADIUS specific - */ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, - .method_env = &redis_ippool_alloc_method_env }, - { .section = SECTION_NAME("accounting", "start"), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - { .section = SECTION_NAME("accounting", "interim-update"), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - { .section = SECTION_NAME("accounting", "stop"), .method = mod_release, - .method_env = &redis_ippool_release_method_env }, - { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_bulk_release, - .method_env = &redis_ippool_bulk_release_method_env }, - { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_bulk_release, - .method_env = &redis_ippool_bulk_release_method_env }, - - /* - * DHCPv4 - */ - { .section = SECTION_NAME("recv", "discover"), .method = mod_alloc, - .method_env = &redis_ippool_alloc_method_env }, - { .section = SECTION_NAME("recv", "release"), .method = mod_release, - .method_env = &redis_ippool_release_method_env }, - { .section = SECTION_NAME("send", "ack"), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - - /* - * DHCPv6 - */ - { .section = SECTION_NAME("recv", "solicit"), .method = mod_alloc, - .method_env = &redis_ippool_alloc_method_env }, - - /* - * Generic - */ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, - .method_env = &redis_ippool_alloc_method_env }, - - /* - * Named methods matching module operations - */ - { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc, - .method_env = &redis_ippool_alloc_method_env }, - { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_update, - .method_env = &redis_ippool_update_method_env }, - { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_release, - .method_env = &redis_ippool_release_method_env }, - { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_bulk_release, - .method_env = &redis_ippool_bulk_release_method_env }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Start"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Interim-Update"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Stop"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ + + { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv4 */ + { .section = SECTION_NAME("recv", "Release"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* dhcpv4 */ + { .section = SECTION_NAME("send", "Ack"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* dhcpv4 */ + + { .section = SECTION_NAME("recv", "Solicit"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv6 */ + + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* generic */ + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* generic */ + + { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* verb */ + { .section = SECTION_NAME("update", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ + { .section = SECTION_NAME("renew", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ + { .section = SECTION_NAME("release", NULL), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* verb */ + { .section = SECTION_NAME("bulk-release", NULL), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* verb */ MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_rediswho/rlm_rediswho.c b/src/modules/rlm_rediswho/rlm_rediswho.c index 42c19d274fb..4033098bdce 100644 --- a/src/modules/rlm_rediswho/rlm_rediswho.c +++ b/src/modules/rlm_rediswho/rlm_rediswho.c @@ -258,7 +258,7 @@ module_rlm_t rlm_rediswho = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_securid/rlm_securid.c b/src/modules/rlm_securid/rlm_securid.c index a2a597e68a5..b23ad501676 100644 --- a/src/modules/rlm_securid/rlm_securid.c +++ b/src/modules/rlm_securid/rlm_securid.c @@ -561,7 +561,7 @@ module_rlm_t rlm_securid = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sigtran/rlm_sigtran.c b/src/modules/rlm_sigtran/rlm_sigtran.c index 044ed5f341d..d2b2c414bc8 100644 --- a/src/modules/rlm_sigtran/rlm_sigtran.c +++ b/src/modules/rlm_sigtran/rlm_sigtran.c @@ -435,7 +435,7 @@ module_rlm_t rlm_sigtran = { .thread_detach = mod_thread_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index 3fa33fe8605..3fa81f000f3 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -1051,10 +1051,9 @@ module_rlm_t rlm_smtp = { .thread_detach = mod_thread_detach, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, - .method_env = &method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &auth_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &auth_env }, + { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, .method_env = &method_env }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index 3046186dac9..06e57ed1cc8 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -162,8 +162,8 @@ module_rlm_t rlm_sometimes = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sometimes_reply }, - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_sometimes_packet }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sometimes_reply }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_sometimes_packet }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 10298f1b22c..6f3007ef786 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -1998,15 +1998,11 @@ module_rlm_t rlm_sql = { /* * Hack to support old configurations */ - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &authorize_method_env }, - - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &authorize_method_env }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, - .method_env = &accounting_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, - .method_env = &send_method_env }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &accounting_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &send_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index d68c28ec7fd..83ce70c732d 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -585,8 +585,7 @@ module_rlm_t rlm_sqlcounter = { .instantiate = mod_instantiate, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, - .method_env = &sqlcounter_call_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &sqlcounter_call_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c index 08d572cf702..f4666eafa30 100644 --- a/src/modules/rlm_sqlippool/rlm_sqlippool.c +++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c @@ -714,60 +714,39 @@ module_rlm_t rlm_sqlippool = { /* * RADIUS specific */ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, - .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("accounting", "start"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("accounting", "alive"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("accounting", "stop"), .method = mod_common, - .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_common, - .method_env = &sqlippool_bulk_release_method_env }, - { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_common, - .method_env = &sqlippool_bulk_release_method_env }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("accounting", "start"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("accounting", "alive"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("accounting", "stop"), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, + { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, /* * DHCPv4 */ - { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, - .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("recv", "Request"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Release"), .method = mod_common, - .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, - .method_env = &sqlippool_mark_method_env }, + { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("recv", "Request"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Release"), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, .method_env = &sqlippool_mark_method_env }, /* * Generic */ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, - .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY),.method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, /* * Named methods matching module operations */ - { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc, - .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_bulk_release_method_env }, - { .section = SECTION_NAME("mark", CF_IDENT_ANY), .method = mod_common, - .method_env = &sqlippool_mark_method_env }, + { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("update", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("renew", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("release", NULL), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("bulk-release", NULL), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, + { .section = SECTION_NAME("mark", NULL),.method = mod_common,.method_env = &sqlippool_mark_method_env }, MODULE_BINDING_TERMINATOR } diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index 4d0f78db79f..b7ec90dacc7 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -459,7 +459,7 @@ module_rlm_t rlm_stats = { .thread_detach = mod_thread_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_tacacs/rlm_tacacs.c b/src/modules/rlm_tacacs/rlm_tacacs.c index 9ea0f6c2f53..d49e02d45ed 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs.c +++ b/src/modules/rlm_tacacs/rlm_tacacs.c @@ -265,7 +265,7 @@ module_rlm_t rlm_tacacs = { .instantiate = mod_instantiate, }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, MODULE_BINDING_TERMINATOR }, }; diff --git a/src/modules/rlm_test/rlm_test.c b/src/modules/rlm_test/rlm_test.c index ba3f1354ec4..369ca2a7589 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -529,17 +529,18 @@ module_rlm_t rlm_test = { .thread_detach = mod_thread_detach }, .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("name1_null", NULL), .method = mod_return }, + + { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return }, { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return }, - { .section = SECTION_NAME("name1_null", NULL), .method = mod_return }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return }, { .section = SECTION_NAME("retry", NULL), .method = mod_retry }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return }, MODULE_BINDING_TERMINATOR } diff --git a/src/modules/rlm_totp/rlm_totp.c b/src/modules/rlm_totp/rlm_totp.c index 4946b442eb6..52c2471d6a4 100644 --- a/src/modules/rlm_totp/rlm_totp.c +++ b/src/modules/rlm_totp/rlm_totp.c @@ -182,7 +182,7 @@ module_rlm_t rlm_totp = { .instantiate = mod_instantiate }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_unix/rlm_unix.c b/src/modules/rlm_unix/rlm_unix.c index a1762977dd0..f7f19a154f1 100644 --- a/src/modules/rlm_unix/rlm_unix.c +++ b/src/modules/rlm_unix/rlm_unix.c @@ -561,9 +561,9 @@ module_rlm_t rlm_unix = { .bootstrap = mod_bootstrap }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, - { .section = SECTION_NAME("send", "accounting-response"), .method = mod_accounting }, /* Backwards compatibility */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, + { .section = SECTION_NAME("send", "accounting-response"), .method = mod_accounting }, /* Backwards compatibility */ MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_wimax/rlm_wimax.c b/src/modules/rlm_wimax/rlm_wimax.c index 1343e422d25..46e4a1933ef 100644 --- a/src/modules/rlm_wimax/rlm_wimax.c +++ b/src/modules/rlm_wimax/rlm_wimax.c @@ -461,9 +461,9 @@ module_rlm_t rlm_wimax = { .config = module_config, }, .bindings = (module_method_binding_t[]){ - { .proto = &dict_radius, .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .proto = &dict_radius, .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .proto = &dict_radius, .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_winbind/rlm_winbind.c b/src/modules/rlm_winbind/rlm_winbind.c index 09e03f08a86..f878efc418c 100644 --- a/src/modules/rlm_winbind/rlm_winbind.c +++ b/src/modules/rlm_winbind/rlm_winbind.c @@ -578,10 +578,8 @@ module_rlm_t rlm_winbind = { .detach = mod_detach }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, - .method_env = &winbind_autz_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, - .method_env = &winbind_auth_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_method_env }, MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_yubikey/rlm_yubikey.c b/src/modules/rlm_yubikey/rlm_yubikey.c index 42c71a6117a..c55462d0bd5 100644 --- a/src/modules/rlm_yubikey/rlm_yubikey.c +++ b/src/modules/rlm_yubikey/rlm_yubikey.c @@ -469,8 +469,8 @@ module_rlm_t rlm_yubikey = { #endif }, .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, MODULE_BINDING_TERMINATOR } };