map_t const *map; //!< the map to evaluate
bool is_leaf_list;
+ bool in_parent_list;
edit_result_t lhs; //!< LHS child entries
edit_result_t rhs; //!< RHS child entries
assign:
RDEBUG2("%s %s %pV", current->lhs.vpt->name, fr_tokens[map->op], rhs_box);
+ /*
+ * Don't apply the edit, as the VP is in a temporary list. The parent will actually apply it.
+ */
+ if (current->in_parent_list) {
+ vp = current->lhs.vp;
+
+ return fr_value_box_cast(vp, &vp->data, vp->da->type, vp->da, rhs_box);
+ }
+
/*
* The apply function also takes care of
* doing data type upcasting and
}
}
+ /*
+ * We've already evaluated the RHS, and put the VP where the parent will
+ * apply it. Just go to the next map entry.
+ */
fr_pair_append(¤t->parent->rhs.pair_list, vp);
goto next;
*/
MEM(current->lhs.vp = fr_pair_afrom_da(current, tmpl_da(current->lhs.vpt)));
fr_pair_append(¤t->parent->rhs.pair_list, current->lhs.vp);
+ current->in_parent_list = true;
} else if (tmpl_find_vp(¤t->lhs.vp, request, current->lhs.vpt) < 0) {
fr_pair_t *parent;
goto error;
}
- goto check_rhs_list;
+ goto check_rhs;
}
/*
if (fr_type_is_leaf(current->lhs.vp->da->type)) {
if (apply_edits_to_leaf(request, current, map) < 0) goto error;
} else {
- check_rhs_list:
if (apply_edits_to_list(request, current, map) < 0) goto error;
}
TALLOC_FREE(current->lhs.to_free);
TALLOC_FREE(current->rhs.to_free);
fr_pair_list_free(¤t->rhs.pair_list);
+ current->in_parent_list = false;
current->lhs.vp = NULL;
current->lhs.vp_parent = NULL;
current->lhs.vpt = NULL;