From: Alan T. DeKok Date: Mon, 8 Nov 2021 16:58:40 +0000 (-0500) Subject: use inst->name instead of dl_module_instance_name_by_data() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65ed1870d00aa5752714ce2feba315c6625ca58e;p=thirdparty%2Ffreeradius-server.git use inst->name instead of dl_module_instance_name_by_data() --- diff --git a/src/modules/rlm_always/rlm_always.c b/src/modules/rlm_always/rlm_always.c index 153270e026..c30f89ca98 100644 --- a/src/modules/rlm_always/rlm_always.c +++ b/src/modules/rlm_always/rlm_always.c @@ -24,8 +24,8 @@ */ RCSID("$Id$") -#define LOG_PREFIX "rlm_always (%s) - " -#define LOG_PREFIX_ARGS dl_module_instance_name_by_data(inst) +#define LOG_PREFIX "%s - " +#define LOG_PREFIX_ARGS inst->name #include #include @@ -138,7 +138,6 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) return -1; } - xlat = xlat_register(inst, inst->name, always_xlat, false); xlat_func_args(xlat, always_xlat_args); xlat_async_instantiate_set(xlat, always_xlat_instantiate, rlm_always_t *, NULL, inst); diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index 09f0deb518..d7b52ec077 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -24,8 +24,8 @@ */ RCSID("$Id$") -#define LOG_PREFIX "rlm_attr_filter (%s) - " -#define LOG_PREFIX_ARGS dl_module_instance_name_by_data(inst) +#define LOG_PREFIX "%s - " +#define LOG_PREFIX_ARGS inst->name #include #include @@ -42,6 +42,7 @@ RCSID("$Id$") * be used as the instance handle. */ typedef struct { + char const *name; char const *filename; tmpl_t *key; bool relaxed; @@ -161,6 +162,16 @@ static int attr_filter_getfile(TALLOC_CTX *ctx, rlm_attr_filter_t *inst, char co } +static int mod_bootstrap(void *instance, CONF_SECTION *conf) +{ + rlm_attr_filter_t *inst = instance; + + inst->name = cf_section_name2(conf); + if (!inst->name) inst->name = cf_section_name1(conf); + + return 0; +} + /* * (Re-)read the "attrs" file into memory. */ @@ -375,6 +386,7 @@ module_t rlm_attr_filter = { .name = "attr_filter", .inst_size = sizeof(rlm_attr_filter_t), .config = module_config, + .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, .methods = { [MOD_AUTHORIZE] = mod_authorize, diff --git a/src/modules/rlm_chap/rlm_chap.c b/src/modules/rlm_chap/rlm_chap.c index dab48d325e..42fc5d5427 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -23,8 +23,8 @@ */ RCSID("$Id$") -#define LOG_PREFIX "rlm_chap (%s) - " -#define LOG_PREFIX_ARGS dl_module_instance_name_by_data(inst) +#define LOG_PREFIX "%s - " +#define LOG_PREFIX_ARGS inst->name #include #include @@ -32,7 +32,7 @@ RCSID("$Id$") #include typedef struct { - char const *name; //!< Auth-Type value for this module instance. + char const *name; //!< Auth-Type value for this module instance. fr_dict_enum_value_t *auth_type; } rlm_chap_t; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 626a979970..07a3b2c9a3 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -25,8 +25,8 @@ */ RCSID("$Id$") -#define LOG_PREFIX "rlm_eap (%s) - " -#define LOG_PREFIX_ARGS dl_module_instance_name_by_data(inst) +#define LOG_PREFIX "%s - " +#define LOG_PREFIX_ARGS inst->name #include #include diff --git a/src/modules/rlm_eap/rlm_eap.h b/src/modules/rlm_eap/rlm_eap.h index 26cd421bf7..5e85552246 100644 --- a/src/modules/rlm_eap/rlm_eap.h +++ b/src/modules/rlm_eap/rlm_eap.h @@ -45,6 +45,8 @@ typedef enum { * */ typedef struct { + char const *name; //!< Name of this instance. + CONF_SECTION **submodule_cs; //!< Configuration sections for the submodules ///< we're going to load. rlm_eap_method_t methods[FR_EAP_METHOD_MAX]; //!< Array of loaded (or not), submodules. @@ -65,7 +67,6 @@ typedef struct { rlm_eap_require_realm_t require_realm; //!< Whether we require the outer identity ///< to contain a realm. - char const *name; //!< Name of this instance. fr_dict_enum_value_t *auth_type; fr_randctx rand_pool; //!< Pool of random data. diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index 730a0d4a27..a8a8426183 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -25,8 +25,8 @@ /* MPPE support from Takahiro Wagatsuma */ RCSID("$Id$") -#define LOG_PREFIX "rlm_mschap (%s) - " -#define LOG_PREFIX_ARGS dl_module_instance_name_by_data(inst) +#define LOG_PREFIX "%s - " +#define LOG_PREFIX_ARGS inst->name #include #include @@ -2264,16 +2264,11 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) static int mod_bootstrap(void *instance, CONF_SECTION *conf) { - char const *name; rlm_mschap_t *inst = instance; xlat_t *xlat; - /* - * Create the dynamic translation. - */ - name = cf_section_name2(conf); - if (!name) name = cf_section_name1(conf); - inst->name = name; + inst->name = cf_section_name2(conf); + if (!inst->name) inst->name = cf_section_name1(conf); xlat = xlat_register(inst, inst->name, mschap_xlat, false); xlat_func_args(xlat, mschap_xlat_args);