From 7c01590237c811a935a9e37cc2445c4d0d69e56c Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Tue, 29 Jul 2025 10:43:05 +0100 Subject: [PATCH] map_to_request expects the value callback to only create the leaf pair It does the job of creating any interim structural pairs required --- src/lib/unlang/map_builtin.c | 5 +++-- src/modules/rlm_sql/rlm_sql.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/unlang/map_builtin.c b/src/lib/unlang/map_builtin.c index 97fec54e1b..1cdbbeb50b 100644 --- a/src/lib/unlang/map_builtin.c +++ b/src/lib/unlang/map_builtin.c @@ -48,14 +48,15 @@ static int _list_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_pair_t *vp; fr_value_box_t *value = talloc_get_type_abort(uctx, fr_value_box_t); - vp = fr_pair_afrom_da_nested(ctx, out, tmpl_attr_tail_da(map->lhs)); + vp = fr_pair_afrom_da(ctx, tmpl_attr_tail_da(map->lhs)); if (!vp) return -1; if (fr_value_box_cast(vp, &vp->data, vp->data.type, vp->da, value) < 0) { RPEDEBUG("Failed casting \"%pV\" for attribute %s", value, vp->da->name); - fr_pair_delete(out, vp); + talloc_free(vp); return -1; } + fr_pair_append(out, vp); return 0; } diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index b16670521b..887ff72e7b 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -685,7 +685,7 @@ static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_pair_t *vp; char const *value = uctx; - vp = fr_pair_afrom_da_nested(ctx, out, tmpl_attr_tail_da(map->lhs)); + vp = fr_pair_afrom_da(ctx, tmpl_attr_tail_da(map->lhs)); if (!vp) return -1; /* @@ -695,9 +695,10 @@ static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, if (fr_pair_value_from_str(vp, value, strlen(value), NULL, true) < 0) { RPEDEBUG("Failed parsing value \"%pV\" for attribute %s", fr_box_strvalue_buffer(value), vp->da->name); - fr_pair_delete(out, vp); + talloc_free(vp); return -1; } + fr_pair_append(out, vp); return 0; } -- 2.47.2