From: Alan T. DeKok Date: Tue, 9 Nov 2021 20:18:00 +0000 (-0500) Subject: no need to cache CONF_SECTION X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7dee1db6adab86e4ff45f8df415c2dd6a5c620e;p=thirdparty%2Ffreeradius-server.git no need to cache CONF_SECTION --- diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index 855338a72f..6a51e6fe89 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -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; } diff --git a/src/modules/rlm_cache/rlm_cache.h b/src/modules/rlm_cache/rlm_cache.h index ad8db18024..de24c8da1f 100644 --- a/src/modules/rlm_cache/rlm_cache.h +++ b/src/modules/rlm_cache/rlm_cache.h @@ -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 { diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 3b111c7994..42cbd667b7 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -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)) { diff --git a/src/modules/rlm_ldap/rlm_ldap.h b/src/modules/rlm_ldap/rlm_ldap.h index 7ae9969534..b859dcad09 100644 --- a/src/modules/rlm_ldap/rlm_ldap.h +++ b/src/modules/rlm_ldap/rlm_ldap.h @@ -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. diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index 17b57f8c91..cfec041192 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -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; } diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 6edc7be6ba..af13c33d24 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -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; diff --git a/src/modules/rlm_sql/rlm_sql.h b/src/modules/rlm_sql/rlm_sql.h index da22e1cbef..c9c24d5ad9 100644 --- a/src/modules/rlm_sql/rlm_sql.h +++ b/src/modules/rlm_sql/rlm_sql.h @@ -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. diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c index 63d9c24a97..36536afae6 100644 --- a/src/modules/rlm_sqlippool/rlm_sqlippool.c +++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c @@ -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;