From: Alan T. DeKok Date: Sat, 12 Apr 2025 12:56:35 +0000 (-0400) Subject: move common code to tokenize word X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35544ba6672a41251f2a7b9f073d573aa25c092f;p=thirdparty%2Ffreeradius-server.git move common code to tokenize word --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index a453d24aba6..d13c8739985 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -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: diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index baf23553b1a..943d41d5a83 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -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;