]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move common code to tokenize word
authorAlan T. DeKok <aland@freeradius.org>
Sat, 12 Apr 2025 12:56:35 +0000 (08:56 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 12 Apr 2025 12:56:35 +0000 (08:56 -0400)
src/lib/unlang/xlat_expr.c
src/lib/unlang/xlat_tokenize.c

index a453d24aba63ae98d9afa04c4a89c7baf3b668f0..d13c8739985bebcb782e9bc1f0b8a4bafae91bf3 100644 (file)
@@ -2402,10 +2402,7 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
                        fr_sbuff_advance(&our_in, -slen);
                        FR_SBUFF_ERROR_RETURN(&our_in);
                }
-               if (slen > 0) {
-                       *out = node;
-                       FR_SBUFF_SET_RETURN(in, &our_in);
-               }
+               if (slen > 0) goto done;
                FALL_THROUGH;
 
        default:
@@ -2535,13 +2532,6 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
                }
        }
 
-       /*
-        *      Assign the tmpl to the node.
-        */
-       xlat_exp_set_name_shallow(node, vpt->name);
-
-       node->flags.needs_resolving = tmpl_needs_resolving(node->vpt);
-
        fr_assert(!tmpl_contains_regex(vpt));
 
 done:
index baf23553b1a153b896b9c9e56e2097eef885d344..943d41d5a83c429abf21ecc1f89e7a2d83582db4 100644 (file)
@@ -1466,6 +1466,9 @@ fr_slen_t xlat_tokenize_word(TALLOC_CTX *ctx, xlat_exp_t **out, fr_sbuff_t *in,
                        FR_SBUFF_ERROR_RETURN(&our_in);
                }
 
+               xlat_exp_set_name_shallow(node, node->vpt->name);
+               node->flags.needs_resolving = tmpl_needs_resolving(node->vpt);
+
                if (xlat_tmpl_normalize(node) < 0) goto error;
 
                if (quote == T_BARE_WORD) goto done;