mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Replace remaining fprintf() calls with zoneverify_*() calls
Replace all fprintf() calls inside lib/dns/zoneverify.c, but outside of zoneverify_log_error() and zoneverify_print() with calls to these functions.
This commit is contained in:
@@ -1063,7 +1063,7 @@ free_element_heap(void *element, void *uap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_boolean_t
|
static isc_boolean_t
|
||||||
checknext(const struct nsec3_chain_fixed *first,
|
checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first,
|
||||||
const struct nsec3_chain_fixed *e)
|
const struct nsec3_chain_fixed *e)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
@@ -1082,27 +1082,26 @@ checknext(const struct nsec3_chain_fixed *first,
|
|||||||
sr.length = first->next_length;
|
sr.length = first->next_length;
|
||||||
isc_buffer_init(&b, buf, sizeof(buf));
|
isc_buffer_init(&b, buf, sizeof(buf));
|
||||||
isc_base32hex_totext(&sr, 1, "", &b);
|
isc_base32hex_totext(&sr, 1, "", &b);
|
||||||
fprintf(stderr, "Break in NSEC3 chain at: %.*s\n",
|
zoneverify_log_error(vctx, "Break in NSEC3 chain at: %.*s",
|
||||||
(int) isc_buffer_usedlength(&b), buf);
|
(int)isc_buffer_usedlength(&b), buf);
|
||||||
|
|
||||||
DE_CONST(d1, sr.base);
|
DE_CONST(d1, sr.base);
|
||||||
sr.length = first->next_length;
|
sr.length = first->next_length;
|
||||||
isc_buffer_init(&b, buf, sizeof(buf));
|
isc_buffer_init(&b, buf, sizeof(buf));
|
||||||
isc_base32hex_totext(&sr, 1, "", &b);
|
isc_base32hex_totext(&sr, 1, "", &b);
|
||||||
fprintf(stderr, "Expected: %.*s\n", (int) isc_buffer_usedlength(&b),
|
zoneverify_log_error(vctx, "Expected: %.*s",
|
||||||
buf);
|
(int)isc_buffer_usedlength(&b), buf);
|
||||||
|
|
||||||
DE_CONST(d2, sr.base);
|
DE_CONST(d2, sr.base);
|
||||||
sr.length = first->next_length;
|
sr.length = first->next_length;
|
||||||
isc_buffer_init(&b, buf, sizeof(buf));
|
isc_buffer_init(&b, buf, sizeof(buf));
|
||||||
isc_base32hex_totext(&sr, 1, "", &b);
|
isc_base32hex_totext(&sr, 1, "", &b);
|
||||||
fprintf(stderr, "Found: %.*s\n", (int) isc_buffer_usedlength(&b), buf);
|
zoneverify_log_error(vctx, "Found: %.*s",
|
||||||
|
(int)isc_buffer_usedlength(&b), buf);
|
||||||
|
|
||||||
return (ISC_FALSE);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXPECTEDANDFOUND "Expected and found NSEC3 chains not equal\n"
|
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
@@ -1123,8 +1122,12 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
|||||||
free_element(mctx, f);
|
free_element(mctx, f);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
} else {
|
} else {
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS) {
|
||||||
fprintf(stderr, EXPECTEDANDFOUND);
|
zoneverify_log_error(
|
||||||
|
vctx,
|
||||||
|
"Expected and found NSEC3 "
|
||||||
|
"chains not equal");
|
||||||
|
}
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
/*
|
/*
|
||||||
* Attempt to resync found_chain.
|
* Attempt to resync found_chain.
|
||||||
@@ -1142,12 +1145,14 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (result == ISC_R_SUCCESS) {
|
} else if (result == ISC_R_SUCCESS) {
|
||||||
fprintf(stderr, EXPECTEDANDFOUND);
|
zoneverify_log_error(vctx,
|
||||||
|
"Expected and found NSEC3 chains "
|
||||||
|
"not equal");
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
}
|
}
|
||||||
if (first == NULL || newchain(first, e)) {
|
if (first == NULL || newchain(first, e)) {
|
||||||
if (prev != NULL) {
|
if (prev != NULL) {
|
||||||
if (!checknext(prev, first))
|
if (!checknext(vctx, prev, first))
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
if (prev != first)
|
if (prev != first)
|
||||||
free_element(mctx, prev);
|
free_element(mctx, prev);
|
||||||
@@ -1157,14 +1162,14 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
|||||||
prev = first = e;
|
prev = first = e;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!checknext(prev, e))
|
if (!checknext(vctx, prev, e))
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
if (prev != first)
|
if (prev != first)
|
||||||
free_element(mctx, prev);
|
free_element(mctx, prev);
|
||||||
prev = e;
|
prev = e;
|
||||||
}
|
}
|
||||||
if (prev != NULL) {
|
if (prev != NULL) {
|
||||||
if (!checknext(prev, first))
|
if (!checknext(vctx, prev, first))
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
if (prev != first)
|
if (prev != first)
|
||||||
free_element(mctx, prev);
|
free_element(mctx, prev);
|
||||||
@@ -1174,7 +1179,9 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
|||||||
do {
|
do {
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
fprintf(stderr, EXPECTEDANDFOUND);
|
zoneverify_log_error(vctx,
|
||||||
|
"Expected and found "
|
||||||
|
"NSEC3 chains not equal");
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
}
|
}
|
||||||
free_element(mctx, f);
|
free_element(mctx, f);
|
||||||
@@ -1791,28 +1798,32 @@ print_summary(const vctx_t *vctx, isc_boolean_t keyset_kskonly) {
|
|||||||
char algbuf[DNS_SECALG_FORMATSIZE];
|
char algbuf[DNS_SECALG_FORMATSIZE];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fprintf(stderr, "Zone fully signed:\n");
|
zoneverify_print(vctx, "Zone fully signed:\n");
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
if ((vctx->ksk_algorithms[i] != 0) ||
|
if ((vctx->ksk_algorithms[i] == 0) &&
|
||||||
(vctx->standby_ksk[i] != 0) ||
|
(vctx->standby_ksk[i] == 0) &&
|
||||||
(vctx->revoked_ksk[i] != 0) ||
|
(vctx->revoked_ksk[i] == 0) &&
|
||||||
(vctx->zsk_algorithms[i] != 0) ||
|
(vctx->zsk_algorithms[i] == 0) &&
|
||||||
(vctx->standby_zsk[i] != 0) ||
|
(vctx->standby_zsk[i] == 0) &&
|
||||||
(vctx->revoked_zsk[i] != 0)) {
|
(vctx->revoked_zsk[i] == 0))
|
||||||
dns_secalg_format(i, algbuf, sizeof(algbuf));
|
{
|
||||||
fprintf(stderr, "Algorithm: %s: KSKs: "
|
continue;
|
||||||
"%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]);
|
|
||||||
}
|
}
|
||||||
|
dns_secalg_format(i, algbuf, sizeof(algbuf));
|
||||||
|
zoneverify_print(vctx,
|
||||||
|
"Algorithm: %s: KSKs: "
|
||||||
|
"%u active, %u stand-by, %u revoked\n",
|
||||||
|
algbuf, vctx->ksk_algorithms[i],
|
||||||
|
vctx->standby_ksk[i],
|
||||||
|
vctx->revoked_ksk[i]);
|
||||||
|
zoneverify_print(vctx,
|
||||||
|
"%*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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user