*/
void
-dns_validator_destroy(dns_validator_t **validatorp);
+dns_validator_shutdown(dns_validator_t *val);
/*%<
- * Destroy a DNSSEC validator.
+ * Release the name associated with the DNSSEC validator.
*
* Requires:
- *\li '*validatorp' points to a valid DNSSEC validator.
+ * \li 'val' points to a valid DNSSEC validator.
* \li The validator must have completed and sent its completion
* event.
*
* Ensures:
- *\li All resources used by the validator are freed.
+ *\li The name associated with the DNSSEC validator is released.
*/
#if DNS_VALIDATOR_TRACE
/*
* val->name points to name on a message on one of the
- * queries on the fetch context so the validator has to
- * be destroyed first.
+ * queries on the fetch context so the name has to be
+ * released first with a dns_validator_shutdown() call.
*/
- dns_validator_destroy(&val);
+ dns_validator_shutdown(val);
+ dns_validator_detach(&val);
fetchctx_detach(&fctx);
INSIST(node == NULL);
}
cleanup:
dns_validator_detach(&subvalidator->parent);
- dns_validator_destroy(&subvalidator);
+ dns_validator_shutdown(subvalidator);
+ dns_validator_detach(&subvalidator);
validate_async_done(val, result);
}
cleanup:
dns_validator_detach(&subvalidator->parent);
- dns_validator_destroy(&subvalidator);
+ dns_validator_shutdown(subvalidator);
+ dns_validator_detach(&subvalidator);
validate_async_done(val, result);
}
cleanup:
dns_validator_detach(&subvalidator->parent);
- dns_validator_destroy(&subvalidator);
+ dns_validator_shutdown(subvalidator);
+ dns_validator_detach(&subvalidator);
validate_async_done(val, result);
}
cleanup:
dns_validator_detach(&subvalidator->parent);
- dns_validator_destroy(&subvalidator);
+ dns_validator_shutdown(subvalidator);
+ dns_validator_detach(&subvalidator);
validate_async_done(val, result);
}
}
void
-dns_validator_destroy(dns_validator_t **validatorp) {
- dns_validator_t *val = NULL;
-
- REQUIRE(validatorp != NULL);
-
- val = *validatorp;
- *validatorp = NULL;
-
+dns_validator_shutdown(dns_validator_t *val) {
REQUIRE(VALID_VALIDATOR(val));
+ REQUIRE(COMPLETE(val));
REQUIRE(val->tid == isc_tid());
- validator_log(val, ISC_LOG_DEBUG(4), "dns_validator_destroy");
+ validator_log(val, ISC_LOG_DEBUG(4), "dns_validator_shutdown");
- dns_validator_detach(&val);
+ /*
+ * The validation is now complete and the owner is no longer interested
+ * in any further results. If there are still callback events queued up
+ * which hold a validator reference, they should not be allowed to use
+ * val->name during logging, because the owner may destroy it after this
+ * function is called.
+ */
+ val->name = NULL;
}
static void