From: Alan T. DeKok Date: Wed, 20 Apr 2022 15:17:51 +0000 (-0400) Subject: move function args and groups to their own members X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1029ddf67e09f3bd8b863cdd348091d6e0c1a07;p=thirdparty%2Ffreeradius-server.git move function args and groups to their own members in preparation for moving to tlists --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index cbe2e682f7d..0829e20575c 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -746,7 +746,7 @@ static int xlat_redundant_instantiate(xlat_inst_ctx_t const *xctx) * for the new node can operate * correctly. */ - MEM(node = xlat_exp_func_alloc(xri->ex, xrf->func, xctx->ex->child)); + MEM(node = xlat_exp_func_alloc(xri->ex, xrf->func, xctx->ex->call.args)); switch (xrf->func->input_type) { case XLAT_INPUT_UNPROCESSED: @@ -790,7 +790,7 @@ static int xlat_redundant_instantiate(xlat_inst_ctx_t const *xctx) * a copy of the original arguments with each * function that's called. */ - xlat_exp_free(&xctx->ex->child); + xlat_exp_free(&xctx->ex->call.args); return 0; } diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index 650c4812abd..bb2311d90c0 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -123,7 +123,7 @@ static char *xlat_fmt_aprint(TALLOC_CTX *ctx, xlat_exp_t const *node) case XLAT_FUNC: { - xlat_exp_t const *child = node->child; + xlat_exp_t const *arg = node->call.args; char *out, *n_out; TALLOC_CTX *pool; char open = '{', close = '}'; @@ -133,15 +133,15 @@ static char *xlat_fmt_aprint(TALLOC_CTX *ctx, xlat_exp_t const *node) open = '('; close = ')'; } - if (!child) return talloc_asprintf(ctx, "%%%c%s:%c", open, node->call.func->name, close); + if (!arg) return talloc_asprintf(ctx, "%%%c%s:%c", open, node->call.func->name, close); out = talloc_asprintf(ctx, "%%%c%s:", open, node->call.func->name); pool = talloc_pool(NULL, 128); /* Size of a single child (probably ok...) */ do { - char *child_str; + char *arg_str; - child_str = xlat_fmt_aprint(pool, child); - if (child_str) { + arg_str = xlat_fmt_aprint(pool, arg); + if (arg_str) { if ((first_done) && (node->call.func->input_type == XLAT_INPUT_ARGS)) { n_out = talloc_strdup_append_buffer(out, " "); if (!n_out) { @@ -153,13 +153,13 @@ static char *xlat_fmt_aprint(TALLOC_CTX *ctx, xlat_exp_t const *node) out = n_out; } - n_out = talloc_buffer_append_buffer(ctx, out, child_str); + n_out = talloc_buffer_append_buffer(ctx, out, arg_str); if (!n_out) goto child_error; out = n_out; first_done = true; } talloc_free_children(pool); /* Clear pool contents */ - } while ((child = child->next)); + } while ((arg = arg->next)); talloc_free(pool); n_out = talloc_strndup_append_buffer(out, &close, 1); @@ -209,7 +209,7 @@ static inline void xlat_debug_log_expansion(request_t *request, xlat_exp_t const * we print the concatenated arguments list as * well as the original fmt string. */ - if ((node->type == XLAT_FUNC) && !xlat_is_literal(node->child)) { + if ((node->type == XLAT_FUNC) && !xlat_is_literal(node->call.args)) { RDEBUG2(" (%%%c%s:%pM%c)", (node->call.func->input_type == XLAT_INPUT_ARGS) ? '(' : '{', node->call.func->name, args, @@ -1290,8 +1290,8 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_t con * Hand back the child node to the caller * for evaluation. */ - if (node->child) { - *child = node->child; + if (node->call.args) { + *child = node->call.args; xa = XLAT_ACTION_PUSH_CHILD; goto finish; } @@ -1329,7 +1329,6 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_t con case XLAT_ALTERNATE: XLAT_DEBUG("** [%i] %s(alternate) - %%{%%{%s}:-%%{%s}}", unlang_interpret_stack_depth(request), __FUNCTION__, node->alternate[0]->fmt, node->alternate[1]->fmt); - fr_assert(node->child == NULL); fr_assert(node->alternate[0] != NULL); fr_assert(node->alternate[1] != NULL); @@ -1340,13 +1339,13 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_t con case XLAT_GROUP: XLAT_DEBUG("** [%i] %s(child) - %%{%s ...}", unlang_interpret_stack_depth(request), __FUNCTION__, node->fmt); - if (!node->child) return XLAT_ACTION_DONE; + if (!node->group) return XLAT_ACTION_DONE; /* * Hand back the child node to the caller * for evaluation. */ - *child = node->child; + *child = node->group; xa = XLAT_ACTION_PUSH_CHILD; goto finish; @@ -1629,7 +1628,7 @@ int xlat_aeval_compiled_argv(TALLOC_CTX *ctx, char ***argv, request_t *request, for (i = 0, node = xlat; node != NULL; i++, node = node->next) { my_argv[i] = NULL; - slen = _xlat_eval_compiled(my_argv, &my_argv[i], 0, request, node->child, escape, escape_ctx); + slen = _xlat_eval_compiled(my_argv, &my_argv[i], 0, request, node->group, escape, escape_ctx); if (slen < 0) return -i; } @@ -1657,7 +1656,7 @@ int xlat_flatten_compiled_argv(TALLOC_CTX *ctx, xlat_exp_t const ***argv, xlat_e fr_assert(done_init); for (i = 0, node = xlat; node != NULL; i++, node = node->next) { - my_argv[i] = node->child; + my_argv[i] = node->group; } return count; @@ -1692,8 +1691,8 @@ int xlat_eval_walk(xlat_exp_t *exp, xlat_walker_t walker, xlat_type_t type, void /* * Now evaluate the function's arguments */ - if (node->child) { - ret = xlat_eval_walk(node->child, walker, type, uctx); + if (node->call.args) { + ret = xlat_eval_walk(node->call.args, walker, type, uctx); if (ret < 0) return ret; } break; @@ -1707,8 +1706,8 @@ int xlat_eval_walk(xlat_exp_t *exp, xlat_walker_t walker, xlat_type_t type, void /* * Now evaluate the function's arguments */ - if (node->child) { - ret = xlat_eval_walk(node->child, walker, type, uctx); + if (node->call.args) { + ret = xlat_eval_walk(node->call.args, walker, type, uctx); if (ret < 0) return ret; } break; @@ -1741,7 +1740,7 @@ int xlat_eval_walk(xlat_exp_t *exp, xlat_walker_t walker, xlat_type_t type, void /* * Evaluate the child. */ - ret = xlat_eval_walk(node->child, walker, type, uctx); + ret = xlat_eval_walk(node->group, walker, type, uctx); if (ret < 0) return ret; break; diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index de29636c336..cde34bee3a4 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -91,7 +91,7 @@ static fr_slen_t xlat_expr_print_unary(fr_sbuff_t *out, xlat_exp_t const *node, size_t at_in = fr_sbuff_used_total(out); FR_SBUFF_IN_STRCPY_RETURN(out, fr_tokens[node->call.func->token]); - xlat_print_node(out, node->child, e_rules); + xlat_print_node(out, node->call.args, e_rules); return fr_sbuff_used_total(out) - at_in; } @@ -101,7 +101,7 @@ static fr_slen_t xlat_expr_print_binary(fr_sbuff_t *out, xlat_exp_t const *node, size_t at_in = fr_sbuff_used_total(out); FR_SBUFF_IN_CHAR_RETURN(out, '('); - xlat_print_node(out, node->child, e_rules); /* prints a space after the first argument */ + xlat_print_node(out, node->call.args, e_rules); /* prints a space after the first argument */ /* * @todo - when things like "+" support more than 2 arguments, print them all out @@ -109,7 +109,7 @@ static fr_slen_t xlat_expr_print_binary(fr_sbuff_t *out, xlat_exp_t const *node, */ FR_SBUFF_IN_STRCPY_RETURN(out, fr_tokens[node->call.func->token]); FR_SBUFF_IN_CHAR_RETURN(out, ' '); - xlat_print_node(out, node->child->next, e_rules); + xlat_print_node(out, node->call.args->next, e_rules); FR_SBUFF_IN_CHAR_RETURN(out, ')'); @@ -123,9 +123,9 @@ static int CC_HINT(nonnull) xlat_purify_expr(xlat_exp_t *node) { int rcode = -1; xlat_t const *func; - xlat_exp_t *child; + xlat_exp_t *arg; fr_value_box_t *dst = NULL, *box; - xlat_arg_parser_t const *arg; + xlat_arg_parser_t const *arg_p; xlat_action_t xa; fr_value_box_list_t input, output; fr_dcursor_t cursor; @@ -155,11 +155,11 @@ static int CC_HINT(nonnull) xlat_purify_expr(xlat_exp_t *node) /* * A child isn't a value-box. We leave it alone. */ - for (child = node->child; child != NULL; child = child->next) { - fr_assert(child->type == XLAT_GROUP); + for (arg = node->call.args; arg != NULL; arg = arg->next) { + fr_assert(arg->type == XLAT_GROUP); - if (!xlat_is_box(child->child)) return 0; - if (child->child->next) return 0; + if (!xlat_is_box(arg->group)) return 0; + if (arg->group->next) return 0; } fr_value_box_list_init(&input); @@ -170,15 +170,15 @@ static int CC_HINT(nonnull) xlat_purify_expr(xlat_exp_t *node) * have to cast the box to the correct data type (or copy * it), and then add the box to the source list. */ - for (child = node->child, arg = func->args; - child != NULL; - child = child->next, arg++) { + for (arg = node->call.args, arg_p = func->args; + arg != NULL; + arg = arg->next, arg_p++) { MEM(box = fr_value_box_alloc_null(node)); - if ((arg->type != FR_TYPE_VOID) && (arg->type != box->type)) { - if (fr_value_box_cast(node, box, arg->type, NULL, xlat_box(child->child)) < 0) goto fail; + if ((arg_p->type != FR_TYPE_VOID) && (arg_p->type != box->type)) { + if (fr_value_box_cast(node, box, arg_p->type, NULL, xlat_box(arg->group)) < 0) goto fail; - } else if (fr_value_box_copy(node, box, xlat_box(child->child)) < 0) { + } else if (fr_value_box_copy(node, box, xlat_box(arg->group)) < 0) { fail: talloc_free(box); goto cleanup; @@ -203,9 +203,9 @@ static int CC_HINT(nonnull) xlat_purify_expr(xlat_exp_t *node) goto cleanup; } - while ((child = node->child) != NULL) { - node->child = child->next; - talloc_free(child); + while ((arg = node->call.args) != NULL) { + node->call.args = arg->next; + talloc_free(arg); } dst = fr_dcursor_head(&cursor); @@ -239,7 +239,7 @@ static xlat_exp_t *xlat_groupify_node(TALLOC_CTX *ctx, xlat_exp_t *node) group->quote = T_BARE_WORD; group->fmt = node->fmt; /* not entirely correct, but good enough for now */ - group->child = talloc_steal(group, node); + group->group = talloc_steal(group, node); group->flags = node->flags; if (node->next) { @@ -270,9 +270,9 @@ static void xlat_groupify_expr(xlat_exp_t *node) /* * It's already been groupified, don't do anything. */ - if (node->child->type == XLAT_GROUP) return; + if (node->call.args->type == XLAT_GROUP) return; - node->child = xlat_groupify_node(node, node->child); + node->call.args = xlat_groupify_node(node, node->call.args); } static xlat_arg_parser_t const binary_op_xlat_args[] = { @@ -417,7 +417,7 @@ static fr_slen_t xlat_expr_print_logical(fr_sbuff_t *out, xlat_exp_t const *node /* * We might get called before the node is instantiated. */ - if (!inst->args) current = node->child; + if (!inst->args) current = node->call.args; fr_assert(current != NULL); @@ -442,8 +442,8 @@ static int xlat_logical_instantiate(xlat_inst_ctx_t const *xctx) { xlat_logical_inst_t *inst = talloc_get_type_abort(xctx->inst, xlat_logical_inst_t); - inst->args = xctx->ex->child; - xctx->ex->child = NULL; + inst->args = xctx->ex->call.args; + xctx->ex->call.args = NULL; inst->sense = (xctx->ex->call.func->token == T_LOR); return 0; @@ -778,17 +778,17 @@ static const int precedence[T_TOKEN_LAST] = { static xlat_exp_t *xlat_exp_func_alloc_args(TALLOC_CTX *ctx, char const *name, size_t namelen, int argc) { int i; - xlat_exp_t *node, *child, **last; + xlat_exp_t *node, *arg, **last; MEM(node = xlat_exp_alloc(ctx, XLAT_FUNC, name, namelen)); - last = &node->child; + last = &node->call.args; for (i = 0; i < argc; i++) { - MEM(child = xlat_exp_alloc_null(node)); - xlat_exp_set_type(child, XLAT_GROUP); - child->quote = T_BARE_WORD; - *last = child; - last = &child->next; + MEM(arg = xlat_exp_alloc_null(node)); + xlat_exp_set_type(arg, XLAT_GROUP); + arg->quote = T_BARE_WORD; + *last = arg; + last = &arg->next; } return node; @@ -1106,7 +1106,7 @@ done: * @todo - purify the node. */ if (unary) { - unary->child = node; + unary->call.args = node; xlat_flags_merge(&unary->flags, &node->flags); node = unary; } @@ -1308,7 +1308,7 @@ redo: fr_assert(lhs->call.func == func); node = xlat_groupify_node(lhs, rhs); - last = &lhs->child; + last = &lhs->call.args; /* * Find the last child. @@ -1337,11 +1337,11 @@ redo: node->call.func = func; node->flags = func->flags; - node->child = xlat_groupify_node(node, lhs); - node->child->flags = lhs->flags; + node->call.args = xlat_groupify_node(node, lhs); + node->call.args->flags = lhs->flags; - node->child->next = xlat_groupify_node(node, rhs); - node->child->next->flags = rhs->flags; + node->call.args->next = xlat_groupify_node(node, rhs); + node->call.args->next->flags = rhs->flags; xlat_flags_merge(&node->flags, &lhs->flags); xlat_flags_merge(&node->flags, &rhs->flags); diff --git a/src/lib/unlang/xlat_priv.h b/src/lib/unlang/xlat_priv.h index 4268ec6c46c..15b28f495a0 100644 --- a/src/lib/unlang/xlat_priv.h +++ b/src/lib/unlang/xlat_priv.h @@ -98,6 +98,8 @@ typedef struct { ///< nodes by the time they were created. xlat_t const *func; //!< The xlat expansion to expand format with. + xlat_exp_t *args; //!< arguments to the function call + xlat_inst_t *inst; //!< Instance data for the #xlat_t. xlat_thread_inst_t *thread_inst; //!< Thread specific instance. ///< ONLY USED FOR EPHEMERAL XLATS. @@ -121,11 +123,11 @@ struct xlat_exp { xlat_type_t type; //!< type of this expansion. xlat_exp_t *next; //!< Next in the list. - xlat_exp_t *child; //!< Nested expansion, i.e. arguments for an xlat function. - union { xlat_exp_t *alternate[2]; //!< alternate expansions + xlat_exp_t *group; //!< children of a group + /** An tmpl_t reference * * May be an attribute to expand, or an exec reference, or a value-box, ... diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 74c5bd542ed..fd536da2c7a 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -122,7 +122,7 @@ xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_t const MEM(node = xlat_exp_alloc(ctx, XLAT_FUNC, func->name, strlen(func->name))); node->call.func = func; - if (unlikely(xlat_copy(node, &node->child, args) < 0)) { + if (unlikely(xlat_copy(node, &node->call.args, args) < 0)) { talloc_free(node); return NULL; } @@ -291,7 +291,7 @@ int xlat_validate_function_mono(xlat_exp_t *node) { fr_assert(node->type == XLAT_FUNC); - if (node->call.func->args && node->call.func->args->required && !node->child) { + if (node->call.func->args && node->call.func->args->required && !node->call.args) { fr_strerror_const("Missing required input"); return -1; } @@ -387,7 +387,7 @@ static inline int xlat_tokenize_function_mono(TALLOC_CTX *ctx, xlat_exp_t **head * Now parse the child nodes that form the * function's arguments. */ - if (xlat_tokenize_string(node, &node->child, &node->flags, in, true, &xlat_expansion_rules, rules) < 0) { + if (xlat_tokenize_string(node, &node->call.args, &node->flags, in, true, &xlat_expansion_rules, rules) < 0) { goto error; } @@ -410,14 +410,14 @@ static inline int xlat_tokenize_function_mono(TALLOC_CTX *ctx, xlat_exp_t **head int xlat_validate_function_args(xlat_exp_t *node) { xlat_arg_parser_t const *arg_p; - xlat_exp_t *child = node->child; + xlat_exp_t *arg = node->call.args; fr_assert(node->type == XLAT_FUNC); for (arg_p = node->call.func->args; arg_p->type != FR_TYPE_NULL; arg_p++) { if (!arg_p->required) break; - if (!child) { + if (!arg) { fr_strerror_printf("Missing required arg %u", (unsigned int)(arg_p - node->call.func->args) + 1); return -1; @@ -427,9 +427,9 @@ int xlat_validate_function_args(xlat_exp_t *node) * All arguments MUST be put into a group, even * if they're just one element. */ - fr_assert(child->type == XLAT_GROUP); + fr_assert(arg->type == XLAT_GROUP); - child = child->next; + arg = arg->next; } return 0; @@ -521,7 +521,7 @@ int xlat_tokenize_function_args(TALLOC_CTX *ctx, xlat_exp_t **head, * Now parse the child nodes that form the * function's arguments. */ - if (xlat_tokenize_argv(node, &node->child, &node->flags, in, &xlat_multi_arg_rules, rules) < 0) { + if (xlat_tokenize_argv(node, &node->call.args, &node->flags, in, &xlat_multi_arg_rules, rules) < 0) { goto error; } @@ -1054,7 +1054,7 @@ static void _xlat_debug(xlat_exp_t const *node, int depth) case XLAT_GROUP: INFO_INDENT("child \"%s\"", node->fmt); INFO_INDENT("{"); - _xlat_debug(node->child, depth + 1); + _xlat_debug(node->group, depth + 1); INFO_INDENT("}"); break; @@ -1065,7 +1065,6 @@ static void _xlat_debug(xlat_exp_t const *node, int depth) case XLAT_TMPL: fr_assert(tmpl_da(node->vpt) != NULL); INFO_INDENT("attribute (%s)", tmpl_da(node->vpt)->name); - fr_assert(node->child == NULL); if (tmpl_num(node->vpt) != NUM_ANY) { INFO_INDENT("{"); INFO_INDENT("ref %d", tmpl_request(node->vpt)); @@ -1096,18 +1095,18 @@ static void _xlat_debug(xlat_exp_t const *node, int depth) case XLAT_FUNC: fr_assert(node->call.func != NULL); INFO_INDENT("xlat (%s)", node->call.func->name); - if (node->child) { + if (node->call.args) { INFO_INDENT("{"); - _xlat_debug(node->child, depth + 1); + _xlat_debug(node->call.args, depth + 1); INFO_INDENT("}"); } break; case XLAT_FUNC_UNRESOLVED: INFO_INDENT("xlat-unresolved (%s)", node->fmt); - if (node->child) { + if (node->call.args) { INFO_INDENT("{"); - _xlat_debug(node->child, depth + 1); + _xlat_debug(node->call.args, depth + 1); INFO_INDENT("}"); } break; @@ -1119,7 +1118,6 @@ static void _xlat_debug(xlat_exp_t const *node, int depth) #endif case XLAT_ALTERNATE: - fr_assert(node->child == NULL); DEBUG("XLAT-IF {"); _xlat_debug(node->alternate[0], depth + 1); DEBUG("}"); @@ -1153,7 +1151,7 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_t const *head, fr_sbuff_escape switch (node->type) { case XLAT_GROUP: if (node->quote != T_BARE_WORD) FR_SBUFF_IN_CHAR_RETURN(out, fr_token_quote[node->quote]); - xlat_print(out, node->child, fr_value_escape_by_quote[node->quote]); + xlat_print(out, node->group, fr_value_escape_by_quote[node->quote]); if (node->quote != T_BARE_WORD) FR_SBUFF_IN_CHAR_RETURN(out, fr_token_quote[node->quote]); if (node->next) FR_SBUFF_IN_CHAR_RETURN(out, ' '); /* Add ' ' between args */ goto done; @@ -1243,8 +1241,8 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_t const *head, fr_sbuff_escape FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN(out, node->call.func->name); FR_SBUFF_IN_CHAR_RETURN(out, ':'); - if (node->child) { - slen = xlat_print(out, node->child, &xlat_escape); + if (node->call.args) { + slen = xlat_print(out, node->call.args, &xlat_escape); if (slen < 0) goto error; } break; @@ -1253,8 +1251,8 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_t const *head, fr_sbuff_escape FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN(out, node->fmt); FR_SBUFF_IN_CHAR_RETURN(out, ':'); - if (node->child) { - slen = xlat_print(out, node->child, &xlat_escape); + if (node->call.args) { + slen = xlat_print(out, node->call.args, &xlat_escape); if (slen < 0) goto error; } break; @@ -1443,7 +1441,7 @@ ssize_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_t **head, xlat_flags_t *fla * Barewords --may-contain=%{expansions} */ case T_BARE_WORD: - if (xlat_tokenize_string(node, &node->child, &node->flags, &our_in, + if (xlat_tokenize_string(node, &node->group, &node->flags, &our_in, false, our_p_rules, t_rules) < 0) { error: if (our_p_rules != &value_parse_rules_bareword_quoted) { @@ -1461,7 +1459,7 @@ ssize_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_t **head, xlat_flags_t *fla * "Double quoted strings may contain %{expansions}" */ case T_DOUBLE_QUOTED_STRING: - if (xlat_tokenize_string(node, &node->child, &node->flags, &our_in, + if (xlat_tokenize_string(node, &node->group, &node->flags, &our_in, false, &value_parse_rules_double_quoted, t_rules) < 0) goto error; xlat_flags_merge(flags, &node->flags); break; @@ -1473,16 +1471,16 @@ ssize_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_t **head, xlat_flags_t *fla { char *str; - node->child = xlat_exp_alloc_null(node); - xlat_exp_set_type(node->child, XLAT_BOX); + node->group = xlat_exp_alloc_null(node); + xlat_exp_set_type(node->group, XLAT_BOX); - slen = fr_sbuff_out_aunescape_until(node->child, &str, &our_in, SIZE_MAX, + slen = fr_sbuff_out_aunescape_until(node->group, &str, &our_in, SIZE_MAX, value_parse_rules_single_quoted.terminals, value_parse_rules_single_quoted.escapes); if (slen < 0) goto error; - xlat_exp_set_name_buffer_shallow(node->child, str); - fr_value_box_strdup_shallow(&node->child->data, NULL, str, false); + xlat_exp_set_name_buffer_shallow(node->group, str); + fr_value_box_strdup_shallow(&node->group->data, NULL, str, false); xlat_flags_merge(flags, &node->flags); } break; @@ -1676,7 +1674,7 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, xlat_res_rules_t const switch (node->type) { case XLAT_GROUP: - if (xlat_resolve(&node->child, &node->flags, xr_rules) < 0) return -1; + if (xlat_resolve(&node->group, &node->flags, xr_rules) < 0) return -1; break; /* @@ -1700,7 +1698,7 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, xlat_res_rules_t const * A resolved function with unresolved args */ case XLAT_FUNC: - if (xlat_resolve(&node->child, &node->flags, xr_rules) < 0) return -1; + if (xlat_resolve(&node->call.args, &node->flags, xr_rules) < 0) return -1; break; /* @@ -1716,7 +1714,7 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, xlat_res_rules_t const * We can't tell if it's just the function * that needs resolving or its children too. */ - if (xlat_resolve(&node->child, &child_flags, xr_rules) < 0) return -1; + if (xlat_resolve(&node->call.args, &child_flags, xr_rules) < 0) return -1; /* * Try and find the function @@ -1994,7 +1992,7 @@ int xlat_copy(TALLOC_CTX *ctx, xlat_exp_t **out, xlat_exp_t const *in) */ node->call.func = p->call.func; node->call.ephemeral = p->call.ephemeral; - if (unlikely(xlat_copy(node, &node->child, p->child) < 0)) goto error; + if (unlikely(xlat_copy(node, &node->call.args, p->call.args) < 0)) goto error; break; case XLAT_TMPL: @@ -2013,7 +2011,7 @@ int xlat_copy(TALLOC_CTX *ctx, xlat_exp_t **out, xlat_exp_t const *in) break; case XLAT_GROUP: - if (unlikely(xlat_copy(node, &node->child, p->child) < 0)) goto error; + if (unlikely(xlat_copy(node, &node->group, p->group) < 0)) goto error; break; }