]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix missing locks in zonemd unit test.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 4 Aug 2021 09:05:51 +0000 (11:05 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 4 Aug 2021 09:05:51 +0000 (11:05 +0200)
doc/Changelog
testcode/unitzonemd.c

index ccd40966cb1c40b7ef7c63af3be3a7d66600044e..ac992b345db9e5912e0431913ec9732b450b56de 100644 (file)
@@ -8,6 +8,7 @@
 4 August 2021: Wouter
        - In unit test use openssl set security level to allow keys in test.
        - Fix static analysis warnings about localzone locks that are unused.
+       - Fix missing locks in zonemd unit test.
 
 3 August 2021: George
        - Listen to read or write events after the SSL handshake.
index 3352a7c37fc8d35262ebfab052cd7628fdf4e3a3..b5b865eab63a746fec12f900147f07743f4e955a 100644 (file)
@@ -82,7 +82,9 @@ static void zonemd_generate_test(const char* zname, char* zfile,
        /* read file */
        z = authtest_addzone(az, zname, zfile);
        unit_assert(z);
+       lock_rw_wrlock(&z->lock);
        z->zonemd_check = 1;
+       lock_rw_unlock(&z->lock);
 
        /* create zonemd digest */
        result = auth_zone_generate_zonemd_hash(z, scheme, hashalgo,
@@ -197,7 +199,9 @@ static void zonemd_check_test(void)
        /* read file */
        z = authtest_addzone(az, zname, zfile);
        unit_assert(z);
+       lock_rw_wrlock(&z->lock);
        z->zonemd_check = 1;
+       lock_rw_unlock(&z->lock);
        hashlen = sizeof(hash);
        if(sldns_str2wire_hex_buf(digest, hash, &hashlen) != 0) {
                unit_assert(0); /* parse failure */