]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Catch logic errors sooner in tmpl_extents_find
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 3 Nov 2021 20:20:11 +0000 (16:20 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 3 Nov 2021 20:20:11 +0000 (16:20 -0400)
src/lib/server/tmpl_eval.c

index 7130ccddde78c54671477474d4396614012362f2..20e9addafa6e69e45518ffc0cc469837959672f3 100644 (file)
@@ -1452,7 +1452,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx,
        if (vpt->type == TMPL_TYPE_LIST) {
        do_list:
                if (leaf) EXTENT_ADD(leaf, NULL, list_ctx, list_head);
-               return 0;
+               goto done;
        }
 
        /*
@@ -1543,6 +1543,17 @@ int tmpl_extents_find(TALLOC_CTX *ctx,
                }
        }
 
+done:
+       /*
+        *      If we were asked to provide interior
+        *      and leaf lists, and there's no result
+        *      in either, then that's a logic error.
+        *
+        *      We either have an attribute or will
+        *      need to build out pairs to it.
+        */
+       fr_assert(!leaf || !interior || (fr_dlist_num_elements(leaf) > 0) || (fr_dlist_num_elements(interior) > 0));
+
        return 0;
 }