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

Extract print_summary() from dns_zoneverify_dnssec()

Extract the part of dns_zoneverify_dnssec() responsible for printing a
summary for a fully signed zone to a separate function.
parent b3d2ab44
......@@ -1495,14 +1495,42 @@ check_bad_algorithms(const vctx_t *vctx) {
}
}
static void
print_summary(const vctx_t *vctx, isc_boolean_t keyset_kskonly) {
char algbuf[DNS_SECALG_FORMATSIZE];
int i;
fprintf(stderr, "Zone fully signed:\n");
for (i = 0; i < 256; i++) {
if ((vctx->ksk_algorithms[i] != 0) ||
(vctx->standby_ksk[i] != 0) ||
(vctx->revoked_ksk[i] != 0) ||
(vctx->zsk_algorithms[i] != 0) ||
(vctx->standby_zsk[i] != 0) ||
(vctx->revoked_zsk[i] != 0)) {
dns_secalg_format(i, algbuf, sizeof(algbuf));
fprintf(stderr, "Algorithm: %s: KSKs: "
"%u active, %u stand-by, %u revoked\n",
algbuf, vctx->ksk_algorithms[i],
vctx->standby_ksk[i],
vctx->revoked_ksk[i]);
fprintf(stderr, "%*sZSKs: "
"%u active, %u %s, %u revoked\n",
(int) strlen(algbuf) + 13, "",
vctx->zsk_algorithms[i],
vctx->standby_zsk[i],
keyset_kskonly ? "present" : "stand-by",
vctx->revoked_zsk[i]);
}
}
}
void
dns_zoneverify_dnssec(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
dns_name_t *origin, isc_mem_t *mctx,
isc_boolean_t ignore_kskflag,
isc_boolean_t keyset_kskonly)
{
char algbuf[80];
int i;
isc_result_t result, vresult = ISC_R_UNSET;
vctx_t vctx;
......@@ -1539,32 +1567,7 @@ dns_zoneverify_dnssec(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
dns_result_totext(vresult));
if (vctx.goodksk || ignore_kskflag) {
/*
* Print the success summary.
*/
fprintf(stderr, "Zone fully signed:\n");
for (i = 0; i < 256; i++) {
if ((vctx.ksk_algorithms[i] != 0) ||
(vctx.standby_ksk[i] != 0) ||
(vctx.revoked_ksk[i] != 0) ||
(vctx.zsk_algorithms[i] != 0) ||
(vctx.standby_zsk[i] != 0) ||
(vctx.revoked_zsk[i] != 0)) {
dns_secalg_format(i, algbuf, sizeof(algbuf));
fprintf(stderr, "Algorithm: %s: KSKs: "
"%u active, %u stand-by, %u revoked\n",
algbuf, vctx.ksk_algorithms[i],
vctx.standby_ksk[i],
vctx.revoked_ksk[i]);
fprintf(stderr, "%*sZSKs: "
"%u active, %u %s, %u revoked\n",
(int) strlen(algbuf) + 13, "",
vctx.zsk_algorithms[i],
vctx.standby_zsk[i],
keyset_kskonly ? "present" : "stand-by",
vctx.revoked_zsk[i]);
}
}
print_summary(&vctx, keyset_kskonly);
}
vctx_destroy(&vctx);
......
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