From: Mark Andrews Date: Tue, 23 Apr 2024 04:10:39 +0000 (+1000) Subject: Extract non absolute name from source X-Git-Tag: v9.19.24~15^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=7a13fcd601cd61ae79d5822602ef7ffd466a05f0;p=thirdparty%2Fbind9.git Extract non absolute name from source The entire source region needs to be consumed for this usage. --- diff --git a/tests/dns/name_test.c b/tests/dns/name_test.c index c044ff99366..03bf148f179 100644 --- a/tests/dns/name_test.c +++ b/tests/dns/name_test.c @@ -489,6 +489,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 */