]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set mutable recursively
authorAlan T. DeKok <aland@freeradius.org>
Tue, 5 Sep 2023 16:55:56 +0000 (12:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 5 Sep 2023 17:38:54 +0000 (13:38 -0400)
src/bin/unit_test_module.c

index c071fbbf566bfbf9465fab55b3969f0bdcca8c7f..8527efe4e5cc0dcb804841a0b228615e3905fe6f 100644 (file)
@@ -116,6 +116,19 @@ static fr_client_t *client_alloc(TALLOC_CTX *ctx, char const *ip, char const *na
        return client;
 }
 
+static void pair_mutable(fr_pair_t *vp)
+{
+       if (fr_type_is_leaf(vp->vp_type)) {
+               vp->data.immutable = false;
+
+               return;
+       }
+
+       fr_pair_list_foreach(&vp->vp_group, child) {
+               pair_mutable(child);
+       }
+}
+
 static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_client_t *client, CONF_SECTION *server_cs)
 {
        fr_pair_t       *vp;
@@ -236,13 +249,12 @@ static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_client_t *clie
        }
 
        /*
-        *      For lazines in the tests, allow the Net.* to be mutable
+        *      For laziness in the tests, allow the Net.* to be mutable
         */
        for (vp = fr_pair_dcursor_by_ancestor_init(&cursor, &request->request_pairs, attr_net);
             vp != NULL;
             vp = fr_dcursor_next(&cursor)) {
-               if (!fr_type_is_leaf(vp->vp_type)) continue;
-               vp->data.immutable = false;
+               pair_mutable(vp);
        }
 
        if (fr_debug_lvl) {