]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix assert
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 3 Nov 2021 23:33:20 +0000 (19:33 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 3 Nov 2021 23:33:20 +0000 (19:33 -0400)
src/lib/server/map.c
src/tests/keywords/map-xlat-nested-overwrite

index f8e8e3c75089f642d966a12dd1580a0f9c375466..60f21b541ca38c1c01ad91f70de433c1111e1fa6 100644 (file)
@@ -1802,11 +1802,13 @@ int map_to_request(request_t *request, map_t const *map, radius_map_getvalue_t f
                        extent = fr_dlist_head(&leaf);
                        fr_pair_append(extent->list, fr_pair_copy(extent->list_ctx, src_vp));
                }
+
+               fr_assert(fr_dlist_num_elements(&interior) == 0);
+               fr_dlist_talloc_free(&leaf);
+
        op_set_done:
                /* Free any we didn't insert */
                fr_pair_list_free(&src_list);
-               fr_assert(fr_dlist_num_elements(&interior) == 0);
-               fr_dlist_talloc_free(&leaf);
        }
                break;
 
index 46e602dea7c16c3042e90f23736e09ebcd765d44..505ea2474cbc08bc939fb703e74822625c841f32 100644 (file)
@@ -4,7 +4,7 @@
 #  Test the map xlat
 #
 update {
-       &Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-1 := 'testing123'"
+       &Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-0 := 'testing123'"
 }
 
 if ("%{map:%{Tmp-String-0}}" != 1) {
@@ -15,4 +15,16 @@ if ("%{map:%{Tmp-String-0}}" != 1) {
        test_fail
 }
 
+if ("%{map:request.Tmp-Group-0.Tmp-String-1 := 'testing000'}" != 1) {
+       test_fail
+}
+
+if (!&Tmp-Group-0[0].Tmp-String-0 || (&Tmp-Group-0[0].Tmp-String-0 != 'testing123')) {
+       test_fail
+}
+
+if (!&Tmp-Group-0[0].Tmp-String-1 || (&Tmp-Group-0[0].Tmp-String-1 != 'testing000')) {
+       test_fail
+}
+
 success