Commit ffe8ddd9 authored by Michał Kępień's avatar Michał Kępień

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.
parent c37537cf
......@@ -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;
int i;
char namestr[DNS_NAME_FORMATSIZE];
char typestr[TYPE_FORMATSIZE];
char typestr[DNS_RDATATYPE_FORMATSIZE];
char sigstr[SIG_FORMATSIZE];
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);
......@@ -2090,10 +2090,10 @@ rrset_cleanup(dns_name_t *name, dns_rdataset_t *rdataset,
unsigned int count1 = 0;
dns_rdataset_t tmprdataset;
char namestr[DNS_NAME_FORMATSIZE];
char typestr[TYPE_FORMATSIZE];
char typestr[DNS_RDATATYPE_FORMATSIZE];
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);
for (result = dns_rdataset_first(rdataset);
......
......@@ -116,19 +116,6 @@ version(const char *name) {
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
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
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) {
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 "
"%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) {
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);
for (i = 0; i < 256; i++)
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()");
if (rdataset->ttl != sig.originalttl) {
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",
namebuf, typebuf, sig.keyid);
continue;
......@@ -1134,7 +1122,7 @@ verifyset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
dns_rdatasetiter_destroy(&rdsiter);
if (memcmp(set_algorithms, act_algorithms, sizeof(set_algorithms))) {
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++)
if ((act_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
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
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
#define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment