* Convert virtual &Attr-Foo to "%{Attr-Foo}"
*/
if (tmpl_is_attr(vpt) && tmpl_da(vpt)->flags.virtual) {
- if (tmpl_attr_to_xlat(ctx, vpt_p) < 0) return false;
- return true;
- }
+ if (tmpl_attr_to_xlat(ctx, vpt_p) < 0) {
+ return false;
+ }
+
+ /*
+ * The VPT has been rewritten, so use the new one.
+ */
+ vpt = *vpt_p;
+ } /* it's now xlat, so we need to resolve it. */
/*
* Fixup any other tmpl types
case XLAT_VIRTUAL_UNRESOLVED:
{
xlat_t *func;
+ char const *name;
- fr_assert(node->attr->type == TMPL_TYPE_ATTR_UNRESOLVED);
+ if (node->attr->type == TMPL_TYPE_ATTR_UNRESOLVED) {
+ name = tmpl_attr_unresolved(node->attr);
+ } else {
+ fr_assert(node->attr->type == TMPL_TYPE_ATTR);
+ name = tmpl_da(node->attr)->name;
+ }
- func = xlat_func_find(tmpl_attr_unresolved(node->attr), -1);
+ func = xlat_func_find(name, -1);
if (func) {
xlat_exp_set_type(node, XLAT_VIRTUAL);
node->attr = node->attr; /* Shift to the right location */