From e74d2ced5617e328915433f258a48975df614572 Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Tue, 16 Apr 2024 17:42:10 +0100 Subject: [PATCH] Pass module instance data to call env section custom parser --- src/lib/unlang/call_env.c | 2 +- src/lib/unlang/call_env.h | 2 +- src/modules/rlm_cache/rlm_cache.c | 4 ++-- src/modules/rlm_detail/rlm_detail.c | 2 +- src/modules/rlm_ldap/rlm_ldap.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/unlang/call_env.c b/src/lib/unlang/call_env.c index 42e8f7da68..6817949129 100644 --- a/src/lib/unlang/call_env.c +++ b/src/lib/unlang/call_env.c @@ -422,7 +422,7 @@ 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), section_name1, - section_name2, rule) < 0) { + section_name2, data, 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 e90ccb10e6..ed81d1834c 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, char const *section_name1, char const *section_name2, 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, void const *data, 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 d4b67f7887..e2192ab223 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 char const *section_name1, UNUSED char const *section_name2, 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, char const *section_name1, char const *section_name2, void const *data, 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", @@ -1404,7 +1404,7 @@ static int cache_verify(map_t *map, void *uctx) 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) + UNUSED void const *data, 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 08baccbd2d..0c39266cde 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -428,7 +428,7 @@ 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 char const *section_name1, UNUSED char const *section_name2, - UNUSED call_env_parser_t const *rule) + UNUSED void const *data, 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 8485f79909..fc789e2174 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 char const *section_name1, UNUSED char const *section_name2, 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, char const *section_name1, char const *section_name2, void const *data, 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); @@ -2380,7 +2380,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) 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) + UNUSED void const *data, call_env_parser_t const *rule) { map_list_t *maps; CONF_SECTION *update = cf_item_to_section(ci); -- 2.47.3