]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Advance arg in the xlat argument tokenizer...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 9 Nov 2024 14:57:17 +0000 (08:57 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 9 Nov 2024 14:58:44 +0000 (08:58 -0600)
src/lib/unlang/xlat_redundant.c
src/lib/unlang/xlat_tokenize.c
src/tests/keywords/urlquote

index bd9b8aa1e5e13fa78484e24ea10e12c52386d763..8dfe66b78d94cc6aca27a7a0091967ff98781eae 100644 (file)
@@ -338,7 +338,7 @@ static int xlat_redundant_instantiate(xlat_inst_ctx_t const *xctx)
 }
 
 static xlat_arg_parser_t const xlat_redundant_args[] = {
-       { .type = FR_TYPE_VOID },
+       { .type = FR_TYPE_VOID, .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP },
        XLAT_ARG_PARSER_TERMINATOR
 };
 
index 038bbf7c826b06cdedf45eaa17df3ea5e20baa10..037257d3ff485b5fb4cc6e1cb5ab236a8fcc1291 100644 (file)
@@ -1445,9 +1445,7 @@ fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbuff_t
                if (comma) {
                        fr_assert(p_rules && p_rules->terminals);
 
-                       if (fr_sbuff_next_if_char(&our_in, ',')) {
-                               continue;
-                       }
+                       if (fr_sbuff_next_if_char(&our_in, ',')) goto next;
 
                        if (fr_sbuff_is_char(&our_in, ')')) break;
 
@@ -1469,11 +1467,11 @@ fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbuff_t
                        fr_strerror_const("Unexpected text after argument");
                        goto error;
                }
-
+       next:
                if (!arg->variadic) {
                        arg++;
                        if (arg->type == FR_TYPE_NULL) {
-                               fr_strerror_printf("Too many arguments, expected %u", argc - 1);
+                               fr_strerror_printf("Too many arguments, expected %u additional", argc - 1);
                                goto error;
                        }
                }
index b93714bf9938cc709335a64e7078c63b444931ad..2e76e71525f65a9b26285c6474bb0b3f1e5cb896 100644 (file)
@@ -45,7 +45,7 @@ if (!(result_string == test_string3)) {
        test_fail
 }
 
-result_string := "%urlunquote(%%E,123)"
+result_string := "%urlunquote('%%E, 123')"
 
 # Test decoding invalid encoded string
 if !(result_string == "") {