From d36dc103915009b93ed77b58bdeada6eb657bf51 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sun, 1 Sep 2024 08:04:36 -0400 Subject: [PATCH] move "foreach" to use tmpl_attr_set_leaf_num() and move tmpl_attr_set_leaf_num() to set the filter type, too --- src/lib/server/tmpl_tokenize.c | 1 + src/lib/unlang/compile.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index f365147b1c..88b80d17f7 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -1180,6 +1180,7 @@ void tmpl_attr_set_leaf_num(tmpl_t *vpt, int16_t num) ar = tmpl_attr_list_tail(tmpl_attr(vpt)); } + ar->ar_filter_type = TMPL_ATTR_FILTER_TYPE_INDEX; ar->ar_num = num; TMPL_ATTR_VERIFY(vpt); diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index e30bbf6b80..21d6a2f6d0 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -3297,7 +3297,7 @@ static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, if (tmpl_attr_tail_num(vpt) == NUM_UNSPEC) { cf_log_warn(cs, "Attribute reference should be updated to use %s[*]", vpt->name); - tmpl_attr_rewrite_leaf_num(vpt, NUM_UNSPEC, NUM_ALL); + tmpl_attr_set_leaf_num(vpt, NUM_ALL); } if (tmpl_attr_tail_num(vpt) != NUM_ALL) { -- 2.47.2