]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
skip whitespace for comma-separated argv
authorAlan T. DeKok <aland@freeradius.org>
Fri, 17 Nov 2023 14:16:57 +0000 (09:16 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 17 Nov 2023 14:53:43 +0000 (09:53 -0500)
src/lib/unlang/xlat_tokenize.c

index 26d146d1a5fab78ae8579ea99e2f837fb8e8d363..67ab48c34b17c8698b4b62d8d33cdb610021f586 100644 (file)
@@ -1609,35 +1609,10 @@ fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbuff_t
                fr_sbuff_set(&m, &our_in);      /* Record start of argument */
                argc++;
 
-#if 0
-               if (comma) {
-                       fr_assert(p_rules && p_rules->terminals);
-
-                       MEM(node = xlat_exp_alloc(head, XLAT_GROUP, NULL, 0));
-                       if (xlat_tokenize_expression(node, &node->group, &our_in, p_rules, t_rules) <= 0) goto error;
-
-                       fmt = talloc_bstrndup(node, fr_sbuff_current(&m), fr_sbuff_behind(&m));
-                       xlat_exp_set_name_buffer_shallow(node, fmt);
-
-                       node->flags = node->group->flags;
-                       node->quote = T_BARE_WORD;
-
-                       xlat_debug(node);
-
-                       xlat_exp_insert_tail(head, node);
-                       fr_sbuff_set(&m, &our_in);
-
-                       if (fr_sbuff_next_if_char(&our_in, ',')) {
-                               fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX, NULL);
-                               continue;
-                       }
-
-                       if (fr_sbuff_is_char(&our_in, ')')) break;
-
-                       fr_strerror_printf("Unexpected text after argument %d", argc);
-                       goto error;
-               }
-#endif
+               /*
+                *      Whitespace isn't significant for comma-separated argvs
+                */
+               if (comma) fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX, NULL);
 
                fr_sbuff_out_by_longest_prefix(&slen, &quote, xlat_quote_table, &our_in, T_BARE_WORD);
 
@@ -1759,7 +1734,6 @@ fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbuff_t
                        fr_assert(p_rules && p_rules->terminals);
 
                        if (fr_sbuff_next_if_char(&our_in, ',')) {
-                               fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX, NULL);
                                continue;
                        }