int tmpl_find_or_add_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt) CC_HINT(nonnull);
int pair_append_by_tmpl_parent(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t *list,
- tmpl_t const *vpt) CC_HINT(nonnull(1,3,4));
+ tmpl_t const *vpt, bool skip_list) CC_HINT(nonnull(1,3,4));
int tmpl_extents_find(TALLOC_CTX *ctx,
fr_dlist_head_t *leaf, fr_dlist_head_t *interior,
* @param[out] out Leaf pair we allocated.
* @param[in] list to insert into.
* @param[in] vpt tmpl representing the attribute to add.
+ * @param[in] skip_list skip list attr ref at the head of the tmpl.
* @return
* - 0 on success.
* - -1 on failure.
*/
-int pair_append_by_tmpl_parent(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t *list, tmpl_t const *vpt)
+int pair_append_by_tmpl_parent(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t *list, tmpl_t const *vpt, bool skip_list)
{
fr_pair_t *vp = NULL;
TALLOC_CTX *pair_ctx = ctx;
leaf = tmpl_attr_list_tail(ar_list);
ar = tmpl_attr_list_head(ar_list);
+ if (!ar) goto error;
+ if (skip_list && tmpl_attr_is_list_attr(ar)) ar = tmpl_attr_list_next(ar_list, ar);
/*
* Walk down the tmpl ar stack looking for candidate parent
for (i = 0; i < count; i++) {
if (values[i]->bv_len == 0) continue;
- if (pair_append_by_tmpl_parent(sync_packet_ctx, &vp, pairs, map->lhs) < 0) break;
+ if (pair_append_by_tmpl_parent(sync_packet_ctx, &vp, pairs, map->lhs, true) < 0) break;
if (fr_value_box_from_str(vp, &vp->data, vp->da->type, NULL, values[i]->bv_val,
values[i]->bv_len, NULL, true) < 0) {
fr_pair_remove(pairs, vp);