]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
replace equal pairs on merge RHS
authorAlan T. DeKok <aland@freeradius.org>
Thu, 21 Jul 2022 13:46:44 +0000 (09:46 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 23 Jul 2022 23:47:16 +0000 (19:47 -0400)
src/lib/util/edit.c

index faf5efe1897bbb42cfc68aae8ddacf173b423e88..5c17fad18b6b3165fda0d100b41032a9e26155f9 100644 (file)
@@ -1093,11 +1093,20 @@ static int list_merge_rhs(fr_edit_list_t *el, fr_pair_t *dst, fr_pair_list_t *sr
                if (fr_type_is_structural(a->vp_type)) {
                        rcode = list_merge_rhs(el, a, &b->children, copy);
                        if (rcode < 0) return rcode;
+
+                       fr_dcursor_next(&cursor1);
+                       fr_dcursor_next(&cursor2);
+                       continue;
                }
 
                /*
-                *      We have both A and B, so we prefer A.
+                *      We have both A and B, so we prefer B.
                 */
+               COPY(b);
+               if (fr_edit_list_replace_pair(el, &dst->children, a, c) < 0) {
+                       return -1;
+               }
+
                fr_dcursor_next(&cursor1);
                fr_dcursor_next(&cursor2);
        }