From: Nick Porter Date: Tue, 16 Apr 2024 09:35:35 +0000 (+0100) Subject: Also pass section_name1 and section_name2 to custom call env section parser X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cda1c8ca1c11f3caad90ee1cee97c59ef8f17fce;p=thirdparty%2Ffreeradius-server.git Also pass section_name1 and section_name2 to custom call env section parser --- diff --git a/src/lib/unlang/call_env.c b/src/lib/unlang/call_env.c index 132656d8297..42e8f7da68e 100644 --- a/src/lib/unlang/call_env.c +++ b/src/lib/unlang/call_env.c @@ -421,7 +421,8 @@ static int call_env_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *parsed, char */ call_env_parsed_t *last = call_env_parsed_tail(parsed); - if (rule->section.func(ctx, parsed, t_rules, cf_section_to_item(subcs), rule) < 0) { + if (rule->section.func(ctx, parsed, t_rules, cf_section_to_item(subcs), section_name1, + section_name2, rule) < 0) { cf_log_perr(cs, "Failed parsing configuration section %s", rule->name); talloc_free(call_env_parsed); return -1; diff --git a/src/lib/unlang/call_env.h b/src/lib/unlang/call_env.h index e39f62fb7ff..e90ccb10e6b 100644 --- a/src/lib/unlang/call_env.h +++ b/src/lib/unlang/call_env.h @@ -158,7 +158,7 @@ typedef int (*call_env_parse_pair_t)(TALLOC_CTX *ctx, void *out, tmpl_rules_t co * - 0 on success. * - -1 on failure. */ -typedef int (*call_env_parse_section_t)(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_parser_t const *rule); +typedef int (*call_env_parse_section_t)(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, char const *section_name1, char const *section_name2, call_env_parser_t const *rule); /** Per method call config * diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index edbbaec0d12..d4b67f78875 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -43,7 +43,7 @@ RCSID("$Id$") extern module_rlm_t rlm_cache; static int cache_key_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, char const *section_name1, char const *section_name2, void const *data, call_env_parser_t const *rule); -static int cache_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_parser_t const *rule); +static int cache_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, UNUSED call_env_parser_t const *rule); static const conf_parser_t module_config[] = { { FR_CONF_OFFSET_TYPE_FLAGS("driver", FR_TYPE_VOID, 0, rlm_cache_t, driver_submodule), .dflt = "rbtree", @@ -1402,7 +1402,9 @@ static int cache_verify(map_t *map, void *uctx) return 0; } -static int cache_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_parser_t const *rule) +static int cache_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, + CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, + UNUSED call_env_parser_t const *rule) { CONF_SECTION *update = cf_item_to_section(ci); call_env_parsed_t *parsed; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 555b50dd1d9..08baccbd2d4 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -427,7 +427,8 @@ static int call_env_filename_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t cons } static int call_env_suppress_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, - CONF_ITEM *ci, UNUSED call_env_parser_t const *rule) + CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, + UNUSED call_env_parser_t const *rule) { CONF_SECTION const *cs = cf_item_to_section(ci); CONF_SECTION const *parent = cf_item_to_section(cf_parent(ci)); diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 5d048e90dd3..8485f79909b 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -72,7 +72,7 @@ typedef struct { map_list_t *profile_map; //!< List of maps to apply to the profile. } ldap_xlat_profile_call_env_t; -static int ldap_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_parser_t const *rule); +static int ldap_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, UNUSED call_env_parser_t const *rule); static int ldap_group_filter_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, void const *data, UNUSED call_env_parser_t const *rule); @@ -2378,7 +2378,9 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static int ldap_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_parser_t const *rule) +static int ldap_update_section_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, + CONF_ITEM *ci, UNUSED char const *section_name1, UNUSED char const *section_name2, + call_env_parser_t const *rule) { map_list_t *maps; CONF_SECTION *update = cf_item_to_section(ci);