]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
make redundant xlats work
authorAlan T. DeKok <aland@freeradius.org>
Sun, 4 Dec 2022 14:33:04 +0000 (09:33 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 5 Dec 2022 16:08:22 +0000 (11:08 -0500)
via hackity hack,  The real solution is not to copy the input
(unexpanded) arguments.  Instead, the xlat_redundant() call
should simply copy it's expanded arguments, and call each
function in turn.

i.e. xlat_redundant() has no need to call xlat push or xlat
yield, as it already has all of the arguments it needs.

That also stops the inputs from being epanded repeatedly.

src/lib/unlang/xlat_builtin.c
src/tests/keywords/xlat-redundant

index d9b0319add4124df435b0b8f8283e9fd1ebd7771..28ef3a6e0d1d399b3c15246d6fdea007ceec29fe 100644 (file)
@@ -801,7 +801,7 @@ static int xlat_redundant_instantiate(xlat_inst_ctx_t const *xctx)
         *      a copy of the original arguments with each
         *      function that's called.
         */
-       fr_dlist_talloc_free(&xctx->ex->call.args->dlist);
+//     fr_dlist_talloc_free(&xctx->ex->call.args->dlist);
 
        return 0;
 }
index 6e48ed7455d7b827247450b693a2640dabd2e953..e552cf9f318477f3bed3435008fdcf84e6209206 100644 (file)
@@ -2,7 +2,18 @@
 #
 #  PRE: if
 #
-if ("%(concat:%(redundant_test:foo bar) '|')" != "foo|bar") {
+if (!(%(concat:%(test1:foo bar) '|') == "foo|bar")) {
+       test_fail
+}
+
+if (!(%(concat:%(test2:foo bar) '|') == "foo|bar")) {
+       test_fail
+}
+
+#
+#  The config has a "redundant" block for test1 and test2.
+#
+if (!(%(concat:%(redundant_test:foo bar) '|') == "foo|bar")) {
        test_fail
 }