From: Alan T. DeKok Date: Tue, 5 Sep 2023 16:55:56 +0000 (-0400) Subject: set mutable recursively X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab2bd7320fcfe7451afd4208f097f60b9a7cac79;p=thirdparty%2Ffreeradius-server.git set mutable recursively --- diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index c071fbbf566..8527efe4e5c 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -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) {