From: Nick Porter Date: Tue, 29 Jul 2025 09:43:05 +0000 (+0100) Subject: map_to_request expects the value callback to only create the leaf pair X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c01590237c811a935a9e37cc2445c4d0d69e56c;p=thirdparty%2Ffreeradius-server.git map_to_request expects the value callback to only create the leaf pair It does the job of creating any interim structural pairs required --- 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; }