]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use inst->name instead of dl_module_instance_name_by_data()
authorAlan T. DeKok <aland@freeradius.org>
Mon, 8 Nov 2021 16:58:40 +0000 (11:58 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 8 Nov 2021 16:58:40 +0000 (11:58 -0500)
src/modules/rlm_always/rlm_always.c
src/modules/rlm_attr_filter/rlm_attr_filter.c
src/modules/rlm_chap/rlm_chap.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/rlm_eap.h
src/modules/rlm_mschap/rlm_mschap.c

index 153270e02689da7f6921715435e3cacbf214f477..c30f89ca9899ec79771245d77d8b29aaa8732e08 100644 (file)
@@ -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 <freeradius-devel/server/base.h>
 #include <freeradius-devel/server/module.h>
@@ -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);
index 09f0deb518a479b60f6ec5e149498c9b9b3914a3..d7b52ec077c653be6d40079b52210833572ea02d 100644 (file)
@@ -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       <freeradius-devel/server/base.h>
 #include       <freeradius-devel/server/module.h>
@@ -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,
index dab48d325eadf56649b32abd9d1384951bd05762..42fc5d5427418f25784678a668df9dbfc7363631 100644 (file)
@@ -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 <freeradius-devel/server/base.h>
 #include <freeradius-devel/server/password.h>
@@ -32,7 +32,7 @@ RCSID("$Id$")
 #include <freeradius-devel/radius/radius.h>
 
 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;
 
index 626a97997099ccefacb9f95b3c24172a62600d2c..07a3b2c9a35c49085ed8aef12602a9a86d63f464 100644 (file)
@@ -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 <freeradius-devel/server/base.h>
 #include <freeradius-devel/server/module.h>
index 26cd421bf77a7d11a521c4ff1eecd35390a35677..5e855522462dac0feea4db3a27ee61e8830debf3 100644 (file)
@@ -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.
index 730a0d4a27b0c13b39d2b366349be68163c97103..a8a8426183798c5fb7dae7317c0bd43a509d672a 100644 (file)
@@ -25,8 +25,8 @@
 /*  MPPE support from Takahiro Wagatsuma <waga@sic.shibaura-it.ac.jp> */
 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 <freeradius-devel/server/base.h>
 #include <freeradius-devel/server/exec_legacy.h>
@@ -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);