]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
':' is no longer special in xlats
authorAlan T. DeKok <aland@freeradius.org>
Tue, 26 Mar 2024 15:29:47 +0000 (11:29 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 26 Mar 2024 15:29:47 +0000 (11:29 -0400)
src/lib/unlang/xlat_tokenize.c
src/tests/unit/xlat/base.txt

index 202e8acfb8c5d50d27dc113ef39e91455cd87e16..a9d52aa29e52d37716caf1be9bc54fe5f939f319 100644 (file)
@@ -492,7 +492,7 @@ static int xlat_tokenize_attribute(xlat_exp_head_t *head, fr_sbuff_t *in,
        MEM(node = xlat_exp_alloc_null(head));
        if (tmpl_afrom_attr_substr(node, &err, &vpt, in, p_rules, &our_t_rules) < 0) {
                /*
-                *      If the parse error occurred before the ':'
+                *      If the parse error occurred before a terminator,
                 *      then the error is changed to 'Unknown module',
                 *      as it was more likely to be a bad module name,
                 *      than a request qualifier.
@@ -569,7 +569,6 @@ int xlat_tokenize_expansion(xlat_exp_head_t *head, fr_sbuff_t *in,
        char                    hint;
        fr_sbuff_term_t         hint_tokens = FR_SBUFF_TERMS(
                                        L(" "),         /* First special token is a ' ' - Likely a syntax error */
-                                       L(":"),         /* First special token is a ':' i.e. '%{func:' */
                                        L("["),         /* First special token is a '[' i.e. '%{attr[<idx>]}' */
                                        L("}")          /* First special token is a '}' i.e. '%{<attrref>}' */
                                );
@@ -601,20 +600,10 @@ int xlat_tokenize_expansion(xlat_exp_head_t *head, fr_sbuff_t *in,
 
 #endif /* HAVE_REGEX */
 
-       /*
-        *      See if it's an old-style function name.
-        */
-       fr_sbuff_marker(&s_m, in);
-       len = fr_sbuff_adv_past_allowed(in, SIZE_MAX, xlat_func_chars, NULL);
-       if (fr_sbuff_is_char(in, ':')) {
-               if (!len) goto missing_function;
-               goto check_for_attr;
-       }
-
        /*
         *      See if it's an attribute reference, with possible array stuff.
         */
-       len += fr_sbuff_adv_past_allowed(in, SIZE_MAX, tmpl_attr_allowed_chars, NULL);
+       len = fr_sbuff_adv_past_allowed(in, SIZE_MAX, tmpl_attr_allowed_chars, NULL);
        if (fr_sbuff_is_char(in, '}')) {
                if (!len) goto empty_disallowed;
                goto check_for_attr;
@@ -715,11 +704,6 @@ check_for_attr:
                        fr_strerror_const("Empty expression is invalid");
                        return -1;
 
-               case ':':
-               missing_function:
-                       fr_strerror_const("Missing expansion function");
-                       return -1;
-
                case '[':
                        fr_strerror_const("Missing attribute name");
                        return -1;
index 2255a0b38d7cad71e34af20ff413e8377bba0dc1..95a4cdba138eb130319cadbebc0b3987985f7060 100644 (file)
@@ -158,10 +158,10 @@ xlat %{}
 match ERROR offset 3: Empty expression is invalid
 
 xlat %{:}
-match ERROR offset 3: Missing expansion function
+match ERROR offset 3: No operand found.  Expected &ref, literal, 'quoted literal', "%{expansion}", or enum value
 
 xlat %{:bar}
-match ERROR offset 3: Missing expansion function
+match ERROR offset 3: No operand found.  Expected &ref, literal, 'quoted literal', "%{expansion}", or enum value
 
 xlat %foo(' bar')
 match ERROR offset 2: Unresolved expansion functions are not allowed here