&bracket_terms));
MEM(head = xlat_exp_head_alloc(ctx));
- if (t_rules) {
- head->dict = t_rules->attr.dict_def;
- } else {
- t_rules = &my_rules;
- }
+ if (!t_rules) t_rules = &my_rules;
slen = tokenize_expression(head, &node, in, terminal_rules, t_rules, T_INVALID, bracket_rules, p_rules, cond);
talloc_free(bracket_rules);
xlat_t const *func; //!< The xlat expansion to expand format with.
xlat_exp_head_t *args; //!< arguments to the function call
+ fr_dict_t const *dict; //!< Records the namespace this xlat call was created in.
+ ///< Used by the purify code to run fake requests in
+ ///< the correct namespace, and accessible to instantiation
+ ///< functions in case the xlat needs to perform runtime
+ ///< resolution of attributes (as with %eval()).
+
xlat_inst_t *inst; //!< Instance data for the #xlat_t.
xlat_thread_inst_t *thread_inst; //!< Thread specific instance.
///< ONLY USED FOR EPHEMERAL XLATS.
///< into the instance tree.
xlat_input_type_t input_type; //!< The input type used inferred from the
///< bracketing style.
-
- fr_dict_t const *dict; //!< Dictionary to use when resolving call env tmpls
} xlat_call_t;
/** An xlat expansion node
fr_token_t quote; //!< Type of quoting around XLAT_GROUP types.
xlat_flags_t flags; //!< Flags that control resolution and evaluation.
-
xlat_type_t _CONST type; //!< type of this expansion.
#ifndef NDEBUG
fr_dlist_head_t dlist;
xlat_flags_t flags; //!< Flags that control resolution and evaluation.
bool instantiated; //!< temporary flag until we fix more things
- fr_dict_t const *dict; //!< Records the namespace this xlat was created in.
- ///< Used by the purify code to run fake requests in
- ///< the correct namespace, and passed to instantiation
- ///< functions in case the xlat needs to perform runtime
- ///< resolution of attributes (as with %eval()).
#ifndef NDEBUG
char const * _CONST file; //!< File where the xlat was allocated.
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/unlang/xlat_priv.h>
#include <freeradius-devel/util/calc.h>
+#include <freeradius-devel/util/dict.h>
static void xlat_value_list_to_xlat(xlat_exp_head_t *head, fr_value_box_list_t *list)
{
*/
if (!node->flags.pure) {
if (node->call.func->purify) {
+ fr_dict_t const *dict = request->dict;
+
+ /*
+ * Swap in the node specific dictionary.
+ *
+ * The previous code stored the dictionary in the xlat_exp_head_t,
+ * and whilst this wasn't wrong, it was duplicative.
+ *
+ * This allows future code to create inline definitions of local
+ * attributes, and have them work correctly, as more deeply nested
+ * expressions would swap in the correct dictionary.
+ */
+ request->dict = node->call.dict;
if (node->call.func->purify(node, node->call.inst->data, request) < 0) return -1;
-
+ request->dict = dict;
} else {
if (xlat_purify_list(node->call.args, request) < 0) return -1;
}
if (!head->flags.can_purify) return 0;
- request = request_alloc_internal(NULL, (&(request_init_args_t){ .namespace = head->dict }));
+ request = request_alloc_internal(NULL, (&(request_init_args_t){ .namespace = fr_dict_internal() }));
if (!request) return -1;
if (intp) unlang_interpret_set(request, intp);
xlat_exp_head_t *head;
MEM(head = xlat_exp_head_alloc(ctx));
- if (t_rules) head->dict = t_rules->attr.dict_def;
-
if (p_rules && p_rules->terminals) {
tmp_p_rules = (fr_sbuff_parse_rules_t){ /* Stack allocated due to CL scope */
.terminals = fr_sbuff_terminals_amerge(NULL, p_rules->terminals,
MEM(head = xlat_exp_head_alloc(ctx));
if (t_rules) {
- head->dict = t_rules->attr.dict_def;
fr_assert(!t_rules->at_runtime || t_rules->xlat.runtime_el); /* if it's at runtime, we need an event list */
}