mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Replace type_format() and TYPE_FORMATSIZE with their libdns counterparts
Rather than use custom functions and macros local to bin/dnssec/, use their counterparts provided by libdns.
This commit is contained in:
parent
c37537cfe7
commit
ffe8ddd95f
@ -498,11 +498,11 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
|
|||||||
dns_ttl_t ttl;
|
dns_ttl_t ttl;
|
||||||
int i;
|
int i;
|
||||||
char namestr[DNS_NAME_FORMATSIZE];
|
char namestr[DNS_NAME_FORMATSIZE];
|
||||||
char typestr[TYPE_FORMATSIZE];
|
char typestr[DNS_RDATATYPE_FORMATSIZE];
|
||||||
char sigstr[SIG_FORMATSIZE];
|
char sigstr[SIG_FORMATSIZE];
|
||||||
|
|
||||||
dns_name_format(name, namestr, sizeof(namestr));
|
dns_name_format(name, namestr, sizeof(namestr));
|
||||||
type_format(set->type, typestr, sizeof(typestr));
|
dns_rdatatype_format(set->type, typestr, sizeof(typestr));
|
||||||
|
|
||||||
ttl = ISC_MIN(set->ttl, endtime - starttime);
|
ttl = ISC_MIN(set->ttl, endtime - starttime);
|
||||||
|
|
||||||
@ -2090,10 +2090,10 @@ rrset_cleanup(dns_name_t *name, dns_rdataset_t *rdataset,
|
|||||||
unsigned int count1 = 0;
|
unsigned int count1 = 0;
|
||||||
dns_rdataset_t tmprdataset;
|
dns_rdataset_t tmprdataset;
|
||||||
char namestr[DNS_NAME_FORMATSIZE];
|
char namestr[DNS_NAME_FORMATSIZE];
|
||||||
char typestr[TYPE_FORMATSIZE];
|
char typestr[DNS_RDATATYPE_FORMATSIZE];
|
||||||
|
|
||||||
dns_name_format(name, namestr, sizeof(namestr));
|
dns_name_format(name, namestr, sizeof(namestr));
|
||||||
type_format(rdataset->type, typestr, sizeof(typestr));
|
dns_rdatatype_format(rdataset->type, typestr, sizeof(typestr));
|
||||||
|
|
||||||
dns_rdataset_init(&tmprdataset);
|
dns_rdataset_init(&tmprdataset);
|
||||||
for (result = dns_rdataset_first(rdataset);
|
for (result = dns_rdataset_first(rdataset);
|
||||||
|
@ -116,19 +116,6 @@ version(const char *name) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
type_format(const dns_rdatatype_t type, char *cp, unsigned int size) {
|
|
||||||
isc_buffer_t b;
|
|
||||||
isc_region_t r;
|
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
isc_buffer_init(&b, cp, size - 1);
|
|
||||||
result = dns_rdatatype_totext(type, &b);
|
|
||||||
check_result(result, "dns_rdatatype_totext()");
|
|
||||||
isc_buffer_usedregion(&b, &r);
|
|
||||||
r.base[r.length] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
|
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
|
||||||
char namestr[DNS_NAME_FORMATSIZE];
|
char namestr[DNS_NAME_FORMATSIZE];
|
||||||
@ -667,7 +654,7 @@ check_no_rrsig(dns_db_t *db, dns_dbversion_t *ver, dns_rdataset_t *rdataset,
|
|||||||
}
|
}
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||||
type_format(rdataset->type, typebuf, sizeof(typebuf));
|
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
|
||||||
fprintf(stderr, "Warning: Found unexpected signatures for "
|
fprintf(stderr, "Warning: Found unexpected signatures for "
|
||||||
"%s/%s\n", namebuf, typebuf);
|
"%s/%s\n", namebuf, typebuf);
|
||||||
}
|
}
|
||||||
@ -1099,7 +1086,7 @@ verifyset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
|
|||||||
}
|
}
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||||
type_format(rdataset->type, typebuf, sizeof(typebuf));
|
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
|
||||||
fprintf(stderr, "No signatures for %s/%s\n", namebuf, typebuf);
|
fprintf(stderr, "No signatures for %s/%s\n", namebuf, typebuf);
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
if (act_algorithms[i] != 0)
|
if (act_algorithms[i] != 0)
|
||||||
@ -1120,7 +1107,8 @@ verifyset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
|
|||||||
check_result(result, "dns_rdata_tostruct()");
|
check_result(result, "dns_rdata_tostruct()");
|
||||||
if (rdataset->ttl != sig.originalttl) {
|
if (rdataset->ttl != sig.originalttl) {
|
||||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||||
type_format(rdataset->type, typebuf, sizeof(typebuf));
|
dns_rdatatype_format(rdataset->type, typebuf,
|
||||||
|
sizeof(typebuf));
|
||||||
fprintf(stderr, "TTL mismatch for %s %s keytag %u\n",
|
fprintf(stderr, "TTL mismatch for %s %s keytag %u\n",
|
||||||
namebuf, typebuf, sig.keyid);
|
namebuf, typebuf, sig.keyid);
|
||||||
continue;
|
continue;
|
||||||
@ -1134,7 +1122,7 @@ verifyset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
|
|||||||
dns_rdatasetiter_destroy(&rdsiter);
|
dns_rdatasetiter_destroy(&rdsiter);
|
||||||
if (memcmp(set_algorithms, act_algorithms, sizeof(set_algorithms))) {
|
if (memcmp(set_algorithms, act_algorithms, sizeof(set_algorithms))) {
|
||||||
dns_name_format(name, namebuf, sizeof(namebuf));
|
dns_name_format(name, namebuf, sizeof(namebuf));
|
||||||
type_format(rdataset->type, typebuf, sizeof(typebuf));
|
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
if ((act_algorithms[i] != 0) &&
|
if ((act_algorithms[i] != 0) &&
|
||||||
(set_algorithms[i] == 0)) {
|
(set_algorithms[i] == 0)) {
|
||||||
|
@ -41,10 +41,6 @@ vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
|
|||||||
ISC_PLATFORM_NORETURN_PRE void
|
ISC_PLATFORM_NORETURN_PRE void
|
||||||
version(const char *program) ISC_PLATFORM_NORETURN_POST;
|
version(const char *program) ISC_PLATFORM_NORETURN_POST;
|
||||||
|
|
||||||
void
|
|
||||||
type_format(const dns_rdatatype_t type, char *cp, unsigned int size);
|
|
||||||
#define TYPE_FORMATSIZE 20
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
|
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
|
||||||
#define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
|
#define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user