]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
%regex() takes variadic args
authorAlan T. DeKok <aland@freeradius.org>
Sun, 9 Mar 2025 16:48:31 +0000 (12:48 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 9 Mar 2025 18:05:24 +0000 (14:05 -0400)
src/lib/unlang/xlat_builtin.c

index 61a748d1203e68ddaa49d0618e30f85b3aa2dfcc..3fb075e0b7e5f660a37e7343ed50a7496966fb11 100644 (file)
@@ -2662,6 +2662,12 @@ static xlat_action_t xlat_func_randstr(TALLOC_CTX *ctx, fr_dcursor_t *out,
 
 
 #if defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
+static xlat_arg_parser_t const xlat_func_regex_args[] = {
+       { .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP, .type = FR_TYPE_VOID },
+       XLAT_ARG_PARSER_TERMINATOR
+};
+
+
 /** Get named subcapture value from previous regex
  *
  * Example:
@@ -4187,6 +4193,7 @@ do { \
        XLAT_REGISTER_PURE("md5", xlat_func_md5, FR_TYPE_OCTETS, xlat_func_md5_arg);
 #if defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
        if (unlikely((xlat = xlat_func_register(xlat_ctx, "regex", xlat_func_regex, FR_TYPE_STRING)) == NULL)) return -1;
+       xlat_func_args_set(xlat, xlat_func_regex_args);
        xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL);
 #endif