goto finish;
}
+ /*
+ * An attribute reference which produces a box of type FR_TYPE_ATTR
+ */
+ if (unlikely(head && head->is_attr)) {
+ fr_assert((*in)->type == XLAT_TMPL);
+
+ MEM(value = fr_value_box_alloc_null(ctx));
+ fr_value_box_set_attr(value, tmpl_attr_tail_da((*in)->vpt));
+
+ fr_dcursor_append(out, value);
+ goto finish;
+ }
+
XLAT_DEBUG("** [%i] %s >> entered", unlang_interpret_stack_depth(request), __FUNCTION__);
for (node = *in; node; node = xlat_exp_next(head, node)) {
uint8_t instantiated : 1; //!< temporary flag until we fix more things
uint8_t is_argv : 1; //!< this thing holds function arguments
uint8_t cursor : 1; //!< otherwise it's too hard to pass xlat_arg_parser_t to the evaluation function.
+ uint8_t is_attr : 1; //!< the argument is an attribute reference
#ifndef NDEBUG
char const * _CONST file; //!< File where the xlat was allocated.
return 0;
}
+ /*
+ * An attribute argument results in an FR_TYPE_ATTR box, rather than the value of the attribute
+ */
+ if (arg_p->type == FR_TYPE_ATTR) {
+ if (node->type != XLAT_TMPL) {
+ fr_strerror_printf("Attribute must be a bare word, not %s", fr_type_to_str(node->data.type));
+ return -1;
+ }
+
+ if (xlat_tmpl_normalize(node) < 0) return -1;
+
+ if (!tmpl_is_attr(node->vpt)) {
+ fr_strerror_printf("Invalid argument - expected attribute reference");
+ return -1;
+ }
+
+ arg->group->is_attr = true;
+ return 0;
+ }
+
/*
* The argument is either ONE tmpl / value-box, OR is an
* xlat group which contains a double-quoted string.