]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
let's set can_purify here, too.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 May 2022 20:11:04 +0000 (16:11 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 20 May 2022 16:08:58 +0000 (12:08 -0400)
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

src/lib/unlang/xlat_expr.c

index 811bc681c306f7c64c062f0a9182e57e0201233e..3cfb8731c7644ce7a340040f42a6232f46c61cd6 100644 (file)
@@ -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;
 }