From: Arran Cudbard-Bell Date: Wed, 1 Dec 2021 14:55:17 +0000 (-0600) Subject: Use correct calling convention for redundant_test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c8d80b4c7514476b13e1a0745c0f42a72bb5f4a;p=thirdparty%2Ffreeradius-server.git Use correct calling convention for redundant_test --- diff --git a/src/modules/rlm_test/rlm_test.c b/src/modules/rlm_test/rlm_test.c index a3b48dc2af5..265d2160863 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -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 index bc63c937c64..00000000000 --- a/src/tests/keywords/virtual_xlat +++ /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 index 00000000000..6e48ed7455d --- /dev/null +++ b/src/tests/keywords/xlat-redundant @@ -0,0 +1,9 @@ +# +# +# PRE: if +# +if ("%(concat:%(redundant_test:foo bar) '|')" != "foo|bar") { + test_fail +} + +success