]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move "foreach" to use tmpl_attr_set_leaf_num()
authorAlan T. DeKok <aland@freeradius.org>
Sun, 1 Sep 2024 12:04:36 +0000 (08:04 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 1 Sep 2024 12:04:36 +0000 (08:04 -0400)
and move tmpl_attr_set_leaf_num() to set the filter type, too

src/lib/server/tmpl_tokenize.c
src/lib/unlang/compile.c

index f365147b1c15fe9c98d21fd1a0d20931f915615b..88b80d17f71af4922041cd9831853ddd3a529987 100644 (file)
@@ -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);
index e30bbf6b80ef80020607c17e2068ee6eeb06feb4..21d6a2f6d075ae7fb9bd54bc0f33c0120e4e8354 100644 (file)
@@ -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) {