]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fix list_eval to return current from the cursor
authorAlan T. DeKok <aland@freeradius.org>
Fri, 29 Jul 2022 13:12:58 +0000 (09:12 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 Jul 2022 13:12:58 +0000 (09:12 -0400)
and not what was passed in.  This mirrors the child_eval function.

And remove the next_peek from NUM_LAST, which was unnecessary
and was causing breakage

src/lib/server/tmpl_dcursor.c

index 2950f0201a9baba232f8dbd11d68f88f98332ba6..1a91200c2453894ee753631c17630b5cc89e28ce 100644 (file)
@@ -107,10 +107,13 @@ void _tmpl_cursor_leaf_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_att
 /** Stub list eval function until we can remove lists
  *
  */
-static fr_pair_t *_tmpl_cursor_list_eval(UNUSED fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_dcursor_nested_t *ns)
+static fr_pair_t *_tmpl_cursor_list_eval(UNUSED fr_dlist_head_t *list_head, UNUSED fr_pair_t *current, tmpl_dcursor_nested_t *ns)
 {
+       fr_pair_t *vp;
+
+       vp = fr_dcursor_current(&ns->cursor);
        fr_dcursor_next(&ns->cursor);
-       return curr;
+       return vp;
 }
 
 static inline CC_HINT(always_inline)
@@ -181,8 +184,6 @@ fr_pair_t *_tmpl_cursor_eval(fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_d
                vp = NULL;
                while ((iter = ns->func(list_head, iter, ns))) {
                        vp = iter;
-
-                       if (!fr_dcursor_next_peek(&ns->cursor)) break;
                }
                _tmpl_cursor_common_pop(cc);
                break;