#include <freeradius-devel/unlang/unlang_priv.h>
#include "edit_priv.h"
+#if 1
+#undef DEBUG
+#define DEBUG(...)
+#endif
+
typedef struct {
fr_value_box_list_t result; //!< result of expansion
tmpl_t const *vpt; //!< expanded tmpl
{
map_t const *map = current->map;
+ DEBUG("%s map %s %s ...", __FUNCTION__, map->lhs->name, fr_tokens[map->op]);
+
/*
* := is "remove all matching, and then add". So if even if we don't add anything, we still remove things.
*
map_t const *map = current->map;
edit_map_t *child;
+ DEBUG("%s map %s %s ...", __FUNCTION__, map->lhs->name, fr_tokens[map->op]);
+
/*
* If there's no RHS tmpl, then the RHS is a child list.
*/
if (!map->rhs) return expand_rhs_list(request, state, current);
+ DEBUG("%s map %s %s %s", __FUNCTION__, map->lhs->name, fr_tokens[map->op], map->rhs->name);
+
/*
* Turn the RHS into a tmpl_t. This can involve just referencing an existing
* tmpl in map->rhs, or expanding an xlat to get an attribute name.
fr_assert(current->parent);
+ DEBUG("%s map %s", __FUNCTION__, map->lhs->name);
+
if (tmpl_is_data(map->lhs)) {
vpt = map->lhs;
fr_assert(current->parent != NULL);
+ DEBUG("%s map %s", __FUNCTION__, map->lhs->name);
+
/*
* Don't create the leaf. The apply_edits_to_leaf() function will create them after the RHS has
* been expanded.
current->lhs.create = false;
current->lhs.vp = NULL;
+ DEBUG("%s map %s %s ...", __FUNCTION__, map->lhs->name, fr_tokens[map->op]);
+
/*
* Create the attribute, including any necessary parents.
*/
int rcode;
map_t const *map = current->map;
+ DEBUG("%s map %s %s ...", __FUNCTION__, map->lhs->name, fr_tokens[map->op]);
+
fr_assert(fr_value_box_list_empty(¤t->lhs.result)); /* Should have been consumed */
fr_assert(fr_value_box_list_empty(¤t->rhs.result)); /* Should have been consumed */
while (state->current->map) {
int rcode;
+ if (!state->current->map->rhs) {
+ DEBUG("MAP %s ...", state->current->map->lhs->name);
+ } else {
+ DEBUG("MAP %s ... %s", state->current->map->lhs->name, state->current->map->rhs->name);
+
+ DEBUG("\t%08x", state->current->map->rhs->type);
+ }
+
rcode = state->current->func(request, state, state->current);
if (rcode < 0) {
RINDENT_RESTORE(request, &state->indent);