From: Arran Cudbard-Bell Date: Sun, 9 Jun 2024 22:46:00 +0000 (-0400) Subject: Wrap the module method array in a grouping structure X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86adcef31355b56d32bf3082b25458020815022b;p=thirdparty%2Ffreeradius-server.git Wrap the module method array in a grouping structure --- diff --git a/src/lib/server/dl_module.c b/src/lib/server/dl_module.c index 6f7f5915614..77876e9999e 100644 --- a/src/lib/server/dl_module.c +++ b/src/lib/server/dl_module.c @@ -318,7 +318,7 @@ dl_module_t *dl_module_alloc(dl_module_t const *parent, char const *name, dl_mod dl_t *dl = NULL; char *module_name = NULL; char *p, *q; - dl_module_common_t const *common; + dl_module_common_t *common; DL_INIT_CHECK; diff --git a/src/lib/server/dl_module.h b/src/lib/server/dl_module.h index a964289e86f..edfd9405472 100644 --- a/src/lib/server/dl_module.h +++ b/src/lib/server/dl_module.h @@ -125,7 +125,7 @@ struct dl_module_s { dl_module_type_t _CONST type; //!< of this module. - dl_module_common_t const * _CONST exported; //!< Symbol exported by the module, containing its public + dl_module_common_t *exported; //!< Symbol exported by the module, containing its public //!< functions, name and behaviour control flags. CONF_SECTION * _CONST conf; //!< The module's global configuration diff --git a/src/lib/server/module.c b/src/lib/server/module.c index 3f9a0da17fa..a9150ac497f 100644 --- a/src/lib/server/module.c +++ b/src/lib/server/module.c @@ -1724,7 +1724,7 @@ module_instance_t *module_instance_alloc(module_list_t *ml, /* * We have no way of checking if this is correct... so we hope... */ - mi->exported = (module_t const *)mi->module->exported; + mi->exported = (module_t *)mi->module->exported; if (unlikely(mi->exported == NULL)) { ERROR("Missing public structure for \"%s\"", qual_inst_name); goto error; diff --git a/src/lib/server/module.h b/src/lib/server/module.h index 9ae74d4ac2a..e734bce8ab9 100644 --- a/src/lib/server/module.h +++ b/src/lib/server/module.h @@ -32,6 +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_group_s module_method_group_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; @@ -149,6 +150,23 @@ extern "C" { */ #define MODULE_BINDING_TERMINATOR { .section = NULL } +/** A group of methods exported by a module or added as an overlay + * + * Module method groups are organised into a linked list, with each group + * containing a list of named methods. This allows common collections of + * methods to be added to a module. + * + * One common use case is adding the `instantiate`, `exists`, and `detach` + * methods which are added to dynamic modules, and allow dynamic module + * instances to be created and destroyed at runtime. + */ +struct module_method_group_s { + module_method_binding_t *bindings; //!< named methods + + bool validated; //!< Set to true by #module_method_group_validate. + module_method_group_t *next; //!< Next group in the list. +}; + /** Named methods exported by a module * */ @@ -238,9 +256,9 @@ typedef struct { size_t len; //!< How much data we need mprotect to protect. } module_data_pool_t; -/** Per instance data +/** Module instance data * - * Per-instance data structure, to correlate the modules with the + * Per-module-instance data structure to correlate the modules with the * instance names (may NOT be the module names!), and the per-instance * data structures. */ @@ -251,21 +269,21 @@ struct module_instance_s { * @{ */ void *data; //!< Module's instance data. This is most - ///< frequently access comes first. + ///< frequently accessed, so comes first. void *boot; //!< Data allocated during the boostrap phase - module_t const *exported; //!< Public module structure. Cached for convenience. + module_t *exported; //!< Public module structure. Cached for convenience. ///< This exports module methods, i.e. the functions ///< which allow the module to perform actions. - ///< This is an identical address to dl_module->common, + ///< This is an identical address to module->common, ///< but with a different type, containing additional ///< instance callbacks to make it easier to use. pthread_mutex_t mutex; //!< Used prevent multiple threads entering a thread ///< unsafe module simultaneously. - dl_module_t *module; //!< dynamic loader handle. Contains the module's + dl_module_t *module; //!< Dynamic loader handle. Contains the module's ///< dlhandle, and the functions it exports. ///< The dl_module is reference counted so that it ///< can be freed automatically when the last instance @@ -342,6 +360,9 @@ struct module_thread_instance_s { }; /** Callback to retrieve thread-local data for a module + * + * This is public for performance reasons, and should be called through + * #module_thread. * * @param[in] mi to add data to (use mi->ml for the module list). * @return diff --git a/src/lib/server/module_rlm.c b/src/lib/server/module_rlm.c index ef94993c23e..d63ac3b701a 100644 --- a/src/lib/server/module_rlm.c +++ b/src/lib/server/module_rlm.c @@ -755,7 +755,7 @@ fr_slen_t module_rlm_by_name_and_method(TALLOC_CTX *ctx, module_method_call_t *m .name2 = fr_sbuff_used(elem2) ? elem2->start : NULL }; - mmb = module_binding_find(mmc->rlm->bindings, &method); + mmb = module_binding_find(mmc->rlm->method.bindings, &method); if (!mmb) { fr_strerror_printf("Module \"%s\" does not have method %s%s%s", mmc->mi->name, @@ -764,7 +764,7 @@ fr_slen_t module_rlm_by_name_and_method(TALLOC_CTX *ctx, module_method_call_t *m method.name2 ? method.name2 : "" ); - module_rlm_methods_to_strerror(mmc->rlm->bindings); + module_rlm_methods_to_strerror(mmc->rlm->method.bindings); return fr_sbuff_error(&meth_start); } mmc->mmb = *mmb; /* For locality of reference and fewer derefs */ @@ -781,12 +781,12 @@ by_section: * * If that fails, we're done. */ - mmb = module_binding_find(mmc->rlm->bindings, section); + mmb = module_binding_find(mmc->rlm->method.bindings, section); if (!mmb) { section_name_t const **alt_p = virtual_server_section_methods(vs, section); if (alt_p) { for (; *alt_p; alt_p++) { - mmb = module_binding_find(mmc->rlm->bindings, *alt_p); + mmb = module_binding_find(mmc->rlm->method.bindings, *alt_p); if (mmb) { if (mmc_out) section_name_dup(ctx, &mmc->asked, *alt_p); break; @@ -805,7 +805,7 @@ by_section: section->name2 ? "." : "", section->name2 ? section->name2 : "" ); - module_rlm_methods_to_strerror(mmc->rlm->bindings); + module_rlm_methods_to_strerror(mmc->rlm->method.bindings); return fr_sbuff_error(&meth_start); } @@ -1006,27 +1006,24 @@ static int8_t binding_name_cmp(void const *one, void const *two) return section_name_cmp(a->section, b->section); } -static int module_method_validate(module_instance_t *mi) +static int module_method_group_validate(module_method_group_t *group) { module_method_binding_t *p, *srt_p; - module_rlm_t const *mrlm; fr_dlist_head_t bindings; bool in_order = true; - mrlm = module_rlm_from_module(mi->exported); - - fr_dlist_init(&bindings, module_method_binding_t, entry); - /* * Not all modules export module method bindings */ - if (!mrlm->bindings) return 0; + if (!group || !group->bindings || group->validated) return 0; + + fr_dlist_init(&bindings, module_method_binding_t, entry); - for (p = mrlm->bindings; p->section; p++) { + for (p = group->bindings; p->section; p++) { if (!fr_cond_assert_msg(p->section->name1, - "%s: First section identifier can't be NULL", mi->name)) return -1; + "First section identifier can't be NULL")) return -1; if (!fr_cond_assert_msg(p->section->name1 || p->section->name2, - "%s: Section identifiers can't both be null", mi->name)) return -1; + "Section identifiers can't both be null")) return -1; /* * All the bindings go in a list so we can sort them @@ -1042,7 +1039,7 @@ static int module_method_validate(module_instance_t *mi) * and the original list, to ensure they're * in the correct order. */ - for (srt_p = fr_dlist_head(&bindings), p = mrlm->bindings; + for (srt_p = fr_dlist_head(&bindings), p = group->bindings; srt_p; srt_p = fr_dlist_next(&bindings, srt_p), p++) { if (p != srt_p) { @@ -1063,7 +1060,7 @@ static int module_method_validate(module_instance_t *mi) srt_p = fr_dlist_next(&bindings, srt_p), p++) { *p = *srt_p; } - memcpy(mrlm->bindings, ordered, fr_dlist_num_elements(&bindings) * sizeof(*ordered)); + memcpy(group->bindings, ordered, fr_dlist_num_elements(&bindings) * sizeof(*ordered)); talloc_free(ordered); } @@ -1073,7 +1070,7 @@ static int module_method_validate(module_instance_t *mi) { module_method_binding_t *last_binding = NULL; - for (p = mrlm->bindings; p->section; p++) { + for (p = group->bindings; p->section; p++) { if (!last_binding || ( (last_binding->section->name1 != p->section->name1) && @@ -1090,8 +1087,16 @@ static int module_method_validate(module_instance_t *mi) fr_dlist_insert_tail(&last_binding->same_name1, p); } } + group->validated = true; - return 0; + CC_HINT(musttail) return module_method_group_validate(group->next); +} + +static int module_method_validate(module_instance_t *mi) +{ + module_rlm_t *mrlm = module_rlm_from_module(mi->exported); + + return module_method_group_validate(&mrlm->method); } /** Compare xlat functions registered to a module diff --git a/src/lib/server/module_rlm.h b/src/lib/server/module_rlm.h index 09d281103bb..a352e576394 100644 --- a/src/lib/server/module_rlm.h +++ b/src/lib/server/module_rlm.h @@ -37,7 +37,7 @@ typedef struct module_rlm_instance_s module_rlm_instance_t; struct module_rlm_s { module_t common; //!< Common fields presented by all modules. - module_method_binding_t *bindings; //!< named methods + module_method_group_t method; //!< named methods }; struct module_rlm_instance_s { @@ -70,12 +70,9 @@ typedef struct { tmpl_t *key; //!< Dynamic key, only set for dynamic modules. } module_method_call_t; -/** Cast a module_t to a module_rlm_t - * - */ -static inline module_rlm_t const *module_rlm_from_module(module_t const *module) +static inline module_rlm_t *module_rlm_from_module(module_t *module) { - return (module_rlm_t const *)module; + return (module_rlm_t *)module; } /** @name Debug functions diff --git a/src/lib/unlang/call_env.h b/src/lib/unlang/call_env.h index c65a79bd868..750c4895146 100644 --- a/src/lib/unlang/call_env.h +++ b/src/lib/unlang/call_env.h @@ -173,8 +173,8 @@ typedef int (*call_env_parse_section_t)(TALLOC_CTX *ctx, call_env_parsed_head_t * and use the appropriate dictionaries for where the module is in use. */ struct call_env_parser_s { - char const *name; //!< Of conf pair to pass to tmpl_tokenizer. - call_env_flags_t flags; //!< Flags controlling parser behaviour. + char const *name; //!< Of conf pair to pass to tmpl_tokenizer. + call_env_flags_t flags; //!< Flags controlling parser behaviour. union { struct { @@ -199,7 +199,7 @@ struct call_env_parser_s { } parsed; fr_value_box_safe_for_t literals_safe_for; //!< What safe_for value to assign any literals that are arguments to the tmpl_t. - tmpl_escape_t escape; //!< Escape method to use when evaluating tmpl_t. + tmpl_escape_t escape; //!< Escape method to use when evaluating tmpl_t. } pair; struct { @@ -210,22 +210,22 @@ struct call_env_parser_s { } section; }; - void const *uctx; //!< User context for callback functions. + void const *uctx; //!< User context for callback functions. }; typedef enum { - CALL_ENV_CTX_TYPE_MODULE = 1, //!< The callenv is registered to a module method. - CALL_ENV_CTX_TYPE_XLAT //!< The callenv is registered to an xlat. + CALL_ENV_CTX_TYPE_MODULE = 1, //!< The callenv is registered to a module method. + CALL_ENV_CTX_TYPE_XLAT //!< The callenv is registered to an xlat. } call_env_ctx_type_t; struct call_env_ctx_s { - call_env_ctx_type_t type; //!< Type of callenv ctx. + call_env_ctx_type_t type; //!< Type of callenv ctx. - module_instance_t const *mi; //!< Module instance that the callenv is registered to. - ///< Available for both module methods, and xlats. + module_instance_t const *mi; //!< Module instance that the callenv is registered to. + ///< Available for both module methods, and xlats. - section_name_t const *asked; //!< The actual name1/name2 that resolved to a - ///< module_method_binding_t. + section_name_t const *asked; //!< The actual name1/name2 that resolved to a + ///< module_method_binding_t. }; #define CALL_ENV_TERMINATOR { NULL } @@ -237,9 +237,9 @@ struct call_env_ctx_s { .inst_type = STRINGIFY(_inst) \ struct call_env_method_s { - size_t inst_size; //!< Size of per call env. - char const *inst_type; //!< Type of per call env. - call_env_parser_t const *env; //!< Parsing rules for call method env. + size_t inst_size; //!< Size of per call env. + char const *inst_type; //!< Type of per call env. + call_env_parser_t const *env; //!< Parsing rules for call method env. }; /** Structure containing both a talloc pool, a list of parsed call_env_pairs diff --git a/src/modules/rlm_always/rlm_always.c b/src/modules/rlm_always/rlm_always.c index 46f1131c9df..d7dd8adf549 100644 --- a/src/modules/rlm_always/rlm_always.c +++ b/src/modules/rlm_always/rlm_always.c @@ -191,8 +191,10 @@ module_rlm_t rlm_always = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_always_return }, - MODULE_BINDING_TERMINATOR + .method = { + .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 c9e63739839..b56a57f91e6 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -380,17 +380,19 @@ module_rlm_t rlm_attr_filter = { .config = module_config, .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + { .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 1e9171bb746..1241a21498b 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -1515,14 +1515,16 @@ module_rlm_t rlm_cache = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env }, - { .section = SECTION_NAME("load", CF_IDENT_ANY), .method = mod_method_load, .method_env = &cache_method_env }, - { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env }, - { .section = SECTION_NAME("store", CF_IDENT_ANY), .method = mod_method_store, .method_env = &cache_method_env }, - { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env }, - { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env }, - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_cache_it, .method_env = &cache_method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env }, + { .section = SECTION_NAME("load", CF_IDENT_ANY), .method = mod_method_load, .method_env = &cache_method_env }, + { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env }, + { .section = SECTION_NAME("store", CF_IDENT_ANY), .method = mod_method_store, .method_env = &cache_method_env }, + { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env }, + { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_cache_it, .method_env = &cache_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_chap/rlm_chap.c b/src/modules/rlm_chap/rlm_chap.c index 36902ebc950..b8a96f012b7 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -388,9 +388,11 @@ module_rlm_t rlm_chap = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &chap_auth_method_env }, - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize, .method_env = &chap_autz_method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &chap_auth_method_env }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize, .method_env = &chap_autz_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index 3db525376b2..78a25f9d235 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -385,8 +385,10 @@ module_rlm_t rlm_client = { .onload = mod_load, .unload = mod_unload }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR + .method = { + .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 c26926a15b2..94e28d1b53d 100644 --- a/src/modules/rlm_couchbase/rlm_couchbase.c +++ b/src/modules/rlm_couchbase/rlm_couchbase.c @@ -555,9 +555,11 @@ module_rlm_t rlm_couchbase = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_csv/rlm_csv.c b/src/modules/rlm_csv/rlm_csv.c index b6542d2194b..a0f261b7a56 100644 --- a/src/modules/rlm_csv/rlm_csv.c +++ b/src/modules/rlm_csv/rlm_csv.c @@ -1058,8 +1058,10 @@ module_rlm_t rlm_csv = { .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, - MODULE_BINDING_TERMINATOR + .method = { + .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 2cdb2b6fc7a..eb2a120c208 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -279,8 +279,10 @@ module_rlm_t rlm_delay = { .config = module_config, .bootstrap = mod_bootstrap }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_delay }, - MODULE_BINDING_TERMINATOR + .method = { + .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 07bf835a47c..6104463b869 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -508,11 +508,13 @@ module_rlm_t rlm_detail = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index bb3b065e3f9..4c3ca74fb68 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -333,8 +333,10 @@ module_rlm_t rlm_dhcpv4 = { .thread_inst_type = "rlm_dhcpv4_thread_t", .thread_instantiate = mod_thread_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, - MODULE_BINDING_TERMINATOR - }, + .method = { + .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 12bfbe555bc..acc4a896f70 100644 --- a/src/modules/rlm_digest/rlm_digest.c +++ b/src/modules/rlm_digest/rlm_digest.c @@ -480,9 +480,11 @@ module_rlm_t rlm_digest = { .inst_size = sizeof(rlm_digest_t), .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR - }, + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, + MODULE_BINDING_TERMINATOR + } + } }; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 46490eac5e9..4a4dfe23dcc 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -1196,10 +1196,12 @@ module_rlm_t rlm_eap = { .unload = mod_unload, .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR - } + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + MODULE_BINDING_TERMINATOR + } + } }; diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index 34f2af4a903..3027b51460a 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -531,8 +531,10 @@ module_rlm_t rlm_exec = { .bootstrap = mod_bootstrap, .instantiate = mob_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot, .method_env = &exec_method_env }, - MODULE_BINDING_TERMINATOR - } + .method = { + .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_BINDING_TERMINATOR + } + } }; diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index 8efe9806712..320f04610e9 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -674,9 +674,10 @@ module_rlm_t rlm_files = { .inst_size = sizeof(rlm_files_t), .config = module_config, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, .method_env = &method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, .method_env = &method_env }, + MODULE_BINDING_TERMINATOR + } } - }; diff --git a/src/modules/rlm_imap/rlm_imap.c b/src/modules/rlm_imap/rlm_imap.c index ccc5a5ee770..4281425c8ee 100644 --- a/src/modules/rlm_imap/rlm_imap.c +++ b/src/modules/rlm_imap/rlm_imap.c @@ -292,8 +292,10 @@ module_rlm_t rlm_imap = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - MODULE_BINDING_TERMINATOR + .method = { + .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 0619c7bcf5e..6f0077a0aaa 100644 --- a/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c +++ b/src/modules/rlm_isc_dhcp/rlm_isc_dhcp.c @@ -2240,9 +2240,11 @@ module_rlm_t rlm_isc_dhcp = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + .method = { + .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 720975fed2a..71a857806dd 100644 --- a/src/modules/rlm_krb5/rlm_krb5.c +++ b/src/modules/rlm_krb5/rlm_krb5.c @@ -504,8 +504,10 @@ module_rlm_t rlm_krb5 = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - MODULE_BINDING_TERMINATOR + .method = { + .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 8f41affbf3d..38f6a2de598 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -2712,33 +2712,35 @@ static void mod_unload(void) extern module_rlm_t rlm_ldap; module_rlm_t rlm_ldap = { .common = { - .magic = MODULE_MAGIC_INIT, - .name = "ldap", - .flags = 0, - .boot_size = sizeof(rlm_ldap_boot_t), - .boot_type = "rlm_ldap_boot_t", - .inst_size = sizeof(rlm_ldap_t), - .config = module_config, - .onload = mod_load, - .unload = mod_unload, - .bootstrap = mod_bootstrap, - .instantiate = mod_instantiate, - .detach = mod_detach, + .magic = MODULE_MAGIC_INIT, + .name = "ldap", + .flags = 0, + .boot_size = sizeof(rlm_ldap_boot_t), + .boot_type = "rlm_ldap_boot_t", + .inst_size = sizeof(rlm_ldap_t), + .config = module_config, + .onload = mod_load, + .unload = mod_unload, + .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate, + .detach = mod_detach, .thread_inst_size = sizeof(fr_ldap_thread_t), .thread_inst_type = "fr_ldap_thread_t", .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &usermod_method_env }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &authenticate_method_env }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &usermod_method_env }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &authenticate_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &usermod_method_env }, - MODULE_BINDING_TERMINATOR + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &usermod_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c index c421f67f868..b0bc7201b73 100644 --- a/src/modules/rlm_linelog/rlm_linelog.c +++ b/src/modules/rlm_linelog/rlm_linelog.c @@ -1059,8 +1059,10 @@ module_rlm_t rlm_linelog = { .instantiate = mod_instantiate, .detach = mod_detach }, - .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 + .method = { + .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 4db45d90e30..0bcf4c1ca33 100644 --- a/src/modules/rlm_logtee/rlm_logtee.c +++ b/src/modules/rlm_logtee/rlm_logtee.c @@ -665,8 +665,10 @@ module_rlm_t rlm_logtee = { .instantiate = mod_instantiate, .thread_instantiate = mod_thread_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_insert_logtee }, - MODULE_BINDING_TERMINATOR + .method = { + .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 fc78a855bc9..b03488d0bf9 100644 --- a/src/modules/rlm_lua/rlm_lua.c +++ b/src/modules/rlm_lua/rlm_lua.c @@ -180,17 +180,19 @@ module_rlm_t rlm_lua = { .detach = mod_detach, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("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 3bd497243c5..26f4fe5a45f 100644 --- a/src/modules/rlm_mruby/rlm_mruby.c +++ b/src/modules/rlm_mruby/rlm_mruby.c @@ -517,18 +517,20 @@ module_rlm_t rlm_mruby = { .instantiate = mod_instantiate, .detach = mod_detach, }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + + { .section = SECTION_NAME("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 9a7259e42f7..8cb4487afb8 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -2527,9 +2527,11 @@ module_rlm_t rlm_mschap = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &mschap_auth_method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &mschap_autz_method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &mschap_auth_method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &mschap_autz_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_opendirectory/rlm_opendirectory.c b/src/modules/rlm_opendirectory/rlm_opendirectory.c index 91f7c342ec1..25acedcc6af 100644 --- a/src/modules/rlm_opendirectory/rlm_opendirectory.c +++ b/src/modules/rlm_opendirectory/rlm_opendirectory.c @@ -536,9 +536,11 @@ module_rlm_t rlm_opendirectory = { .inst_size = sizeof(rlm_opendirectory_t), .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_pam/rlm_pam.c b/src/modules/rlm_pam/rlm_pam.c index 0c47b006ae8..a9a3c5ab57e 100644 --- a/src/modules/rlm_pam/rlm_pam.c +++ b/src/modules/rlm_pam/rlm_pam.c @@ -277,8 +277,10 @@ module_rlm_t rlm_pam = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - MODULE_BINDING_TERMINATOR + .method = { + .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 4c08019a116..208343cedda 100644 --- a/src/modules/rlm_pap/rlm_pap.c +++ b/src/modules/rlm_pap/rlm_pap.c @@ -1073,14 +1073,16 @@ module_rlm_t rlm_pap = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, - - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env }, + + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index d295a061ced..6e28d99da53 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -616,9 +616,11 @@ module_rlm_t rlm_passwd = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map }, - MODULE_BINDING_TERMINATOR + .method = { + .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 6b08a7cfdf5..d181a198781 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -1182,18 +1182,20 @@ module_rlm_t rlm_perl = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + { .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 6ef78a38d1e..1ea5d2c7c3c 100644 --- a/src/modules/rlm_python/rlm_python.c +++ b/src/modules/rlm_python/rlm_python.c @@ -1182,18 +1182,20 @@ module_rlm_t rlm_python = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + { .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 dd1a4b0ce66..aac7b64389d 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -663,8 +663,10 @@ module_rlm_t rlm_radius = { .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, - MODULE_BINDING_TERMINATOR - }, + .method = { + .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 1d516b783b8..5ee9911663f 100644 --- a/src/modules/rlm_radutmp/rlm_radutmp.c +++ b/src/modules/rlm_radutmp/rlm_radutmp.c @@ -586,8 +586,10 @@ module_rlm_t rlm_radutmp = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 598b0f331ae..025cb3cd215 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -1291,28 +1291,30 @@ module_rlm_t rlm_redis_ippool = { .onload = mod_load, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* radius */ - { .section = SECTION_NAME("accounting", "Start"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ - { .section = SECTION_NAME("accounting", "Interim-Update"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ - { .section = SECTION_NAME("accounting", "Stop"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* radius */ - { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ - { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ - - { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv4 */ - { .section = SECTION_NAME("recv", "Release"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* dhcpv4 */ - { .section = SECTION_NAME("send", "Ack"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* dhcpv4 */ - - { .section = SECTION_NAME("recv", "Solicit"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv6 */ - - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* generic */ - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* generic */ - - { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* verb */ - { .section = SECTION_NAME("update", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ - { .section = SECTION_NAME("renew", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ - { .section = SECTION_NAME("release", NULL), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* verb */ - { .section = SECTION_NAME("bulk-release", NULL), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* verb */ - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Start"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Interim-Update"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Stop"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ + { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */ + + { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv4 */ + { .section = SECTION_NAME("recv", "Release"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* dhcpv4 */ + { .section = SECTION_NAME("send", "Ack"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* dhcpv4 */ + + { .section = SECTION_NAME("recv", "Solicit"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv6 */ + + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* generic */ + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* generic */ + + { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* verb */ + { .section = SECTION_NAME("update", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ + { .section = SECTION_NAME("renew", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */ + { .section = SECTION_NAME("release", NULL), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* verb */ + { .section = SECTION_NAME("bulk-release", NULL), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* verb */ + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_rediswho/rlm_rediswho.c b/src/modules/rlm_rediswho/rlm_rediswho.c index 4033098bdce..647daa049dc 100644 --- a/src/modules/rlm_rediswho/rlm_rediswho.c +++ b/src/modules/rlm_rediswho/rlm_rediswho.c @@ -257,8 +257,10 @@ module_rlm_t rlm_rediswho = { .onload = mod_load, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - MODULE_BINDING_TERMINATOR + .method = { + .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 323dac69d51..a0a7123cd2c 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -1418,17 +1418,19 @@ module_rlm_t rlm_rest = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .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 + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .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 b23ad501676..99b69804979 100644 --- a/src/modules/rlm_securid/rlm_securid.c +++ b/src/modules/rlm_securid/rlm_securid.c @@ -560,8 +560,10 @@ module_rlm_t rlm_securid = { .instantiate = mod_instantiate, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - MODULE_BINDING_TERMINATOR + .method = { + .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 d2b2c414bc8..4b6b2f34663 100644 --- a/src/modules/rlm_sigtran/rlm_sigtran.c +++ b/src/modules/rlm_sigtran/rlm_sigtran.c @@ -434,8 +434,10 @@ module_rlm_t rlm_sigtran = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR + .method = { + .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 8dcf707aa3b..1a7b24d5f42 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -1050,10 +1050,12 @@ module_rlm_t rlm_smtp = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &auth_env }, - { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, .method_env = &method_env }, + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &auth_env }, + { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, .method_env = &method_env }, - MODULE_BINDING_TERMINATOR + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index 06e57ed1cc8..25b13c47e35 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -161,9 +161,11 @@ module_rlm_t rlm_sometimes = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sometimes_reply }, - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_sometimes_packet }, - MODULE_BINDING_TERMINATOR + .method = { + .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 03ab4ab92fd..fd2d63ed42c 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -2297,15 +2297,17 @@ module_rlm_t rlm_sql = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach, }, - .bindings = (module_method_binding_t[]){ - /* - * Hack to support old configurations - */ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &accounting_method_env }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * Hack to support old configurations + */ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &accounting_method_env }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &send_method_env }, - MODULE_BINDING_TERMINATOR + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &send_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index 1bc7cc21b3b..ead809f43d9 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -583,8 +583,10 @@ module_rlm_t rlm_sqlcounter = { .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &sqlcounter_call_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &sqlcounter_call_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c index d054ea66886..77d0a09cd33 100644 --- a/src/modules/rlm_sqlippool/rlm_sqlippool.c +++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c @@ -815,45 +815,46 @@ module_rlm_t rlm_sqlippool = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - /* - * RADIUS specific - */ - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("accounting", "Start"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("accounting", "Alive"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("accounting", "Stop"), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, - { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, + .method = { + .bindings = (module_method_binding_t[]){ + /* + * RADIUS specific + */ + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("accounting", "Start"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("accounting", "Alive"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("accounting", "Stop"), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, + { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, - /* - * DHCPv4 - */ - { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("recv", "Request"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("recv", "Release"), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, .method_env = &sqlippool_mark_method_env }, + /* + * DHCPv4 + */ + { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("recv", "Request"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("recv", "Release"), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, .method_env = &sqlippool_mark_method_env }, - /* - * Generic - */ - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("send", CF_IDENT_ANY),.method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + /* + * Generic + */ + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("send", CF_IDENT_ANY),.method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - /* - * Named methods matching module operations - */ - { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, - { .section = SECTION_NAME("update", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("renew", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, - { .section = SECTION_NAME("release", NULL), .method = mod_common, .method_env = &sqlippool_release_method_env }, - { .section = SECTION_NAME("bulk-release", NULL), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, - { .section = SECTION_NAME("mark", NULL),.method = mod_common,.method_env = &sqlippool_mark_method_env }, - - MODULE_BINDING_TERMINATOR + /* + * Named methods matching module operations + */ + { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env }, + { .section = SECTION_NAME("update", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("renew", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env }, + { .section = SECTION_NAME("release", NULL), .method = mod_common, .method_env = &sqlippool_release_method_env }, + { .section = SECTION_NAME("bulk-release", NULL), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env }, + { .section = SECTION_NAME("mark", NULL),.method = mod_common,.method_env = &sqlippool_mark_method_env }, + + MODULE_BINDING_TERMINATOR + } } - }; diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index b7ec90dacc7..a67fc779a3b 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -458,8 +458,10 @@ module_rlm_t rlm_stats = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats }, - MODULE_BINDING_TERMINATOR + .method = { + .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 3b49b743354..594bf1e6cad 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs.c +++ b/src/modules/rlm_tacacs/rlm_tacacs.c @@ -264,8 +264,10 @@ module_rlm_t rlm_tacacs = { .instantiate = mod_instantiate, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process }, - MODULE_BINDING_TERMINATOR - }, + .method = { + .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 c1b2845a775..ed05d697693 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -528,20 +528,22 @@ module_rlm_t rlm_test = { .thread_instantiate = mod_thread_instantiate, .thread_detach = mod_thread_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("name1_null", NULL), .method = mod_return }, + { .section = SECTION_NAME("name1_null", NULL), .method = mod_return }, - { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return }, - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return }, + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("retry", NULL), .method = mod_retry }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return }, + { .section = SECTION_NAME("retry", NULL), .method = mod_retry }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return }, - MODULE_BINDING_TERMINATOR + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_totp/rlm_totp.c b/src/modules/rlm_totp/rlm_totp.c index 52c2471d6a4..aef581702dc 100644 --- a/src/modules/rlm_totp/rlm_totp.c +++ b/src/modules/rlm_totp/rlm_totp.c @@ -181,8 +181,10 @@ module_rlm_t rlm_totp = { .config = module_config, .instantiate = mod_instantiate }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .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 9df01471e53..6114f2f0902 100644 --- a/src/modules/rlm_unix/rlm_unix.c +++ b/src/modules/rlm_unix/rlm_unix.c @@ -560,10 +560,12 @@ module_rlm_t rlm_unix = { .config = module_config, .bootstrap = mod_bootstrap }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, - { .section = SECTION_NAME("send", "Accounting-Response"), .method = mod_accounting }, /* Backwards compatibility */ - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, + { .section = SECTION_NAME("send", "Accounting-Response"), .method = mod_accounting }, /* Backwards compatibility */ + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_utf8/rlm_utf8.c b/src/modules/rlm_utf8/rlm_utf8.c index 969122c48f6..e76738f7be3 100644 --- a/src/modules/rlm_utf8/rlm_utf8.c +++ b/src/modules/rlm_utf8/rlm_utf8.c @@ -60,8 +60,10 @@ module_rlm_t rlm_utf8 = { .magic = MODULE_MAGIC_INIT, .name = "utf8" }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_utf8_clean }, - MODULE_BINDING_TERMINATOR + .method = { + .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 46e4a1933ef..1b92c4039e3 100644 --- a/src/modules/rlm_wimax/rlm_wimax.c +++ b/src/modules/rlm_wimax/rlm_wimax.c @@ -460,10 +460,12 @@ module_rlm_t rlm_wimax = { .inst_size = sizeof(rlm_wimax_t), .config = module_config, }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, - { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize }, + { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_winbind/rlm_winbind.c b/src/modules/rlm_winbind/rlm_winbind.c index 8d1fb7990f1..6185e3409f8 100644 --- a/src/modules/rlm_winbind/rlm_winbind.c +++ b/src/modules/rlm_winbind/rlm_winbind.c @@ -576,9 +576,11 @@ module_rlm_t rlm_winbind = { .bootstrap = mod_bootstrap, .detach = mod_detach }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env }, - { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_method_env }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env }, + { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_method_env }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/modules/rlm_yubikey/rlm_yubikey.c b/src/modules/rlm_yubikey/rlm_yubikey.c index f91c4258a8b..3072080fb7a 100644 --- a/src/modules/rlm_yubikey/rlm_yubikey.c +++ b/src/modules/rlm_yubikey/rlm_yubikey.c @@ -468,9 +468,11 @@ module_rlm_t rlm_yubikey = { .detach = mod_detach, #endif }, - .bindings = (module_method_binding_t[]){ - { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, - { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, - MODULE_BINDING_TERMINATOR + .method = { + .bindings = (module_method_binding_t[]){ + { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate }, + { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_authorize }, + MODULE_BINDING_TERMINATOR + } } }; diff --git a/src/tests/modules/test/section_names.unlang b/src/tests/modules/test/section_names.unlang index e4270a299eb..085d1a61658 100644 --- a/src/tests/modules/test/section_names.unlang +++ b/src/tests/modules/test/section_names.unlang @@ -1,10 +1,13 @@ -# .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_BINDING_TERMINATOR +# .method = { +# .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_BINDING_TERMINATOR +# } # } noop