2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

simplify dns_name_fromtext() interface

previously, dns_name_fromtext() took both a target name and an
optional target buffer parameter, which could override the name's
dedicated buffer. this interface is unnecessarily complex.

we now have two functions, dns_name_fromtext() to convert text
into a dns_name that has a dedicated buffer, and dns_name_wirefromtext()
to convert text into uncompressed DNS wire format and append it to a
target buffer.

in cases where it really is necessary to have both, we can use
dns_name_fromtext() to load the dns_name, then dns_name_towire()
to append the wire format to the target buffer.
This commit is contained in:
Evan Hunt
2025-02-22 00:11:38 -08:00
parent cf098cf10d
commit afb424c9b6
89 changed files with 283 additions and 279 deletions

View File

@@ -372,7 +372,7 @@ restore_key(dns_tsigkeyring_t *ring, isc_stdtime_t now, FILE *fp) {
name = dns_fixedname_initname(&fname);
isc_buffer_init(&b, namestr, strlen(namestr));
isc_buffer_add(&b, strlen(namestr));
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
return result;
}
@@ -380,7 +380,7 @@ restore_key(dns_tsigkeyring_t *ring, isc_stdtime_t now, FILE *fp) {
creator = dns_fixedname_initname(&fcreator);
isc_buffer_init(&b, creatorstr, strlen(creatorstr));
isc_buffer_add(&b, strlen(creatorstr));
result = dns_name_fromtext(creator, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(creator, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
return result;
}
@@ -388,7 +388,7 @@ restore_key(dns_tsigkeyring_t *ring, isc_stdtime_t now, FILE *fp) {
algorithm = dns_fixedname_initname(&falgorithm);
isc_buffer_init(&b, algorithmstr, strlen(algorithmstr));
isc_buffer_add(&b, strlen(algorithmstr));
result = dns_name_fromtext(algorithm, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(algorithm, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
return result;
}