From: Alan T. DeKok Date: Fri, 18 Nov 2022 14:38:30 +0000 (-0500) Subject: comments X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54facff0615ea3606208571ca0e17c572860bc88;p=thirdparty%2Ffreeradius-server.git comments --- diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index b7866d3155d..3070a87861b 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -826,6 +826,10 @@ int fr_edit_list_insert_list_after(fr_edit_list_t *el, fr_pair_list_t *list, fr_ */ static int fr_edit_list_delete_list(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_list_t *to_remove) { + /* + * We have a list of VPs with operators and values. Those contain the list of things we want to + * be removed from the main "list". + */ fr_pair_list_foreach(to_remove, vp) { fr_pair_t *found, *next; @@ -834,6 +838,9 @@ static int fr_edit_list_delete_list(fr_edit_list_t *el, fr_pair_list_t *list, fr */ if (fr_type_is_structural(vp->da->type)) continue; + /* + * Search the list to edit for VPs which match the ones we're trying to delete. + */ for (found = fr_pair_find_by_da(list, NULL, vp->da); found != NULL; found = next) { @@ -841,6 +848,9 @@ static int fr_edit_list_delete_list(fr_edit_list_t *el, fr_pair_list_t *list, fr next = fr_pair_find_by_da(list, found, vp->da); + /* + * It doesn't match, keep it. If it matches, delete it. + */ rcode = fr_value_box_cmp_op(vp->op, &vp->data, &found->data); if (rcode < 0) return -1;