]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
mark safe_for recursively
authorAlan T. DeKok <aland@freeradius.org>
Mon, 14 Apr 2025 10:57:51 +0000 (06:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 14 Apr 2025 10:57:51 +0000 (06:57 -0400)
now that we have strings as groups

src/lib/unlang/xlat_redundant.c

index f6846ec28119ea0ee52df24e980e76e4e34564e9..e9d3767f6849fe9453592c73ca8bf02eaeb73827 100644 (file)
@@ -195,6 +195,20 @@ static xlat_action_t xlat_redundant(TALLOC_CTX *ctx, fr_dcursor_t *out,
        return XLAT_ACTION_PUSH_UNLANG;
 }
 
+static void xlat_mark_safe_for(xlat_exp_head_t *head, fr_value_box_safe_for_t safe_for)
+{
+       xlat_exp_foreach(head, node) {
+               if (node->type == XLAT_BOX) {
+                       fr_value_box_mark_safe_for(&node->data, safe_for);
+                       continue;
+               }
+
+               if (node->type == XLAT_GROUP) {
+                       xlat_mark_safe_for(node->group, safe_for);
+               }
+       }
+}
+
 /** Allocate an xlat node to call an xlat function
  *
  * @param[in] ctx      to allocate the new node in.
@@ -246,9 +260,7 @@ static xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t const *func, xlat
                for (arg_p = node->call.func->args; arg_p->type != FR_TYPE_NULL; arg_p++) {
                        if (!arg) break;
 
-                       xlat_exp_foreach(arg->group, child) {
-                               if (child->type == XLAT_BOX) fr_value_box_mark_safe_for(&child->data, arg_p->safe_for);
-                       }
+                       xlat_mark_safe_for(arg->group, arg_p->safe_for);
 
                        arg = xlat_exp_next(node->call.args, arg);
                }