]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use correct calling convention for redundant_test
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Dec 2021 14:55:17 +0000 (08:55 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Dec 2021 20:07:07 +0000 (14:07 -0600)
src/modules/rlm_test/rlm_test.c
src/tests/keywords/virtual_xlat [deleted file]
src/tests/keywords/xlat-redundant [new file with mode: 0644]

index a3b48dc2af5f3b70add9c163a467f2f1a98c6d8a..265d216086345187d9fda19ae1b91c7f41fc9d2a 100644 (file)
@@ -379,7 +379,7 @@ static xlat_action_t trigger_test_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, reque
 
 
 static xlat_arg_parser_t const test_xlat_args[] = {
-       { .required = true, .concat = true, .type = FR_TYPE_STRING },
+       { .required = true, .concat = true, .variadic = true, .type = FR_TYPE_STRING },
        XLAT_ARG_PARSER_TERMINATOR
 };
 
@@ -392,17 +392,19 @@ static xlat_action_t test_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED reques
                                       UNUSED void const *xlat_inst, UNUSED void *xlat_thread_inst,
                                       fr_value_box_list_t *in)
 {
-       fr_value_box_t  *in_head = fr_dlist_head(in);
+       fr_value_box_t  *vb_p = NULL;
        fr_value_box_t  *vb;
 
-       MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL, false));
+       while ((vb_p = fr_dlist_next(in, vb_p))) {
+               MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL, false));
 
-       if (fr_value_box_copy(ctx, vb, in_head) < 0) {
-               talloc_free(vb);
-               return XLAT_ACTION_FAIL;
-       }
+               if (fr_value_box_copy(ctx, vb, vb_p) < 0) {
+                       talloc_free(vb);
+                       return XLAT_ACTION_FAIL;
+               }
 
-       fr_dcursor_append(out, vb);
+               fr_dcursor_append(out, vb);
+       }
 
        return XLAT_ACTION_DONE;
 }
diff --git a/src/tests/keywords/virtual_xlat b/src/tests/keywords/virtual_xlat
deleted file mode 100644 (file)
index bc63c93..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-#  PRE: if
-#
-if ("%{redundant_test:foo bar}" != "foo bar") {
-       test_fail
-}
-
-success
diff --git a/src/tests/keywords/xlat-redundant b/src/tests/keywords/xlat-redundant
new file mode 100644 (file)
index 0000000..6e48ed7
--- /dev/null
@@ -0,0 +1,9 @@
+#
+#
+#  PRE: if
+#
+if ("%(concat:%(redundant_test:foo bar) '|')" != "foo|bar") {
+       test_fail
+}
+
+success