From: Alan T. DeKok Date: Thu, 28 Jul 2022 22:44:43 +0000 (-0400) Subject: more fixes and updates X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da13c92e7b093bbb22ed2a16bf60075524832e6e;p=thirdparty%2Ffreeradius-server.git more fixes and updates --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 94f17b302e5..05217f2ee9a 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -707,7 +707,11 @@ redo: * * which will assign one value to the result for each column returned by the SQL query. */ - if (templatize_lhs(state, ¤t->lhs, request) < 0) goto error; + if (!current->is_leaf_list) { + if (templatize_lhs(state, ¤t->lhs, request) < 0) goto error; + } else { + if (templatize_rhs(state, ¤t->lhs, current->parent->lhs.vp, request) < 0) goto error; + } current->state = UNLANG_EDIT_CHECK_LHS; FALL_THROUGH; @@ -820,6 +824,38 @@ redo: * NOOP. */ goto next; + } else { + fr_pair_t *parent; + request_t *other = request; + + fr_assert(!tmpl_is_list(current->lhs.vpt)); + + /* + * @todo - What we really need is to create a dcursor, and then do something + * like: + * + * vp = tmpl_dcursor_init(&err, request, &cc, &cursor, request, vpt); + * if (!vp) { + * while (tmpl_dcursor_required(&cursor, &vp, &da) == 1) { + * child = fr_pair_afrom_da(vp, da); + * fr_pair_append(&vp->vp_group, child); + * } + * // vp is the pair we need to edit. + * } + */ + if (tmpl_request_ptr(&other, tmpl_request(current->lhs.vpt)) < 0) { + REDEBUG("Failed to find request for %s", current->lhs.vpt->name); + goto error; + } + fr_assert(other != NULL); + + parent = tmpl_get_list(other, current->lhs.vpt); + if (!parent) { + REDEBUG("Failed to find list for %s", current->lhs.vpt->name); + goto error; + } + + current->lhs.vp_parent = parent; } /*