]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Extract non absolute name from source
authorMark Andrews <marka@isc.org>
Tue, 23 Apr 2024 04:10:39 +0000 (14:10 +1000)
committerMark Andrews <marka@isc.org>
Wed, 24 Apr 2024 02:22:48 +0000 (12:22 +1000)
The entire source region needs to be consumed for this usage.

(cherry picked from commit 7a13fcd601cd61ae79d5822602ef7ffd466a05f0)

tests/dns/name_test.c

index acd36c9ddfaacaacdb0c686a56c1f7e45a49f779..fa906606c8e0cbf819571e5dc8883e111b101c3a 100644 (file)
@@ -308,6 +308,19 @@ ISC_RUN_TEST_IMPL(fromregion) {
        assert_int_equal(9, name.length);
        assert_ptr_equal(source, name.ndata);
        assert_true(dns_name_isabsolute(&name));
+
+       /*
+        * Extract the partially qualified name in 'source' into 'name'
+        * where 'name.ndata' points to the source.
+        */
+       isc_buffer_init(&b, target, sizeof(target));
+       dns_name_init(&name, NULL);
+       r.base = source;
+       r.length = 8;
+       dns_name_fromregion(&name, &r);
+       assert_int_equal(8, name.length);
+       assert_ptr_equal(source, name.ndata);
+       assert_false(dns_name_isabsolute(&name));
 }
 
 /* is trust-anchor-telemetry test */