static void
resume_answer_with_key_done(void *arg);
+static bool
+over_max_fails(dns_validator_t *val);
+
+static void
+consume_validation_fail(dns_validator_t *val);
+
static void
resume_answer_with_key(void *arg) {
dns_validator_t *val = arg;
isc_result_t result = select_signing_key(val, rdataset);
if (result == ISC_R_SUCCESS) {
val->keyset = &val->frdataset;
+ } else if (result != ISC_R_NOTFOUND) {
+ val->result = result;
+ if (over_max_fails(val)) {
+ INSIST(val->key == NULL);
+ val->result = ISC_R_QUOTA;
+ }
+ consume_validation_fail(val);
}
(void)validate_async_run(val, resume_answer_with_key_done);
resume_answer_with_key_done(void *arg) {
dns_validator_t *val = arg;
+ switch (val->result) {
+ case ISC_R_CANCELED: /* Validation was canceled */
+ case ISC_R_SHUTTINGDOWN: /* Server shutting down */
+ case ISC_R_QUOTA: /* Validation fails quota reached */
+ dns_validator_cancel(val);
+ break;
+ default:
+ break;
+ }
+
resume_answer(val);
}
val->key = NULL;
result = dns_rdataset_next(rdataset);
}
- if (result == ISC_R_NOMORE) {
- return ISC_R_NOTFOUND;
- }
for (; result == ISC_R_SUCCESS; result = dns_rdataset_next(rdataset)) {
dns_rdata_rrsig_t *siginfo = val->siginfo;
continue;
}
- result = dns_dnssec_keyfromrdata(&siginfo->signer, &rdata,
- val->view->mctx, &val->key);
- if (result == ISC_R_SUCCESS) {
- /* found the key we wanted */
- break;
- }
- }
- if (result == ISC_R_NOMORE) {
- result = ISC_R_NOTFOUND;
+ return dns_dnssec_keyfromrdata(&siginfo->signer, &rdata,
+ val->view->mctx, &val->key);
}
- return result;
+ return ISC_R_NOTFOUND;
}
/*%
result = dns_dnssec_keyfromrdata(name, &keyrdata, mctx,
&dstkey);
if (result != ISC_R_SUCCESS) {
- continue;
+ return result;
}
/*
static void
validate_answer_signing_key(void *arg) {
dns_validator_t *val = arg;
- isc_result_t result = ISC_R_NOTFOUND;
+ isc_result_t result;
if (CANCELED(val) || CANCELING(val)) {
val->result = ISC_R_CANCELED;
default:
/* Select next signing key */
result = select_signing_key(val, val->keyset);
+ if (result == ISC_R_SUCCESS) {
+ INSIST(val->key != NULL);
+ } else if (result == ISC_R_NOTFOUND) {
+ INSIST(val->key == NULL);
+ } else {
+ val->result = result;
+ if (over_max_fails(val)) {
+ INSIST(val->key == NULL);
+ val->result = ISC_R_QUOTA;
+ }
+ consume_validation_fail(val);
+ }
break;
}
- if (result == ISC_R_SUCCESS) {
- INSIST(val->key != NULL);
- } else {
- INSIST(val->key == NULL);
- }
-
(void)validate_async_run(val, validate_answer_signing_key_done);
}
result = dns_dnssec_keyfromrdata(
val->name, keyrdata, val->view->mctx, &dstkey);
if (result != ISC_R_SUCCESS) {
- /*
- * This really shouldn't happen, but...
- */
- continue;
+ return result;
}
}
result = verify(val, dstkey, &rdata, sig.keyid);