Skip to content

Commit

Permalink
Insert new pair where we were asked to
Browse files Browse the repository at this point in the history
  • Loading branch information
ndptech committed Sep 6, 2023
1 parent 22062b0 commit 15341f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/util/pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,15 @@ static fr_pair_t *pair_alloc_parent(fr_pair_t *in, fr_pair_t *item, fr_dict_attr
vp = fr_pair_afrom_da(parent, da);
if (!vp) return NULL;

fr_pair_append(&parent->vp_group, vp);
/*
* If we are at the root, and have been provided with
* an entry to insert before, then do that.
*/
if (item && da->parent->flags.is_root) {
fr_pair_insert_before(&parent->vp_group, item, vp);
} else {
fr_pair_append(&parent->vp_group, vp);
}
return vp;
}

Expand Down

0 comments on commit 15341f1

Please sign in to comment.