From: Alan T. DeKok Date: Thu, 19 May 2022 20:11:04 +0000 (-0400) Subject: let's set can_purify here, too. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=584ef8d06b917f482a8bf60355e7a24c0906a0e5;p=thirdparty%2Ffreeradius-server.git let's set can_purify here, too. Note that we don't deal well with an N-ary operation which starts off with pure children, and then has impure children later appended. That needs a bit more thinking --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 811bc681c30..3cfb8731c76 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -740,6 +740,7 @@ static ssize_t tokenize_regex(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuff_ } *out = node; + node->flags.pure = tmpl_is_data(node->vpt); xlat_flags_merge(&head->flags, &node->flags); return fr_sbuff_used(&our_in); @@ -818,6 +819,7 @@ static ssize_t tokenize_unary(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuff_ xlat_exp_insert_tail(unary->call.args, node); xlat_flags_merge(&unary->flags, &unary->call.args->flags); + unary->flags.can_purify = unary->call.func->flags.pure && unary->call.args->flags.pure; /* * Don't add it to head->flags, that will be done when it's actually inserted. @@ -1218,6 +1220,8 @@ redo: fr_assert(xlat_exp_head(node->call.args) != NULL); + node->flags.can_purify = node->call.func->flags.pure && node->call.args->flags.pure; + lhs = node; goto redo; }