diff --git a/src/lib/server/module.h b/src/lib/server/module.h index 2971ed41186d..d15ecc6ae885 100644 --- a/src/lib/server/module.h +++ b/src/lib/server/module.h @@ -32,7 +32,7 @@ extern "C" { typedef struct module_s module_t; typedef struct module_state_func_table_s module_state_func_table_t; -typedef struct module_method_name_s module_method_name_t; +typedef struct module_method_binding_s module_method_binding_t; typedef struct module_instance_s module_instance_t; typedef struct module_thread_instance_s module_thread_instance_t; typedef struct module_list_type_s module_list_type_t; @@ -129,6 +129,7 @@ typedef int (*module_thread_detach_t)(module_thread_inst_ctx_t const *mctx); #include #include #include +#include #include #include @@ -144,18 +145,21 @@ extern "C" { */ #define MODULE_INSTANCE_LEN_MAX 256 +/** Terminate a module binding list + */ +#define MODULE_BINDING_TERMINATOR { .section = NULL } + /** Named methods exported by a module * */ -struct module_method_name_s { - char const *name1; //!< i.e. "recv", "send", "process" - char const *name2; //!< The packet type i.e Access-Request, Access-Reject. +struct module_method_binding_s { + fr_dict_t const **proto; //!< Only allow this method to be called in this namespace. - module_method_t method; //!< Module method to call - call_env_method_t const * const method_env; //!< Call specific conf parsing. -}; + section_name_t const *section; //!< Identifier for a section. -#define MODULE_NAME_TERMINATOR { NULL } + module_method_t method; //!< Module method to call + call_env_method_t const * const method_env; //!< Call specific conf parsing. +}; /** Struct exported by a rlm_* module * diff --git a/src/lib/server/module_method.c b/src/lib/server/module_method.c index 8c3c3e27faf2..8aa2667e4130 100644 --- a/src/lib/server/module_method.c +++ b/src/lib/server/module_method.c @@ -18,7 +18,7 @@ * $Id$ * * @file src/lib/server/module_method.c - * @brief Central module_method_name_t definitions + * @brief Central module_method_binding_t definitions * * This file contains common module_method_t structures which may be * referenced within a #virtual_server_compile_t and a #module_t. @@ -33,33 +33,24 @@ * * @copyright 2022 Arran Cudbard-Bell (a.cudbardb@freeradius.org) */ -typedef struct { - fr_dict_t const **proto; //!< If none-null, restrict matches to this protocol. - ///< i.e. if both the virtual server module_method_name - ///< and the module method have non-null proto pointers - ///< then *proto must be equal for the method name to - ///< match. +#include - char const *name1; //!< module method name1 which is allowed in this section - char const *name2; //!< module method name2 which is allowed in this section -} module_method_name_t; - -module_method_name_t module_method_ippool_allocate = { +section_name_t module_method_ippool_allocate = { .name1 = "ippool", .name2 = "allocate" }; -module_method_name_t module_method_ippool_extend = { +section_name_t module_method_ippool_extend = { .name1 = "ippool", .name2 = "extend" }; -module_method_name_t module_method_ippool_mark = { +section_name_t module_method_ippool_mark = { .name1 = "ippool", .name2 = "mark" }; -module_method_name_t module_method_ippool_release = { +section_name_t module_method_ippool_release = { .name1 = "ippool", .name2 = "release" }; diff --git a/src/lib/server/module_method.h b/src/lib/server/module_method.h index 3d0b1c4e42aa..5b69f481bb40 100644 --- a/src/lib/server/module_method.h +++ b/src/lib/server/module_method.h @@ -29,36 +29,15 @@ RCSIDH(module_method_h, "$Id$") extern "C" { #endif -#include +#include -/** Specifies a module method identifier - * - * These are used in module definitions and by virtual servers to find mutually - * acceptable module methods to call between a virtual server section and the - * module that's calling it. - * - * For example, a `send Access-Accept` compilation structure may also have a - * `ippool alloc` method associated with it, to instruct any ippool modules to - * allocate an IP address. - */ -typedef struct { - fr_dict_t const **proto; //!< If none-null, restrict matches to this protocol. - ///< i.e. if both the virtual server module_method_name - ///< and the module method have non-null proto pointers - ///< then *proto must be equal for the method name to - ///< match. - - char const *name1; //!< module method name1 which is allowed in this section - char const *name2; //!< module method name2 which is allowed in this section -} module_method_name_t; - -extern module_method_name_t module_method_ippool_allocate; +extern section_name_t module_method_ippool_allocate; -extern module_method_name_t module_method_ippool_extend; +extern section_name_t module_method_ippool_extend; -extern module_method_name_t module_method_ippool_mark; +extern section_name_t module_method_ippool_mark; -extern module_method_name_t module_method_ippool_release; +extern section_name_t module_method_ippool_release; #ifdef __cplusplus } diff --git a/src/lib/server/module_rlm.c b/src/lib/server/module_rlm.c index 2782312ffd6b..ee1ee1b5d3b7 100644 --- a/src/lib/server/module_rlm.c +++ b/src/lib/server/module_rlm.c @@ -448,7 +448,7 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e size_t len; int j; module_instance_t *mi; - module_method_name_t const *methods; + module_method_binding_t const *methods; char const *method_name1, *method_name2; module_rlm_t const *mrlm; @@ -470,7 +470,7 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e */ mi = module_rlm_static_by_name(NULL, name); if (mi) { - virtual_server_method_t const *allowed_list; + section_name_t const **allowed_list; if (!method) return mi; @@ -481,20 +481,20 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e * module has no named methods. Try to return a * method based on the component. */ - if (!method_name1 || !mrlm->method_names) goto return_component; + if (!method_name1 || !mrlm->bindings) goto return_component; /* * Walk through the module, finding a matching * method. */ - for (j = 0; mrlm->method_names[j].name1 != NULL; j++) { - methods = &mrlm->method_names[j]; + for (j = 0; mrlm->bindings[j].section; j++) { + methods = &mrlm->bindings[j]; /* * Wildcard match name1, we're * done. */ - if (methods->name1 == CF_IDENT_ANY) { + if (methods->section->name1 == CF_IDENT_ANY) { found: *method = methods->method; if (method_env) *method_env = methods->method_env; @@ -506,26 +506,26 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e /* * If name1 doesn't match, skip it. */ - if (strcasecmp(methods->name1, method_name1) != 0) continue; + if (strcasecmp(methods->section->name1, method_name1) != 0) continue; /* * The module can declare a * wildcard for name2, in which * case it's a match. */ - if (methods->name2 == CF_IDENT_ANY) goto found; + if (methods->section->name2 == CF_IDENT_ANY) goto found; /* * No name2 is also a match to no name2. */ - if (!methods->name2 && !method_name2) goto found; + if (!methods->section->name2 && !method_name2) goto found; /* * Don't do strcmp on NULLs */ - if (!methods->name2 || !method_name2) continue; + if (!methods->section->name2 || !method_name2) continue; - if (strcasecmp(methods->name2, method_name2) == 0) goto found; + if (strcasecmp(methods->section->name2, method_name2) == 0) goto found; } if (!vs) goto skip_section_method; @@ -558,22 +558,22 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e * then any module method would match, which is * bad. */ - for (j = 0; allowed_list[j].name1 != NULL; j++) { + for (j = 0; allowed_list[j]; j++) { int k; - virtual_server_method_t const *allowed = &allowed_list[j]; + section_name_t const *allowed = allowed_list[j]; - for (k = 0; mrlm->method_names[k].name1 != NULL; k++) { - methods = &mrlm->method_names[k]; + for (k = 0; mrlm->bindings[k].section; k++) { + methods = &mrlm->bindings[k]; - fr_assert(methods->name1 != CF_IDENT_ANY); /* should have been caught above */ + fr_assert(methods->section->name1 != CF_IDENT_ANY); /* should have been caught above */ - if (strcasecmp(methods->name1, allowed->name1) != 0) continue; + if (strcasecmp(methods->section->name1, allowed->name1) != 0) continue; /* * The module matches "recv *", * call this method. */ - if (methods->name2 == CF_IDENT_ANY) { + if (methods->section->name2 == CF_IDENT_ANY) { found_allowed: *method = methods->method; return mi; @@ -582,14 +582,14 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e /* * No name2 is also a match to no name2. */ - if (!methods->name2 && !allowed->name2) goto found_allowed; + if (!methods->section->name2 && !allowed->name2) goto found_allowed; /* * Don't do strcasecmp on NULLs */ - if (!methods->name2 || !allowed->name2) continue; + if (!methods->section->name2 || !allowed->name2) continue; - if (strcasecmp(methods->name2, allowed->name2) == 0) goto found_allowed; + if (strcasecmp(methods->section->name2, allowed->name2) == 0) goto found_allowed; } } @@ -663,7 +663,7 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e /* * We've found the module, but it has no named methods. */ - if (!mrlm->method_names) { + if (!mrlm->bindings) { *name1 = name + (p - inst_name); *name2 = NULL; goto finish; @@ -675,24 +675,24 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e * matches anything else. */ if (!q) { - for (j = 0; mrlm->method_names[j].name1 != NULL; j++) { - methods = &mrlm->method_names[j]; + for (j = 0; mrlm->bindings[j].section; j++) { + methods = &mrlm->bindings[j]; /* * If we do not have the second $method, then ignore it! */ - if (methods->name2 && (methods->name2 != CF_IDENT_ANY)) continue; + if (methods->section->name2 && (methods->section->name2 != CF_IDENT_ANY)) continue; /* * Wildcard match name1, we're * done. */ - if (!methods->name1 || (methods->name1 == CF_IDENT_ANY)) goto found_name1; + if (!methods->section->name1 || (methods->section->name1 == CF_IDENT_ANY)) goto found_name1; /* * If name1 doesn't match, skip it. */ - if (strcasecmp(methods->name1, p) != 0) continue; + if (strcasecmp(methods->section->name1, p) != 0) continue; found_name1: /* @@ -729,41 +729,41 @@ module_instance_t *module_rlm_by_name_and_method(module_method_t *method, call_e * * Loop over the method names, seeing if we have a match. */ - for (j = 0; mrlm->method_names[j].name1 != NULL; j++) { - methods = &mrlm->method_names[j]; + for (j = 0; mrlm->bindings[j].section; j++) { + methods = &mrlm->bindings[j]; /* * If name1 doesn't match, skip it. */ - if (strncasecmp(methods->name1, p, len) != 0) continue; + if (strncasecmp(methods->section->name1, p, len) != 0) continue; /* * It may have been a partial match, like "rec", * instead of "recv". In which case check if it * was a FULL match. */ - if (strlen(methods->name1) != len) continue; + if (strlen(methods->section->name1) != len) continue; /* * The module can declare a * wildcard for name2, in which * case it's a match. */ - if (!methods->name2 || (methods->name2 == CF_IDENT_ANY)) goto found_name2; + if (!methods->section->name2 || (methods->section->name2 == CF_IDENT_ANY)) goto found_name2; /* * Don't do strcmp on NULLs */ - if (!methods->name2) continue; + if (!methods->section->name2) continue; - if (strcasecmp(methods->name2, q) != 0) continue; + if (strcasecmp(methods->section->name2, q) != 0) continue; found_name2: /* * Update name1/name2 with the methods * that were found. */ - *name1 = methods->name1; + *name1 = methods->section->name1; *name2 = name + (q - inst_name); *method = methods->method; if (method_env) *method_env = methods->method_env; diff --git a/src/lib/server/module_rlm.h b/src/lib/server/module_rlm.h index c6d44802ecd1..221960141e3f 100644 --- a/src/lib/server/module_rlm.h +++ b/src/lib/server/module_rlm.h @@ -34,8 +34,7 @@ extern "C" { typedef struct { module_t common; //!< Common fields presented by all modules. - module_method_name_t const *method_names; //!< named methods - fr_dict_t const **dict; //!< pointer to local fr_dict_t* + module_method_binding_t const *bindings; //!< named methods } module_rlm_t; /** Cast a module_t to a module_rlm_t diff --git a/src/lib/server/process.h b/src/lib/server/process.h index 22311f3b8794..fbc25f14ffc5 100644 --- a/src/lib/server/process.h +++ b/src/lib/server/process.h @@ -467,20 +467,17 @@ static inline unlang_action_t new_client(rlm_rcode_t *p_result, module_ctx_t con #define DYNAMIC_CLIENT_SECTIONS \ { \ - .name1 = "new", \ - .name2 = "client", \ + .section = SECTION_NAME("new", "client"), \ .actions = &mod_actions_authorize, \ .offset = PROCESS_CONF_OFFSET(new_client), \ }, \ { \ - .name1 = "add", \ - .name2 = "client", \ + .section = SECTION_NAME("add", "client"), \ .actions = &mod_actions_authorize, \ .offset = PROCESS_CONF_OFFSET(add_client), \ }, \ { \ - .name1 = "deny", \ - .name2 = "client", \ + .section = SECTION_NAME("deny", "client"), \ .actions = &mod_actions_authorize, \ .offset = PROCESS_CONF_OFFSET(deny_client), \ } diff --git a/src/lib/server/section.h b/src/lib/server/section.h new file mode 100644 index 000000000000..14cc91fddc66 --- /dev/null +++ b/src/lib/server/section.h @@ -0,0 +1,48 @@ +#pragma once +/* + * 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.h + * @brief Structures which identify sections + * + * @copyright 2024 Arran Cudbard-Bell (a.cudbardb@freeradius.org) + */ +RCSIDH(section_h, "$Id$") + +#ifdef __cplusplus +extern "C" { +#endif + +/** Define a section name consisting of a verb and a noun + * + * @param[in] _name1 verb name. + * @param[in] _name2 noun name. + */ +#define SECTION_NAME(_name1, _name2) &(section_name_t){ .name1 = _name1, .name2 = _name2 } + +/** Section name identifier + */ +typedef struct { + char const *name1; //!< First section name. Usually a verb like 'recv', 'send', etc... + char const *name2; //!< Second section name. Usually a packet type like 'access-request', 'access-accept', etc... +} section_name_t; + +#ifdef __cplusplus +} +#endif diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 1ff92d94dd86..d51403d093db 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -308,12 +308,12 @@ int add_compile_list(virtual_server_t *vs, CONF_SECTION *cs, virtual_server_comp if (!compile_list) return 0; - for (i = 0; list[i].name1 != NULL; i++) { - if (list[i].name1 == CF_IDENT_ANY) continue; + for (i = 0; list[i].section; i++) { + if (list[i].section->name1 == CF_IDENT_ANY) continue; if (virtual_server_section_register(vs, &list[i]) < 0) { cf_log_err(cs, "Failed registering processing section name %s for %s", - list[i].name1, name); + list[i].section->name1, name); return -1; } } @@ -912,7 +912,7 @@ int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t con * looks. It's not O(n^2), but O(n logn). But it could * still be improved. */ - for (i = 0; list[i].name1 != NULL; i++) { + for (i = 0; list[i].section; i++) { int rcode; CONF_SECTION *bad; @@ -921,13 +921,13 @@ int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t con * Warn if it isn't found, or compile it if * found. */ - if (list[i].name2 != CF_IDENT_ANY) { + if (list[i].section->name2 != CF_IDENT_ANY) { void *instruction = NULL; - subcs = cf_section_find(server, list[i].name1, list[i].name2); + subcs = cf_section_find(server, list[i].section->name1, list[i].section->name2); if (!subcs) { DEBUG3("Warning: Skipping %s %s { ... } as it was not found.", - list[i].name1, list[i].name2); + list[i].section->name1, list[i].section->name2); /* * Initialise CONF_SECTION pointer for missing section */ @@ -940,7 +940,7 @@ int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t con /* * Duplicate sections are forbidden. */ - bad = cf_section_find_next(server, subcs, list[i].name1, list[i].name2); + bad = cf_section_find_next(server, subcs, list[i].section->name1, list[i].section->name2); if (bad) { forbidden: cf_log_err(bad, "Duplicate sections are forbidden."); @@ -978,19 +978,19 @@ int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t con * Find all subsections with the given first name * and compile them. */ - while ((subcs = cf_section_find_next(server, subcs, list[i].name1, CF_IDENT_ANY))) { + while ((subcs = cf_section_find_next(server, subcs, list[i].section->name1, CF_IDENT_ANY))) { char const *name2; name2 = cf_section_name2(subcs); if (!name2) { - cf_log_err(subcs, "Invalid '%s { ... }' section, it must have a name", list[i].name1); + cf_log_err(subcs, "Invalid '%s { ... }' section, it must have a name", list[i].section->name1); return -1; } /* * Duplicate sections are forbidden. */ - bad = cf_section_find_next(server, subcs, list[i].name1, name2); + bad = cf_section_find_next(server, subcs, list[i].section->name1, name2); if (bad) goto forbidden; rcode = unlang_compile(vs, subcs, list[i].actions, rules, NULL); @@ -1016,15 +1016,15 @@ static int8_t server_section_name_cmp(void const *one, void const *two) virtual_server_compile_t const *b = two; int ret; - ret = strcmp(a->name1, b->name1); + ret = strcmp(a->section->name1, b->section->name1); ret = CMP(ret, 0); if (ret != 0) return ret; - if (a->name2 == b->name2) return 0; - if ((a->name2 == CF_IDENT_ANY) && (b->name2 != CF_IDENT_ANY)) return -1; - if ((a->name2 != CF_IDENT_ANY) && (b->name2 == CF_IDENT_ANY)) return +1; + if (a->section->name2 == b->section->name2) return 0; + if ((a->section->name2 == CF_IDENT_ANY) && (b->section->name2 != CF_IDENT_ANY)) return -1; + if ((a->section->name2 != CF_IDENT_ANY) && (b->section->name2 == CF_IDENT_ANY)) return +1; - ret = strcmp(a->name2, b->name2); + ret = strcmp(a->section->name2, b->section->name2); return CMP(ret, 0); } @@ -1052,15 +1052,15 @@ int virtual_server_section_register(virtual_server_t *vs, virtual_server_compile if (entry->methods) { int i; - for (i = 0; entry->methods[i].name1 != NULL; i++) { - if (entry->methods[i].name1 == CF_IDENT_ANY) { + for (i = 0; entry->methods[i]; i++) { + if (entry->methods[i]->name1 == CF_IDENT_ANY) { ERROR("Processing sections cannot allow \"*\""); return -1; } - if (entry->methods[i].name2 == CF_IDENT_ANY) { + if (entry->methods[i]->name2 == CF_IDENT_ANY) { ERROR("Processing sections cannot allow \"%s *\"", - entry->methods[i].name1); + entry->methods[i]->name1); return -1; } } @@ -1078,7 +1078,7 @@ int virtual_server_section_register(virtual_server_t *vs, virtual_server_compile /** Find the component for a section * */ -virtual_server_method_t const *virtual_server_section_methods(virtual_server_t const *vs, char const *name1, char const *name2) +section_name_t const **virtual_server_section_methods(virtual_server_t const *vs, char const *name1, char const *name2) { virtual_server_compile_t *entry; @@ -1089,8 +1089,7 @@ virtual_server_method_t const *virtual_server_section_methods(virtual_server_t c if (name2 != CF_IDENT_ANY) { entry = fr_rb_find(vs->sections, &(virtual_server_compile_t) { - .name1 = name1, - .name2 = name2, + .section = SECTION_NAME(name1, name2) }); if (entry) return entry->methods; } @@ -1100,8 +1099,7 @@ virtual_server_method_t const *virtual_server_section_methods(virtual_server_t c */ entry = fr_rb_find(vs->sections, &(virtual_server_compile_t) { - .name1 = name1, - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME(name1, CF_IDENT_ANY) }); if (!entry) return NULL; diff --git a/src/lib/server/virtual_servers.h b/src/lib/server/virtual_servers.h index 9a19ad13dfe9..7c9d570c6bca 100644 --- a/src/lib/server/virtual_servers.h +++ b/src/lib/server/virtual_servers.h @@ -94,36 +94,27 @@ int virtual_server_cf_parse(TALLOC_CTX *ctx, void *out, void *parent, fr_listen_t * listen_find_any(fr_listen_t *li) CC_HINT(nonnull); bool listen_record(fr_listen_t *li) CC_HINT(nonnull); - -/** Module methods which are allowed in virtual servers. - * - */ -typedef struct { - char const *name1; //!< module method name1 which is allowed in this section - char const *name2; //!< module method name2 which is allowed in this section -} virtual_server_method_t; - /** Processing sections which are allowed in this virtual server. * */ typedef struct { - char const *name1; //!< Name of the processing section, such as "recv" or "send" - char const *name2; //!< Second name, such as "Access-Request" - size_t offset; //!< where the CONF_SECTION pointer is written - bool dont_cache; //!< If true, the CONF_SECTION pointer won't be written - ///< and the offset will be ignored. - size_t instruction; //!< where the instruction pointer is written - unlang_mod_actions_t const *actions; //!< Default actions for this section. - virtual_server_method_t const *methods; //!< list of module methods which are allowed in this section + section_name_t const *section; //!< Identifier for the section. + size_t offset; //!< where the CONF_SECTION pointer is written + bool dont_cache; //!< If true, the CONF_SECTION pointer won't be written + ///< and the offset will be ignored. + size_t instruction; //!< where the instruction pointer is written + unlang_mod_actions_t const *actions; //!< Default actions for this section. + section_name_t const **methods; //!< list of auxilliary module methods which are allowed in + ///< if the main name doesn't match. } virtual_server_compile_t; -#define COMPILE_TERMINATOR { .name1 = NULL, .name2 = NULL } +#define COMPILE_TERMINATOR { .section = NULL } int virtual_server_section_register(virtual_server_t *vs, virtual_server_compile_t const *entry) CC_HINT(nonnull); int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t const *rules) CC_HINT(nonnull); -virtual_server_method_t const *virtual_server_section_methods(virtual_server_t const *vs, char const *name1, char const *name2) CC_HINT(nonnull(1)); +section_name_t const **virtual_server_section_methods(virtual_server_t const *vs, char const *name1, char const *name2) CC_HINT(nonnull(1)); unlang_action_t virtual_server_push(request_t *request, CONF_SECTION *server_cs, bool top_frame) CC_HINT(nonnull); diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 747830934584..e1137a0cf5b6 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -4424,23 +4424,9 @@ static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci, module_instance_t *inst, module_method_t method, call_env_method_t const *method_env, char const *realname) { - module_rlm_t const *mrlm = module_rlm_from_module(inst->exported); unlang_t *c; unlang_module_t *single; - /* - * Can't use "chap" in "dhcp". - */ - if (mrlm->dict && *mrlm->dict && unlang_ctx->rules && unlang_ctx->rules->attr.dict_def && - (unlang_ctx->rules->attr.dict_def != fr_dict_internal()) && - !fr_dict_compatible(*(mrlm->dict), unlang_ctx->rules->attr.dict_def)) { - cf_log_err(ci, "The \"%s\" module can only be used with 'namespace = %s'. It cannot be used with 'namespace = %s'.", - inst->module->exported->name, - fr_dict_root(*mrlm->dict)->name, - fr_dict_root(unlang_ctx->rules->attr.dict_def)->name); - return NULL; - } - /* * Check if the module in question has the necessary * component. diff --git a/src/lib/unlang/module.h b/src/lib/unlang/module.h index 929f3725556d..c7f7a72cea7a 100644 --- a/src/lib/unlang/module.h +++ b/src/lib/unlang/module.h @@ -30,6 +30,7 @@ extern "C" { #endif +#include #include #include #include diff --git a/src/modules/rlm_always/rlm_always.c b/src/modules/rlm_always/rlm_always.c index 03e2887f6639..a80f04cc02bd 100644 --- a/src/modules/rlm_always/rlm_always.c +++ b/src/modules/rlm_always/rlm_always.c @@ -191,8 +191,8 @@ module_rlm_t rlm_always = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_always_return }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_always_return }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index bfccfcd1d0a9..df3c6da5e40c 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -380,16 +380,16 @@ module_rlm_t rlm_attr_filter = { .config = module_config, .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + { .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 3a7cb076bc54..235a1c31d382 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -1516,14 +1516,14 @@ module_rlm_t rlm_cache = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "status", .name2 = CF_IDENT_ANY, .method = mod_method_status, .method_env = &cache_method_env }, - { .name1 = "load", .name2 = CF_IDENT_ANY, .method = mod_method_load, .method_env = &cache_method_env }, - { .name1 = "update", .name2 = CF_IDENT_ANY, .method = mod_method_update, .method_env = &cache_method_env }, - { .name1 = "store", .name2 = CF_IDENT_ANY, .method = mod_method_store, .method_env = &cache_method_env }, - { .name1 = "clear", .name2 = CF_IDENT_ANY, .method = mod_method_clear, .method_env = &cache_method_env }, - { .name1 = "ttl", .name2 = CF_IDENT_ANY, .method = mod_method_ttl, .method_env = &cache_method_env }, - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_cache_it, .method_env = &cache_method_env }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .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("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(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 7db176f6316d..334d0a2d1bad 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -388,11 +388,11 @@ module_rlm_t rlm_chap = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "access-request", .method = mod_authorize, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize, .method_env = &chap_autz_method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &chap_auth_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index 6f91236ca10b..3db525376b21 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -385,8 +385,8 @@ module_rlm_t rlm_client = { .onload = mod_load, .unload = mod_unload }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_authorize }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_couchbase/rlm_couchbase.c b/src/modules/rlm_couchbase/rlm_couchbase.c index 67f739196158..a3240e4fdb4e 100644 --- a/src/modules/rlm_couchbase/rlm_couchbase.c +++ b/src/modules/rlm_couchbase/rlm_couchbase.c @@ -555,9 +555,9 @@ module_rlm_t rlm_couchbase = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_csv/rlm_csv.c b/src/modules/rlm_csv/rlm_csv.c index d5e7de9a2717..b6542d2194b3 100644 --- a/src/modules/rlm_csv/rlm_csv.c +++ b/src/modules/rlm_csv/rlm_csv.c @@ -1058,8 +1058,8 @@ module_rlm_t rlm_csv = { .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_process }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_delay/rlm_delay.c b/src/modules/rlm_delay/rlm_delay.c index c15b3e12e8da..d37ec641b7ca 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -279,8 +279,8 @@ module_rlm_t rlm_delay = { .config = module_config, .bootstrap = mod_bootstrap }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_delay }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_delay }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 4fce50280fad..1cc1b8b72cb5 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -508,15 +508,15 @@ module_rlm_t rlm_detail = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "accounting-request", .method = mod_accounting, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &method_env }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &method_env }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index 8a0bbe6c8a30..bb3b065e3f92 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -333,8 +333,8 @@ module_rlm_t rlm_dhcpv4 = { .thread_inst_type = "rlm_dhcpv4_thread_t", .thread_instantiate = mod_thread_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_process }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, + MODULE_BINDING_TERMINATOR }, }; diff --git a/src/modules/rlm_digest/rlm_digest.c b/src/modules/rlm_digest/rlm_digest.c index cc714a31808f..e832859ba147 100644 --- a/src/modules/rlm_digest/rlm_digest.c +++ b/src/modules/rlm_digest/rlm_digest.c @@ -480,10 +480,9 @@ module_rlm_t rlm_digest = { .inst_size = sizeof(rlm_digest_t), .instantiate = mod_instantiate, }, - .dict = &dict_radius, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "access-request", .method = mod_authorize }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR }, }; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index f5361020acdf..ded2843ebd14 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -1196,10 +1196,10 @@ module_rlm_t rlm_eap = { .unload = mod_unload, .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "access-request", .method = mod_authorize }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index a2eca0836593..7cbe9ab59cbe 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -531,9 +531,9 @@ module_rlm_t rlm_exec = { .bootstrap = mod_bootstrap, .instantiate = mob_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_exec_dispatch_oneshot, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot, .method_env = &exec_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index bdc7379f8ac8..61e81d95e241 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -675,10 +675,10 @@ module_rlm_t rlm_files = { .inst_size = sizeof(rlm_files_t), .config = module_config, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_files, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, .method_env = &method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_imap/rlm_imap.c b/src/modules/rlm_imap/rlm_imap.c index 9d0b6318e481..86b9344c09a2 100644 --- a/src/modules/rlm_imap/rlm_imap.c +++ b/src/modules/rlm_imap/rlm_imap.c @@ -292,8 +292,8 @@ module_rlm_t rlm_imap = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .method_names = (module_method_name_t[]){ - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 bd98b393bed7..a1677232768f 100644 --- a/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c +++ b/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c @@ -2240,9 +2240,9 @@ module_rlm_t rlm_isc_dhcp = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_krb5/rlm_krb5.c b/src/modules/rlm_krb5/rlm_krb5.c index 29fb67184f99..720975fed2a9 100644 --- a/src/modules/rlm_krb5/rlm_krb5.c +++ b/src/modules/rlm_krb5/rlm_krb5.c @@ -504,8 +504,8 @@ module_rlm_t rlm_krb5 = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 49e631f1bc96..150272bc3eff 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -2730,21 +2730,21 @@ module_rlm_t rlm_ldap = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &usermod_method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &authenticate_method_env }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &usermod_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c index cb1a017c601f..a76b2dd4f754 100644 --- a/src/modules/rlm_linelog/rlm_linelog.c +++ b/src/modules/rlm_linelog/rlm_linelog.c @@ -1061,8 +1061,8 @@ module_rlm_t rlm_linelog = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_do_linelog, .method_env = &linelog_method_env }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_do_linelog, .method_env = &linelog_method_env }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_logtee/rlm_logtee.c b/src/modules/rlm_logtee/rlm_logtee.c index 4fd7ac90f714..ac69954b40a1 100644 --- a/src/modules/rlm_logtee/rlm_logtee.c +++ b/src/modules/rlm_logtee/rlm_logtee.c @@ -665,8 +665,8 @@ module_rlm_t rlm_logtee = { .instantiate = mod_instantiate, .thread_instantiate = mod_thread_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_insert_logtee }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_insert_logtee }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_lua/rlm_lua.c b/src/modules/rlm_lua/rlm_lua.c index d0eacde4f263..c1c3ec2b86c7 100644 --- a/src/modules/rlm_lua/rlm_lua.c +++ b/src/modules/rlm_lua/rlm_lua.c @@ -180,17 +180,17 @@ module_rlm_t rlm_lua = { .detach = mod_detach, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + { .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_mruby/rlm_mruby.c b/src/modules/rlm_mruby/rlm_mruby.c index 27c4b62c1126..e5181373badb 100644 --- a/src/modules/rlm_mruby/rlm_mruby.c +++ b/src/modules/rlm_mruby/rlm_mruby.c @@ -517,17 +517,17 @@ module_rlm_t rlm_mruby = { .instantiate = mod_instantiate, .detach = mod_detach, }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + { .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index ce8fa3e3d487..cb060f0e3a76 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -2527,11 +2527,11 @@ module_rlm_t rlm_mschap = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &mschap_autz_method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &mschap_auth_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_opendirectory/rlm_opendirectory.c b/src/modules/rlm_opendirectory/rlm_opendirectory.c index 255992fb65d9..a75f02ced2df 100644 --- a/src/modules/rlm_opendirectory/rlm_opendirectory.c +++ b/src/modules/rlm_opendirectory/rlm_opendirectory.c @@ -536,9 +536,9 @@ module_rlm_t rlm_opendirectory = { .inst_size = sizeof(rlm_opendirectory_t), .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_pam/rlm_pam.c b/src/modules/rlm_pam/rlm_pam.c index e3c8d069b4d3..83bb4a55bfc7 100644 --- a/src/modules/rlm_pam/rlm_pam.c +++ b/src/modules/rlm_pam/rlm_pam.c @@ -277,8 +277,8 @@ module_rlm_t rlm_pam = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 bc7abd5c76cf..085aa02324a5 100644 --- a/src/modules/rlm_pap/rlm_pap.c +++ b/src/modules/rlm_pap/rlm_pap.c @@ -1063,17 +1063,17 @@ module_rlm_t rlm_pap = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env }, - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index 935ba94ff7be..ac3e1a1e4074 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -616,9 +616,9 @@ module_rlm_t rlm_passwd = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_passwd_map }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map }, + MODULE_BINDING_TERMINATOR } }; #endif /* TEST */ diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index c48cfc8f5399..f87d05fb0868 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -1182,17 +1182,17 @@ module_rlm_t rlm_perl = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + { .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_python/rlm_python.c b/src/modules/rlm_python/rlm_python.c index 51710fb00378..48e65f84eaef 100644 --- a/src/modules/rlm_python/rlm_python.c +++ b/src/modules/rlm_python/rlm_python.c @@ -1182,17 +1182,17 @@ module_rlm_t rlm_python = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + { .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 86f4a78e3fb4..6a98629c201d 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -663,8 +663,8 @@ module_rlm_t rlm_radius = { .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_process }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, + MODULE_BINDING_TERMINATOR }, }; diff --git a/src/modules/rlm_radutmp/rlm_radutmp.c b/src/modules/rlm_radutmp/rlm_radutmp.c index b0174cdb0a9b..5437a15c1827 100644 --- a/src/modules/rlm_radutmp/rlm_radutmp.c +++ b/src/modules/rlm_radutmp/rlm_radutmp.c @@ -586,9 +586,9 @@ module_rlm_t rlm_radutmp = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, - MODULE_NAME_TERMINATOR + 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 74bebba45f56..217cc713f9d6 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -1291,60 +1291,60 @@ module_rlm_t rlm_redis_ippool = { .onload = mod_load, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * RADIUS specific */ - { .name1 = "recv", .name2 = "access-request", .method = mod_alloc, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, - { .name1 = "accounting", .name2 = "start", .method = mod_update, + { .section = SECTION_NAME("accounting", "start"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, - { .name1 = "accounting", .name2 = "interim-update", .method = mod_update, + { .section = SECTION_NAME("accounting", "interim-update"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, - { .name1 = "accounting", .name2 = "stop", .method = mod_release, + { .section = SECTION_NAME("accounting", "stop"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, - { .name1 = "accounting", .name2 = "accounting-on", .method = mod_bulk_release, + { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, - { .name1 = "accounting", .name2 = "accounting-off", .method = mod_bulk_release, + { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* * DHCPv4 */ - { .name1 = "recv", .name2 = "discover", .method = mod_alloc, + { .section = SECTION_NAME("recv", "discover"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, - { .name1 = "recv", .name2 = "release", .method = mod_release, + { .section = SECTION_NAME("recv", "release"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, - { .name1 = "send", .name2 = "ack", .method = mod_update, + { .section = SECTION_NAME("send", "ack"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* * DHCPv6 */ - { .name1 = "recv", .name2 = "solicit", .method = mod_alloc, + { .section = SECTION_NAME("recv", "solicit"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* * Generic */ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_update, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_alloc, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* * Named methods matching module operations */ - { .name1 = "allocate", .name2 = CF_IDENT_ANY, .method = mod_alloc, + { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, - { .name1 = "update", .name2 = CF_IDENT_ANY, .method = mod_update, + { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, - { .name1 = "renew", .name2 = CF_IDENT_ANY, .method = mod_update, + { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, - { .name1 = "release", .name2 = CF_IDENT_ANY, .method = mod_release, + { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_release, .method_env = &redis_ippool_release_method_env }, - { .name1 = "bulk-release", .name2 = CF_IDENT_ANY, .method = mod_bulk_release, + { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_rediswho/rlm_rediswho.c b/src/modules/rlm_rediswho/rlm_rediswho.c index 4139e7494315..42c19d274fb8 100644 --- a/src/modules/rlm_rediswho/rlm_rediswho.c +++ b/src/modules/rlm_rediswho/rlm_rediswho.c @@ -257,8 +257,8 @@ module_rlm_t rlm_rediswho = { .onload = mod_load, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index 0c26ea850791..3482463dcc99 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -1418,17 +1418,17 @@ module_rlm_t rlm_rest = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize, .method_env = &rest_call_env_authorize }, - - { .name1 = "recv", .name2 = "accounting-request", .method = mod_accounting, .method_env = &rest_call_env_accounting }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, .method_env = &rest_call_env_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting, .method_env = &rest_call_env_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, .method_env = &rest_call_env_authenticate }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth, .method_env = &rest_call_env_post_auth }, - MODULE_NAME_TERMINATOR + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &rest_call_env_authorize }, + + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &rest_call_env_accounting }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &rest_call_env_authorize }, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &rest_call_env_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &rest_call_env_authenticate }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &rest_call_env_post_auth }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_securid/rlm_securid.c b/src/modules/rlm_securid/rlm_securid.c index e4dad5ca7fc0..a2a597e68a58 100644 --- a/src/modules/rlm_securid/rlm_securid.c +++ b/src/modules/rlm_securid/rlm_securid.c @@ -560,8 +560,8 @@ module_rlm_t rlm_securid = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 bc1403226169..044ed5f341dc 100644 --- a/src/modules/rlm_sigtran/rlm_sigtran.c +++ b/src/modules/rlm_sigtran/rlm_sigtran.c @@ -434,8 +434,8 @@ module_rlm_t rlm_sigtran = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_authorize }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 376a522b7ab4..3fa33fe8605e 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -1050,11 +1050,11 @@ module_rlm_t rlm_smtp = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .method_names = (module_method_name_t[]){ - { .name1 = "mail", .name2 = CF_IDENT_ANY, .method = mod_mail, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, .method_env = &method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &auth_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index c0b190f22711..3046186dac90 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -161,9 +161,9 @@ module_rlm_t rlm_sometimes = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_sometimes_reply }, - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_sometimes_packet }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index a565718900d6..10298f1b22cc 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -1994,19 +1994,19 @@ module_rlm_t rlm_sql = { .instantiate = mod_instantiate, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * Hack to support old configurations */ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_sql_redundant, + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &accounting_method_env }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_sql_redundant, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &send_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index c9162239e979..d68c28ec7fdc 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -584,9 +584,9 @@ module_rlm_t rlm_sqlcounter = { .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_authorize, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &sqlcounter_call_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c index 5e4926827954..08d572cf702b 100644 --- a/src/modules/rlm_sqlippool/rlm_sqlippool.c +++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c @@ -710,66 +710,66 @@ module_rlm_t rlm_sqlippool = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ + .bindings = (module_method_binding_t[]){ /* * RADIUS specific */ - { .name1 = "recv", .name2 = "access-request", .method = mod_alloc, + { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .name1 = "accounting", .name2 = "start", .method = mod_common, + { .section = SECTION_NAME("accounting", "start"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "accounting", .name2 = "alive", .method = mod_common, + { .section = SECTION_NAME("accounting", "alive"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "accounting", .name2 = "stop", .method = mod_common, + { .section = SECTION_NAME("accounting", "stop"), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .name1 = "accounting", .name2 = "accounting-on", .method = mod_common, + { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, - { .name1 = "accounting", .name2 = "accounting-off", .method = mod_common, + { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, /* * DHCPv4 */ - { .name1 = "recv", .name2 = "Discover", .method = mod_alloc, + { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .name1 = "recv", .name2 = "Request", .method = mod_common, + { .section = SECTION_NAME("recv", "Request"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "recv", .name2 = "Confirm", .method = mod_common, + { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "recv", .name2 = "Rebind", .method = mod_common, + { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "recv", .name2 = "Renew", .method = mod_common, + { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "recv", .name2 = "Release", .method = mod_common, + { .section = SECTION_NAME("recv", "Release"), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .name1 = "recv", .name2 = "Decline", .method = mod_common, + { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, .method_env = &sqlippool_mark_method_env }, /* * Generic */ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_alloc, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, /* * Named methods matching module operations */ - { .name1 = "allocate", .name2 = CF_IDENT_ANY, .method = mod_alloc, + { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .name1 = "update", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "renew", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .name1 = "release", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .name1 = "bulk-release", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, - { .name1 = "mark", .name2 = CF_IDENT_ANY, .method = mod_common, + { .section = SECTION_NAME("mark", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_mark_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index 34ad9fb064d4..4d0f78db79fc 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -458,8 +458,8 @@ module_rlm_t rlm_stats = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_stats }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 7dfca808ff2d..9ea0f6c2f533 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs.c +++ b/src/modules/rlm_tacacs/rlm_tacacs.c @@ -264,8 +264,8 @@ module_rlm_t rlm_tacacs = { .instantiate = mod_instantiate, }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_process }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 8b889734025f..ba3f1354ec4a 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -528,19 +528,19 @@ module_rlm_t rlm_test = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize }, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, + { .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 }, - { .name1 = "recv", .name2 = "access-challenge", .method = mod_return }, - { .name1 = "name1_null", .name2 = NULL, .method = mod_return }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_return }, - { .name1 = "retry", .name2 = NULL, .method = mod_retry }, + { .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 }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_totp/rlm_totp.c b/src/modules/rlm_totp/rlm_totp.c index 8d465c466397..4946b442eb6b 100644 --- a/src/modules/rlm_totp/rlm_totp.c +++ b/src/modules/rlm_totp/rlm_totp.c @@ -181,8 +181,8 @@ module_rlm_t rlm_totp = { .config = module_config, .instantiate = mod_instantiate }, - .method_names = (module_method_name_t[]){ - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, .method_env = &method_env }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .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 c31a6eec9a6d..a1762977dd09 100644 --- a/src/modules/rlm_unix/rlm_unix.c +++ b/src/modules/rlm_unix/rlm_unix.c @@ -560,10 +560,10 @@ module_rlm_t rlm_unix = { .config = module_config, .bootstrap = mod_bootstrap }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "access-request", .method = mod_authorize }, - { .name1 = "send", .name2 = "accounting-response", .method = mod_accounting }, /* Backwards compatibility */ - { .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_utf8/rlm_utf8.c b/src/modules/rlm_utf8/rlm_utf8.c index b59086176735..969122c48f67 100644 --- a/src/modules/rlm_utf8/rlm_utf8.c +++ b/src/modules/rlm_utf8/rlm_utf8.c @@ -60,8 +60,8 @@ module_rlm_t rlm_utf8 = { .magic = MODULE_MAGIC_INIT, .name = "utf8" }, - .method_names = (module_method_name_t[]){ - { .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_utf8_clean }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_utf8_clean }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_wimax/rlm_wimax.c b/src/modules/rlm_wimax/rlm_wimax.c index cd7a285c05c7..1343e422d255 100644 --- a/src/modules/rlm_wimax/rlm_wimax.c +++ b/src/modules/rlm_wimax/rlm_wimax.c @@ -460,11 +460,10 @@ module_rlm_t rlm_wimax = { .inst_size = sizeof(rlm_wimax_t), .config = module_config, }, - .dict = &dict_radius, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct }, - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize }, - { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth }, - MODULE_NAME_TERMINATOR + .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 }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_winbind/rlm_winbind.c b/src/modules/rlm_winbind/rlm_winbind.c index 8c7d9de02baf..09e03f08a862 100644 --- a/src/modules/rlm_winbind/rlm_winbind.c +++ b/src/modules/rlm_winbind/rlm_winbind.c @@ -577,11 +577,11 @@ module_rlm_t rlm_winbind = { .bootstrap = mod_bootstrap, .detach = mod_detach }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize, + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_method_env }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env }, - MODULE_NAME_TERMINATOR + MODULE_BINDING_TERMINATOR } }; diff --git a/src/modules/rlm_yubikey/rlm_yubikey.c b/src/modules/rlm_yubikey/rlm_yubikey.c index 75cd09a56bc8..42c71a6117ad 100644 --- a/src/modules/rlm_yubikey/rlm_yubikey.c +++ b/src/modules/rlm_yubikey/rlm_yubikey.c @@ -468,9 +468,9 @@ module_rlm_t rlm_yubikey = { .detach = mod_detach, #endif }, - .method_names = (module_method_name_t[]){ - { .name1 = "recv", .name2 = "access-request", .method = mod_authorize }, - { .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate }, - MODULE_NAME_TERMINATOR + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + MODULE_BINDING_TERMINATOR } }; diff --git a/src/process/arp/base.c b/src/process/arp/base.c index 758ed62e3cad..c2b8cabf9d15 100644 --- a/src/process/arp/base.c +++ b/src/process/arp/base.c @@ -204,43 +204,35 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Request", + .section = SECTION_NAME("recv", "Request"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(request), }, { - .name1 = "send", - .name2 = "Reply", + .section = SECTION_NAME("send", "Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(reply), }, { /* we can listen for others ARP replies, too */ - .name1 = "recv", - .name2 = "Reply", + .section = SECTION_NAME("recv", "Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_reply), }, { - .name1 = "recv", - .name2 = "Reverse-Request", + .section = SECTION_NAME("recv", "Reverse-Request"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(reverse_request), }, - { - .name1 = "send", - .name2 = "Reverse-Reply", + .section = SECTION_NAME("send", "Reverse-Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(reverse_reply), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, - COMPILE_TERMINATOR }; diff --git a/src/process/bfd/base.c b/src/process/bfd/base.c index eb1b463eb94d..1e63dbf0a515 100644 --- a/src/process/bfd/base.c +++ b/src/process/bfd/base.c @@ -272,14 +272,12 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc */ #define SEND_RECV(_x, _y) \ { \ - .name1 = "recv", \ - .name2 = _x, \ + .section = SECTION_NAME("recv", _x), \ .actions = &mod_actions_postauth, \ .offset = PROCESS_CONF_OFFSET(recv_ ## _y), \ }, \ { \ - .name1 = "send", \ - .name2 = _x, \ + .section = SECTION_NAME("send", _x), \ .actions = &mod_actions_postauth, \ .offset = PROCESS_CONF_OFFSET(send_ ## _y), \ } diff --git a/src/process/dhcpv4/base.c b/src/process/dhcpv4/base.c index f2cdd091011f..104d1181c94a 100644 --- a/src/process/dhcpv4/base.c +++ b/src/process/dhcpv4/base.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -419,116 +420,91 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Discover", + .section = SECTION_NAME("recv", "Discover"), .actions = &mod_actions_postauth, - .methods = (const virtual_server_method_t[]) { - { - .name1 = "ippool", - .name2 = "allocate", - }, - COMPILE_TERMINATOR + .methods = (const section_name_t *[]) { + &module_method_ippool_allocate, + NULL }, .offset = PROCESS_CONF_OFFSET(discover), }, { - .name1 = "send", - .name2 = "Offer", + .section = SECTION_NAME("send", "Offer"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(offer), }, { - .name1 = "recv", - .name2 = "Request", + .section = SECTION_NAME("recv", "Request"), .actions = &mod_actions_postauth, - .methods = (const virtual_server_method_t[]) { - { - .name1 = "ippool", - .name2 = "extend", - }, - COMPILE_TERMINATOR + .methods = (const section_name_t *[]) { + &module_method_ippool_extend, + NULL }, .offset = PROCESS_CONF_OFFSET(request), }, { - .name1 = "send", - .name2 = "Ack", + .section = SECTION_NAME("send", "Ack"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(ack), }, { - .name1 = "send", - .name2 = "NAK", + .section = SECTION_NAME("send", "NAK"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(nak), }, { - .name1 = "recv", - .name2 = "Decline", + .section = SECTION_NAME("recv", "Decline"), .actions = &mod_actions_postauth, - .methods = (const virtual_server_method_t[]) { - { - .name1 = "ippool", - .name2 = "mark", - }, - COMPILE_TERMINATOR + .methods = (const section_name_t *[]) { + &module_method_ippool_mark, + NULL }, .offset = PROCESS_CONF_OFFSET(decline), }, { - .name1 = "recv", - .name2 = "Release", + .section = SECTION_NAME("recv", "Release"), .actions = &mod_actions_postauth, - .methods = (const virtual_server_method_t[]) { - { - .name1 = "ippool", - .name2 = "release", - }, - COMPILE_TERMINATOR + .methods = (const section_name_t *[]) { + &module_method_ippool_release, + NULL }, .offset = PROCESS_CONF_OFFSET(release), }, { - .name1 = "recv", - .name2 = "Inform", + .section = SECTION_NAME("recv", "Inform"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(inform), }, { - .name1 = "recv", - .name2 = "Lease-Query", + .section = SECTION_NAME("recv", "Lease-Query"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(lease_query), }, { - .name1 = "send", - .name2 = "Lease-Unassigned", + .section = SECTION_NAME("send", "Lease-Unassigned"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(lease_unassigned), }, { - .name1 = "send", - .name2 = "Lease-Unknown", + .section = SECTION_NAME("send", "Lease-Unknown"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(lease_unknown), }, { - .name1 = "send", - .name2 = "Lease-Active", + .section = SECTION_NAME("send", "Lease-Active"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(lease_active), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, diff --git a/src/process/dhcpv6/base.c b/src/process/dhcpv6/base.c index d457766e69db..fd2117bb6f0e 100644 --- a/src/process/dhcpv6/base.c +++ b/src/process/dhcpv6/base.c @@ -194,87 +194,73 @@ static conf_parser_t dhcpv6_process_config[] = { static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Solicit", + .section = SECTION_NAME("recv", "Solicit"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_solicit) }, { - .name1 = "recv", - .name2 = "Request", + .section = SECTION_NAME("recv", "Request"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_request) }, { - .name1 = "recv", - .name2 = "Confirm", + .section = SECTION_NAME("recv", "Confirm"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_confirm) }, { - .name1 = "recv", - .name2 = "Renew", + .section = SECTION_NAME("recv", "Renew"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_renew) }, { - .name1 = "recv", - .name2 = "Rebind", + .section = SECTION_NAME("recv", "Rebind"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_rebind) }, { - .name1 = "recv", - .name2 = "Release", + .section = SECTION_NAME("recv", "Release"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_release) }, { - .name1 = "recv", - .name2 = "Decline", + .section = SECTION_NAME("recv", "Decline"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_decline) }, { - .name1 = "recv", - .name2 = "Reconfigure", + .section = SECTION_NAME("recv", "Reconfigure"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_reconfigure) }, { - .name1 = "recv", - .name2 = "Information-Request", + .section = SECTION_NAME("recv", "Information-Request"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_information_request) }, { - .name1 = "recv", - .name2 = "Relay-Forward", + .section = SECTION_NAME("recv", "Relay-Forward"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_relay_forward) }, { - .name1 = "send", - .name2 = "Advertise", + .section = SECTION_NAME("send", "Advertise"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(send_advertise) }, { - .name1 = "send", - .name2 = "Reply", + .section = SECTION_NAME("send", "Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(send_reply) }, { - .name1 = "send", - .name2 = "Relay-Reply", + .section = SECTION_NAME("send", "Relay-Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(send_relay_reply) }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond) }, diff --git a/src/process/dns/base.c b/src/process/dns/base.c index 2ea52b6f3e95..95990c7207d8 100644 --- a/src/process/dns/base.c +++ b/src/process/dns/base.c @@ -130,76 +130,64 @@ typedef struct { static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Query", + .section = SECTION_NAME("recv", "Query"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(query), }, { - .name1 = "send", - .name2 = "Query-Response", + .section = SECTION_NAME("send", "Query-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(query_response), }, { - .name1 = "recv", - .name2 = "Inverse-Query", + .section = SECTION_NAME("recv", "Inverse-Query"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(inverse_query), }, { - .name1 = "send", - .name2 = "Inverse-Query-Response", + .section = SECTION_NAME("send", "Inverse-Query-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(inverse_query_response), }, { - .name1 = "recv", - .name2 = "Status", + .section = SECTION_NAME("recv", "Status"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(status), }, { - .name1 = "send", - .name2 = "Status-Response", + .section = SECTION_NAME("send", "Status-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(status_response), }, { - .name1 = "recv", - .name2 = "Update", + .section = SECTION_NAME("recv", "Update"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(update), }, { - .name1 = "send", - .name2 = "Update-Response", + .section = SECTION_NAME("send", "Update-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(update_response), }, { - .name1 = "recv", - .name2 = "Stateful-Operation", + .section = SECTION_NAME("recv", "Stateful-Operation"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(stateful_operation), }, { - .name1 = "send", - .name2 = "Stateful-Operation-Response", + .section = SECTION_NAME("send", "Stateful-Operation-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(stateful_operation_response), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Dot-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, #define ERROR_SECTION(_name, _number) \ { \ - .name1 = "error", \ - .name2 = _name, \ + .section = SECTION_NAME("error", _name), \ .actions = &mod_actions_postauth, \ .offset = PROCESS_CONF_OFFSET(rcode[_number]), \ } diff --git a/src/process/eap_aka/base.c b/src/process/eap_aka/base.c index d3422644f6ce..f6bcf01a3ac2 100644 --- a/src/process/eap_aka/base.c +++ b/src/process/eap_aka/base.c @@ -54,14 +54,12 @@ static virtual_server_compile_t const compile_list[] = { * identities. */ { - .name1 = "recv", - .name2 = "Identity-Response", + .section = SECTION_NAME("recv", "Identity-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_identity_response) }, { - .name1 = "send", - .name2 = "Identity-Request", + .section = SECTION_NAME("send", "Identity-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_identity_request) }, @@ -72,14 +70,12 @@ static virtual_server_compile_t const compile_list[] = { * request/response rounds. */ { - .name1 = "send", - .name2 = "AKA-Identity-Request", + .section = SECTION_NAME("send", "AKA-Identity-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_aka_identity_request) }, { - .name1 = "recv", - .name2 = "AKA-Identity-Response", + .section = SECTION_NAME("recv", "AKA-Identity-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_identity_response) }, @@ -88,14 +84,12 @@ static virtual_server_compile_t const compile_list[] = { * Full-Authentication */ { - .name1 = "send", - .name2 = "Challenge-Request", + .section = SECTION_NAME("send", "Challenge-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_aka_challenge_request) }, { - .name1 = "recv", - .name2 = "Challenge-Response", + .section = SECTION_NAME("recv", "Challenge-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_challenge_response) }, @@ -104,14 +98,12 @@ static virtual_server_compile_t const compile_list[] = { * Fast-Re-Authentication */ { - .name1 = "send", - .name2 = "Reauthentication-Request", + .section = SECTION_NAME("send", "Reauthentication-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_reauthentication_request) }, { - .name1 = "recv", - .name2 = "Reauthentication-Response", + .section = SECTION_NAME("recv", "Reauthentication-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_reauthentication_response) }, @@ -120,20 +112,17 @@ static virtual_server_compile_t const compile_list[] = { * Failures originating from the supplicant */ { - .name1 = "recv", - .name2 = "Client-Error", + .section = SECTION_NAME("recv", "Client-Error"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_client_error) }, { - .name1 = "recv", - .name2 = "Authentication-Reject", + .section = SECTION_NAME("recv", "Authentication-Reject"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_authentication_reject) }, { - .name1 = "recv", - .name2 = "Synchronization-Failure", + .section = SECTION_NAME("recv", "Synchronization-Failure"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_synchronization_failure) }, @@ -142,14 +131,12 @@ static virtual_server_compile_t const compile_list[] = { * Failure originating from the server */ { - .name1 = "send", - .name2 = "Failure-Notification", + .section = SECTION_NAME("send", "Failure-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_failure_notification) }, { - .name1 = "recv", - .name2 = "Failure-Notification-ACK", + .section = SECTION_NAME("recv", "Failure-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_failure_notification_ack) }, @@ -158,14 +145,12 @@ static virtual_server_compile_t const compile_list[] = { * Protected success indication */ { - .name1 = "send", - .name2 = "Success-Notification", + .section = SECTION_NAME("send", "Success-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_success_notification) }, { - .name1 = "recv", - .name2 = "Success-Notification-ACK", + .section = SECTION_NAME("recv", "Success-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_success_notification_ack) }, @@ -174,14 +159,12 @@ static virtual_server_compile_t const compile_list[] = { * Final EAP-Success and EAP-Failure messages */ { - .name1 = "send", - .name2 = "EAP-Success", + .section = SECTION_NAME("send", "EAP-Success"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_success) }, { - .name1 = "send", - .name2 = "EAP-Failure", + .section = SECTION_NAME("send", "EAP-Failure"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_failure) }, @@ -190,20 +173,17 @@ static virtual_server_compile_t const compile_list[] = { * Fast-Reauth vectors */ { - .name1 = "store", - .name2 = "session", + .section = SECTION_NAME("store", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_session) }, { - .name1 = "load", - .name2 = "session", + .section = SECTION_NAME("load", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_session) }, { - .name1 = "clear", - .name2 = "session", + .section = SECTION_NAME("clear", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_session) }, @@ -212,20 +192,17 @@ static virtual_server_compile_t const compile_list[] = { * Pseudonym processing */ { - .name1 = "store", - .name2 = "pseudonym", + .section = SECTION_NAME("store", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_pseudonym) }, { - .name1 = "load", - .name2 = "pseudonym", + .section = SECTION_NAME("load", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_pseudonym) }, { - .name1 = "clear", - .name2 = "pseudonym", + .section = SECTION_NAME("clear", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_pseudonym) }, diff --git a/src/process/eap_aka_prime/base.c b/src/process/eap_aka_prime/base.c index 949fcfc987d3..32385ac29a96 100644 --- a/src/process/eap_aka_prime/base.c +++ b/src/process/eap_aka_prime/base.c @@ -55,14 +55,12 @@ static virtual_server_compile_t const compile_list[] = { * identities. */ { - .name1 = "recv", - .name2 = "Identity-Response", + .section = SECTION_NAME("recv", "Identity-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_identity_response) }, { - .name1 = "send", - .name2 = "Identity-Request", + .section = SECTION_NAME("send", "Identity-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_identity_request) }, @@ -73,14 +71,12 @@ static virtual_server_compile_t const compile_list[] = { * request/response rounds. */ { - .name1 = "send", - .name2 = "AKA-Identity-Request", + .section = SECTION_NAME("send", "AKA-Identity-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_aka_identity_request) }, { - .name1 = "recv", - .name2 = "AKA-Identity-Response", + .section = SECTION_NAME("recv", "AKA-Identity-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_identity_response) }, @@ -89,14 +85,12 @@ static virtual_server_compile_t const compile_list[] = { * Full-Authentication */ { - .name1 = "send", - .name2 = "Challenge-Request", + .section = SECTION_NAME("send", "Challenge-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_aka_challenge_request) }, { - .name1 = "recv", - .name2 = "Challenge-Response", + .section = SECTION_NAME("recv", "Challenge-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_challenge_response) }, @@ -105,14 +99,12 @@ static virtual_server_compile_t const compile_list[] = { * Fast-Re-Authentication */ { - .name1 = "send", - .name2 = "Reauthentication-Request", + .section = SECTION_NAME("send", "Reauthentication-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_reauthentication_request) }, { - .name1 = "recv", - .name2 = "Reauthentication-Response", + .section = SECTION_NAME("recv", "Reauthentication-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_reauthentication_response) }, @@ -121,20 +113,17 @@ static virtual_server_compile_t const compile_list[] = { * Failures originating from the supplicant */ { - .name1 = "recv", - .name2 = "Client-Error", + .section = SECTION_NAME("recv", "Client-Error"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_client_error) }, { - .name1 = "recv", - .name2 = "Authentication-Reject", + .section = SECTION_NAME("recv", "Authentication-Reject"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_authentication_reject) }, { - .name1 = "recv", - .name2 = "Synchronization-Failure", + .section = SECTION_NAME("recv", "Synchronization-Failure"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_aka_synchronization_failure) }, @@ -143,14 +132,12 @@ static virtual_server_compile_t const compile_list[] = { * Failure originating from the server */ { - .name1 = "send", - .name2 = "Failure-Notification", + .section = SECTION_NAME("send", "Failure-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_failure_notification) }, { - .name1 = "recv", - .name2 = "Failure-Notification-ACK", + .section = SECTION_NAME("recv", "Failure-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_failure_notification_ack) }, @@ -159,14 +146,12 @@ static virtual_server_compile_t const compile_list[] = { * Protected success indication */ { - .name1 = "send", - .name2 = "Success-Notification", + .section = SECTION_NAME("send", "Success-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_success_notification) }, { - .name1 = "recv", - .name2 = "Success-Notification-ACK", + .section = SECTION_NAME("recv", "Success-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_success_notification_ack) }, @@ -175,14 +160,12 @@ static virtual_server_compile_t const compile_list[] = { * Final EAP-Success and EAP-Failure messages */ { - .name1 = "send", - .name2 = "EAP-Success", + .section = SECTION_NAME("send", "EAP-Success"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_success) }, { - .name1 = "send", - .name2 = "EAP-Failure", + .section = SECTION_NAME("send", "EAP-Failure"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_failure) }, @@ -191,20 +174,17 @@ static virtual_server_compile_t const compile_list[] = { * Fast-Reauth vectors */ { - .name1 = "store", - .name2 = "session", + .section = SECTION_NAME("store", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_session) }, { - .name1 = "load", - .name2 = "session", + .section = SECTION_NAME("load", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_session) }, { - .name1 = "clear", - .name2 = "session", + .section = SECTION_NAME("clear", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_session) }, @@ -213,20 +193,17 @@ static virtual_server_compile_t const compile_list[] = { * Pseudonym processing */ { - .name1 = "store", - .name2 = "pseudonym", + .section = SECTION_NAME("store", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_pseudonym) }, { - .name1 = "load", - .name2 = "pseudonym", + .section = SECTION_NAME("load", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_pseudonym) }, { - .name1 = "clear", - .name2 = "pseudonym", + .section = SECTION_NAME("clear", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_pseudonym) }, diff --git a/src/process/eap_sim/base.c b/src/process/eap_sim/base.c index 5f2083d07922..1f920fe6ace7 100644 --- a/src/process/eap_sim/base.c +++ b/src/process/eap_sim/base.c @@ -54,14 +54,12 @@ static virtual_server_compile_t compile_list[] = { * identities. */ { - .name1 = "recv", - .name2 = "Identity-Response", + .section = SECTION_NAME("recv", "Identity-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_identity_response) }, { - .name1 = "send", - .name2 = "Identity-Request", + .section = SECTION_NAME("send", "Identity-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_identity_request) }, @@ -72,14 +70,12 @@ static virtual_server_compile_t compile_list[] = { * request/response rounds. */ { - .name1 = "send", - .name2 = "Start-Request", + .section = SECTION_NAME("send", "Start-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_sim_start_request) }, { - .name1 = "recv", - .name2 = "Start-Response", + .section = SECTION_NAME("recv", "Start-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_sim_start_response) }, @@ -88,14 +84,12 @@ static virtual_server_compile_t compile_list[] = { * Full-Authentication */ { - .name1 = "send", - .name2 = "Challenge-Request", + .section = SECTION_NAME("send", "Challenge-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_sim_challenge_request) }, { - .name1 = "recv", - .name2 = "Challenge-Response", + .section = SECTION_NAME("recv", "Challenge-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_sim_challenge_response) }, @@ -104,14 +98,12 @@ static virtual_server_compile_t compile_list[] = { * Fast-Re-Authentication */ { - .name1 = "send", - .name2 = "Reauthentication-Request", + .section = SECTION_NAME("send", "Reauthentication-Request"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_reauthentication_request) }, { - .name1 = "recv", - .name2 = "Reauthentication-Response", + .section = SECTION_NAME("recv", "Reauthentication-Response"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_reauthentication_response) }, @@ -120,8 +112,7 @@ static virtual_server_compile_t compile_list[] = { * Failures originating from the supplicant */ { - .name1 = "recv", - .name2 = "Client-Error", + .section = SECTION_NAME("recv", "Client-Error"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_client_error) }, @@ -130,14 +121,12 @@ static virtual_server_compile_t compile_list[] = { * Failure originating from the server */ { - .name1 = "send", - .name2 = "Failure-Notification", + .section = SECTION_NAME("send", "Failure-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_failure_notification) }, { - .name1 = "recv", - .name2 = "Failure-Notification-ACK", + .section = SECTION_NAME("recv", "Failure-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_failure_notification_ack) }, @@ -146,14 +135,12 @@ static virtual_server_compile_t compile_list[] = { * Protected success indication */ { - .name1 = "send", - .name2 = "Success-Notification", + .section = SECTION_NAME("send", "Success-Notification"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_common_success_notification) }, { - .name1 = "recv", - .name2 = "Success-Notification-ACK", + .section = SECTION_NAME("recv", "Success-Notification-ACK"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.recv_common_success_notification_ack) }, @@ -162,14 +149,12 @@ static virtual_server_compile_t compile_list[] = { * Final EAP-Success and EAP-Failure messages */ { - .name1 = "send", - .name2 = "EAP-Success", + .section = SECTION_NAME("send", "EAP-Success"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_success) }, { - .name1 = "send", - .name2 = "EAP-Failure", + .section = SECTION_NAME("send", "EAP-Failure"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.send_eap_failure) }, @@ -178,20 +163,17 @@ static virtual_server_compile_t compile_list[] = { * Fast-Reauth vectors */ { - .name1 = "store", - .name2 = "session", + .section = SECTION_NAME("store", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_session) }, { - .name1 = "load", - .name2 = "session", + .section = SECTION_NAME("load", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_session) }, { - .name1 = "clear", - .name2 = "session", + .section = SECTION_NAME("clear", "session"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_session) }, @@ -200,20 +182,17 @@ static virtual_server_compile_t compile_list[] = { * Pseudonym processing */ { - .name1 = "store", - .name2 = "pseudonym", + .section = SECTION_NAME("store", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.store_pseudonym) }, { - .name1 = "load", - .name2 = "pseudonym", + .section = SECTION_NAME("load", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.load_pseudonym) }, { - .name1 = "clear", - .name2 = "pseudonym", + .section = SECTION_NAME("clear", "pseudonym"), .actions = &mod_actions_authorize, .offset = offsetof(eap_aka_sim_process_conf_t, actions.clear_pseudonym) }, diff --git a/src/process/ldap_sync/base.c b/src/process/ldap_sync/base.c index 0ca25aa1757f..9d12db58e545 100644 --- a/src/process/ldap_sync/base.c +++ b/src/process/ldap_sync/base.c @@ -195,38 +195,32 @@ static fr_process_state_t const process_state[] = { static virtual_server_compile_t const compile_list[] = { { - .name1 = "load", - .name2 = "Cookie", + .section = SECTION_NAME("load", "Cookie"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(load_cookie) }, { - .name1 = "store", - .name2 = "Cookie", + .section = SECTION_NAME("store", "Cookie"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(store_cookie) }, { - .name1 = "recv", - .name2 = "Add", + .section = SECTION_NAME("recv", "Add"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(recv_add) }, { - .name1 = "recv", - .name2 = "Present", + .section = SECTION_NAME("recv", "Present"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(recv_present) }, { - .name1 = "recv", - .name2 = "Delete", + .section = SECTION_NAME("recv", "Delete"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(recv_delete) }, { - .name1 = "recv", - .name2 = "Modify", + .section = SECTION_NAME("recv", "Modify"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(recv_modify) }, diff --git a/src/process/radius/base.c b/src/process/radius/base.c index cdea6986770d..244f5ff36cef 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -1098,104 +1098,88 @@ static fr_process_state_t const process_state[] = { static virtual_server_compile_t const compile_list[] = { { - .name1 = "recv", - .name2 = "Access-Request", + .section = SECTION_NAME("recv", "Access-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(access_request), }, { - .name1 = "send", - .name2 = "Access-Accept", + .section = SECTION_NAME("send", "Access-Accept"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_accept), }, { - .name1 = "send", - .name2 = "Access-Challenge", + .section = SECTION_NAME("send", "Access-Challenge"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_challenge), }, { - .name1 = "send", - .name2 = "Access-Reject", + .section = SECTION_NAME("send", "Access-Reject"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_reject), }, { - .name1 = "recv", - .name2 = "Accounting-Request", + .section = SECTION_NAME("recv", "Accounting-Request"), .actions = &mod_actions_preacct, .offset = PROCESS_CONF_OFFSET(accounting_request), }, { - .name1 = "send", - .name2 = "Accounting-Response", + .section = SECTION_NAME("send", "Accounting-Response"), .actions = &mod_actions_accounting, .offset = PROCESS_CONF_OFFSET(accounting_response), }, { - .name1 = "recv", - .name2 = "Status-Server", + .section = SECTION_NAME("recv", "Status-Server"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(status_server), }, { - .name1 = "recv", - .name2 = "CoA-Request", + .section = SECTION_NAME("recv", "CoA-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(coa_request), }, { - .name1 = "send", - .name2 = "CoA-ACK", + .section = SECTION_NAME("send", "CoA-ACK"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(coa_ack), }, { - .name1 = "send",.name2 = "CoA-NAK", + .section = SECTION_NAME("send", "CoA-NAK"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(coa_nak), }, { - .name1 = "recv", - .name2 = "Disconnect-Request", + .section = SECTION_NAME("recv", "Disconnect-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(disconnect_request), }, { - .name1 = "send", - .name2 = "Disconnect-ACK", + .section = SECTION_NAME("send", "Disconnect-ACK"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(disconnect_ack), }, { - .name1 = "send", - .name2 = "Disconnect-NAK", + .section = SECTION_NAME("send", "Disconnect-NAK"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(disconnect_nak), }, { - .name1 = "send", - .name2 = "Protocol-Error", + .section = SECTION_NAME("send", "Protocol-Error"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(protocol_error), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, { - .name1 = "authenticate", - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .actions = &mod_actions_authenticate }, { - .name1 = "accounting", - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME("accounting", CF_IDENT_ANY), .actions = &mod_actions_authenticate }, diff --git a/src/process/tacacs/base.c b/src/process/tacacs/base.c index 5992df75f798..6f36a73888e5 100644 --- a/src/process/tacacs/base.c +++ b/src/process/tacacs/base.c @@ -1322,101 +1322,85 @@ static virtual_server_compile_t compile_list[] = { * protocol. Pretty much everything they did was wrong. */ { - .name1 = "recv", - .name2 = "Authentication-Start", + .section = SECTION_NAME("recv", "Authentication-Start"), .actions = &mod_actions_authenticate, .offset = PROCESS_CONF_OFFSET(auth_start), }, { - .name1 = "send", - .name2 = "Authentication-Pass", + .section = SECTION_NAME("send", "Authentication-Pass"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_pass), }, { - .name1 = "send", - .name2 = "Authentication-Fail", + .section = SECTION_NAME("send", "Authentication-Fail"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_fail), }, { - .name1 = "send", - .name2 = "Authentication-GetData", + .section = SECTION_NAME("send", "Authentication-GetData"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_getdata), }, { - .name1 = "send", - .name2 = "Authentication-GetUser", + .section = SECTION_NAME("send", "Authentication-GetUser"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_getuser), }, { - .name1 = "send", - .name2 = "Authentication-GetPass", + .section = SECTION_NAME("send", "Authentication-GetPass"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_getpass), }, { - .name1 = "send", - .name2 = "Authentication-Restart", + .section = SECTION_NAME("send", "Authentication-Restart"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_restart), }, { - .name1 = "send", - .name2 = "Authentication-Error", + .section = SECTION_NAME("send", "Authentication-Error"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(auth_error), }, { - .name1 = "recv", - .name2 = "Authentication-Continue", + .section = SECTION_NAME("recv", "Authentication-Continue"), .actions = &mod_actions_authenticate, .offset = PROCESS_CONF_OFFSET(auth_cont), }, { - .name1 = "recv", - .name2 = "Authentication-Continue-Abort", + .section = SECTION_NAME("recv", "Authentication-Continue-Abort"), .actions = &mod_actions_authenticate, .offset = PROCESS_CONF_OFFSET(auth_cont_abort), }, { - .name1 = "authenticate", - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .actions = &mod_actions_authenticate, }, /* authorization */ { - .name1 = "recv", - .name2 = "Authorization-Request", + .section = SECTION_NAME("recv", "Authorization-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(autz_request), }, { - .name1 = "send", - .name2 = "Authorization-Pass-Add", + .section = SECTION_NAME("send", "Authorization-Pass-Add"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(autz_pass_add), }, { - .name1 = "send", - .name2 = "Authorization-Pass-Replace", + .section = SECTION_NAME("send", "Authorization-Pass-Replace"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(autz_pass_replace), }, { - .name1 = "send", - .name2 = "Authorization-Fail", + .section = SECTION_NAME("send", "Authorization-Fail"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(autz_fail), }, { - .name1 = "send", - .name2 = "Authorization-Error", + .section = SECTION_NAME("send", "Authorization-Error"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(autz_error), }, @@ -1424,33 +1408,28 @@ static virtual_server_compile_t compile_list[] = { /* accounting */ { - .name1 = "recv", - .name2 = "Accounting-Request", + .section = SECTION_NAME("recv", "Accounting-Request"), .actions = &mod_actions_accounting, .offset = PROCESS_CONF_OFFSET(acct_request), }, { - .name1 = "send", - .name2 = "Accounting-Success", + .section = SECTION_NAME("send", "Accounting-Success"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(acct_success), }, { - .name1 = "send", - .name2 = "Accounting-Error", + .section = SECTION_NAME("send", "Accounting-Error"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(acct_error), }, { - .name1 = "accounting", - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME("accounting", CF_IDENT_ANY), .actions = &mod_actions_accounting, }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, diff --git a/src/process/test/base.c b/src/process/test/base.c index fc80193f053d..f4793ccc83e3 100644 --- a/src/process/test/base.c +++ b/src/process/test/base.c @@ -105,14 +105,12 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Request", + .section = SECTION_NAME("recv", "Request"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(recv_request), }, { - .name1 = "send", - .name2 = "Reply", + .section = SECTION_NAME("send", "Reply"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(send_reply), }, diff --git a/src/process/tls/base.c b/src/process/tls/base.c index e71a8acf3aee..dae4e9f1aa52 100644 --- a/src/process/tls/base.c +++ b/src/process/tls/base.c @@ -152,26 +152,22 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc static const virtual_server_compile_t compile_list[] = { { - .name1 = "store", - .name2 = "session", + .section = SECTION_NAME("store", "session"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(store_session) }, { - .name1 = "load", - .name2 = "session", + .section = SECTION_NAME("load", "session"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(load_session) }, { - .name1 = "clear", - .name2 = "session", + .section = SECTION_NAME("clear", "session"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(clear_session) }, { - .name1 = "verify", - .name2 = "certificate", + .section = SECTION_NAME("verify", "certificate"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(verify_certificate) }, diff --git a/src/process/ttls/base.c b/src/process/ttls/base.c index b99733249ea9..cb0dcbfc38de 100644 --- a/src/process/ttls/base.c +++ b/src/process/ttls/base.c @@ -620,45 +620,38 @@ static fr_process_state_t const process_state[] = { static virtual_server_compile_t const compile_list[] = { { - .name1 = "recv", - .name2 = "Access-Request", + .section = SECTION_NAME("recv", "Access-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(access_request), }, { - .name1 = "send", - .name2 = "Access-Accept", + .section = SECTION_NAME("send", "Access-Accept"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_accept), }, { - .name1 = "send", - .name2 = "Access-Challenge", + .section = SECTION_NAME("send", "Access-Challenge"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_challenge), }, { - .name1 = "send", - .name2 = "Access-Reject", + .section = SECTION_NAME("send", "Access-Reject"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(access_reject), }, { - .name1 = "send", - .name2 = "Protocol-Error", + .section = SECTION_NAME("send", "Protocol-Error"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(protocol_error), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, { - .name1 = "authenticate", - .name2 = CF_IDENT_ANY, + .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .actions = &mod_actions_authenticate }, COMPILE_TERMINATOR diff --git a/src/process/vmps/base.c b/src/process/vmps/base.c index 9e767f130948..8947eee3063f 100644 --- a/src/process/vmps/base.c +++ b/src/process/vmps/base.c @@ -228,32 +228,27 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc static const virtual_server_compile_t compile_list[] = { { - .name1 = "recv", - .name2 = "Join-Request", + .section = SECTION_NAME("recv", "Join-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(join_request), }, { - .name1 = "send", - .name2 = "Join-Response", + .section = SECTION_NAME("send", "Join-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(join_response), }, { - .name1 = "recv", - .name2 = "Reconfirm-Request", + .section = SECTION_NAME("recv", "Reconfirm-Request"), .actions = &mod_actions_authorize, .offset = PROCESS_CONF_OFFSET(reconfirm_request), }, { - .name1 = "send", - .name2 = "Reconfirm-Response", + .section = SECTION_NAME("send", "Reconfirm-Response"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(reconfirm_response), }, { - .name1 = "send", - .name2 = "Do-Not-Respond", + .section = SECTION_NAME("send", "Do-Not-Respond"), .actions = &mod_actions_postauth, .offset = PROCESS_CONF_OFFSET(do_not_respond), }, diff --git a/src/tests/modules/test/section_names.unlang b/src/tests/modules/test/section_names.unlang index 3a02a35ea61f..e4270a299eb4 100644 --- a/src/tests/modules/test/section_names.unlang +++ b/src/tests/modules/test/section_names.unlang @@ -1,10 +1,10 @@ -# .method_names = (module_method_name_t[]){ -# { .name1 = "recv", .name2 = "Access-Challenge", .method = mod_return }, -# { .name1 = "name1_null", .name2 = NULL, .method = mod_return }, -# { .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_return }, -# { .name1 = "retry", .name2 = NULL, .method = mod_retry }, +# .bindings = (module_method_binding_t[]){ +# { .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 }, # -# MODULE_NAME_TERMINATOR +# MODULE_BINDING_TERMINATOR # } noop