From: Alan T. DeKok Date: Tue, 18 May 2021 17:15:26 +0000 (-0400) Subject: add parent map to map_afrom_cp() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a26e40952e17c4447c42fe33802c39cefa8d9ce3;p=thirdparty%2Ffreeradius-server.git add parent map to map_afrom_cp() this function is only called by map.c, so it could likely be private to that file. --- diff --git a/src/lib/server/map.c b/src/lib/server/map.c index d445f1b1314..70a8e754319 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -80,6 +80,7 @@ static inline map_t *map_alloc(TALLOC_CTX *ctx, map_t *parent) * * @param[in] ctx for talloc. * @param[in] out Where to write the pointer to the new #map_t. + * @param[in] parent the parent map * @param[in] cp to convert to map. * @param[in] lhs_rules rules for parsing LHS attribute references. * @param[in] rhs_rules rules for parsing RHS attribute references. @@ -87,7 +88,7 @@ static inline map_t *map_alloc(TALLOC_CTX *ctx, map_t *parent) * - #map_t if successful. * - NULL on error. */ -int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp, +int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, map_t *parent, CONF_PAIR *cp, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules) { map_t *map; @@ -99,7 +100,7 @@ int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp, if (!cp) return -1; - MEM(map = map_alloc(ctx, NULL)); + MEM(map = map_alloc(ctx, parent)); map->op = cf_pair_operator(cp); map->ci = cf_pair_to_item(cp); @@ -638,7 +639,7 @@ int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs, cp = cf_item_to_pair(ci); fr_assert(cp != NULL); - if (map_afrom_cp(parent, &map, cp, &our_lhs_rules, rhs_rules) < 0) { + if (map_afrom_cp(parent, &map, NULL, cp, &our_lhs_rules, rhs_rules) < 0) { cf_log_err(ci, "Failed creating map from '%s = %s'", cf_pair_attr(cp), cf_pair_value(cp)); goto error; diff --git a/src/lib/server/map.h b/src/lib/server/map.h index 77f9df4b4e5..4ae5098c9b2 100644 --- a/src/lib/server/map.h +++ b/src/lib/server/map.h @@ -112,7 +112,7 @@ typedef int (*map_validate_t)(map_t *map, void *ctx); typedef int (*radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx); -int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp, +int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, map_t *parent, CONF_PAIR *cp, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules); int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs,