]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
no need to cache CONF_SECTION
authorAlan T. DeKok <aland@freeradius.org>
Tue, 9 Nov 2021 20:18:00 +0000 (15:18 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 9 Nov 2021 20:22:54 +0000 (15:22 -0500)
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_cache/rlm_cache.h
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_ldap/rlm_ldap.h
src/modules/rlm_smtp/rlm_smtp.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_sql/rlm_sql.h
src/modules/rlm_sqlippool/rlm_sqlippool.c

index 855338a72f7eb23c546a3462d0bf9aac803db19f..6a51e6fe89d7161dcf8cd35103f95fb26bfee063 100644 (file)
@@ -965,8 +965,6 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
        char const      *name;
        xlat_t          *xlat;
 
-       inst->cs = conf;
-
        inst->config.name = cf_section_name2(conf);
        if (!inst->config.name) inst->config.name = cf_section_name1(conf);
 
@@ -1027,8 +1025,6 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        rlm_cache_t     *inst = instance;
        CONF_SECTION    *update;
 
-       inst->cs = conf;
-
        fr_assert(inst->config.key);
 
        if (!fr_time_delta_ispos(inst->config.ttl)) {
@@ -1041,7 +1037,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
                return -1;
        }
 
-       update = cf_section_find(inst->cs, "update", CF_IDENT_ANY);
+       update = cf_section_find(conf, "update", CF_IDENT_ANY);
        if (!update) {
                cf_log_err(conf, "Must have an 'update' section in order to cache anything");
                return -1;
@@ -1063,7 +1059,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        }
 
        if (fr_dlist_empty(&inst->maps)) {
-               cf_log_err(inst->cs, "Cache config must contain an update section, and "
+               cf_log_err(conf, "Cache config must contain an update section, and "
                              "that section must not be empty");
                return -1;
        }
index ad8db1802418f396bbab5a62acc02527b19e63a5..de24c8da1f817dd246301f60095c26665a95aead 100644 (file)
@@ -73,7 +73,6 @@ typedef struct {
 
        fr_map_list_t           maps;                   //!< Attribute map applied to users.
                                                        //!< and profiles.
-       CONF_SECTION            *cs;
 } rlm_cache_t;
 
 typedef struct {
index 3b111c7994406b0084e82155be927eddbec01ff7..42cbd667b7c5f31aa5ddafd698bfc1dfc1aefab7 100644 (file)
@@ -1907,7 +1907,6 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        CONF_SECTION    *options, *update;
        rlm_ldap_t      *inst = instance;
 
-       inst->cs = conf;
        fr_map_list_init(&inst->user_map);
 
        options = cf_section_find(conf, "options", NULL);
@@ -2337,7 +2336,7 @@ if (inst->handle_config.tls_min_version_str) {
                        .allow_foreign = true   /* Because we don't know where we'll be called */
                };
 
-               update = cf_section_find(inst->cs, "update", NULL);
+               update = cf_section_find(conf, "update", NULL);
                if (update && (map_afrom_cs(inst, &inst->user_map, update,
                                            &parse_rules, &parse_rules, fr_ldap_map_verify, NULL,
                                            LDAP_MAX_ATTRMAP) < 0)) {
index 7ae9969534d2e7396ceed12753e918280f1ece94..b859dcad09f026ab7672dd5729aac6d025ae582f 100644 (file)
@@ -32,8 +32,6 @@ typedef struct {
 typedef struct {
        char const      *name;                          //!< Instance name.
 
-       CONF_SECTION    *cs;                            //!< Main configuration section for this instance.
-
        bool            expect_password;                //!< True if the user_map included a mapping between an LDAP
                                                        //!< attribute and one of our password reference attributes.
 
index 17b57f8c915e192cbce5062bf54c38f8e0d03e04..cfec04119216b4383dce860eac7be051e77b26c6 100644 (file)
@@ -73,7 +73,6 @@ typedef struct {
        char const              *name;                  //!< Auth-Type value for this module instance.
        fr_dict_enum_value_t            *auth_type;
        fr_map_list_t           header_maps;            //!< Attribute map used to process header elements
-       CONF_SECTION            *cs;
        bool                    set_date;
 } rlm_smtp_t;
 
@@ -986,10 +985,8 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        rlm_smtp_t      *inst = instance;
        CONF_SECTION    *header;
 
-       inst->cs = conf;
-
        fr_map_list_init(&inst->header_maps);
-       header = cf_section_find(inst->cs, "header", NULL);
+       header = cf_section_find(conf, "header", NULL);
        if (!header) {
                return 0;
        }
index 6edc7be6ba404faf3eaa7ffd42ffa0c8797672a2..af13c33d243dcbddeb4c6d455bc6ff2942351446 100644 (file)
@@ -1033,8 +1033,6 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
        xlat_t          *xlat;
        xlat_arg_parser_t       *sql_xlat_arg;
 
-       inst->cs = conf;
-
        inst->name = cf_section_name2(conf);
        if (!inst->name) inst->name = cf_section_name1(conf);
 
@@ -1226,7 +1224,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
         */
        INFO("Attempting to connect to database \"%s\"", inst->config.sql_db);
 
-       inst->pool = module_connection_pool_init(inst->cs, inst, sql_mod_conn_create, NULL, NULL, NULL, NULL);
+       inst->pool = module_connection_pool_init(conf, inst, sql_mod_conn_create, NULL, NULL, NULL, NULL);
        if (!inst->pool) return -1;
 
        return 0;
index da22e1cbeffcfe77f45cfc54de26747b49ac070c..c9c24d5ad94c13f7110dc0f648e539aff8be5958 100644 (file)
@@ -216,7 +216,6 @@ typedef struct {
 struct sql_inst {
        rlm_sql_config_t        config; /* HACK */
        fr_pool_t               *pool;
-       CONF_SECTION            *cs;
 
        fr_dict_attr_t const    *sql_user;              //!< Cached pointer to SQL-User-Name
                                                        //!< dictionary attribute.
index 63d9c24a974757f3bf13f581f89690ea55baa029..36536afae64f1ba33184e3840de99670e0d3e434 100644 (file)
@@ -467,7 +467,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
 
        inst->sql_inst = (rlm_sql_t *) sql_inst->dl_inst->data;
 
-       if (strcmp(cf_section_name1(inst->sql_inst->cs), "sql") != 0) {
+       if (strcmp(talloc_get_name(inst->sql_inst), "rlm_sql_t") != 0) {
                cf_log_err(conf, "Module \"%s\" is not an instance of the rlm_sql module",
                              inst->sql_instance_name);
                return -1;