lib/dns/validator.c
/*%
 * Callback from fetching a DLV record.
 *
 * Resumes the DLV lookup process.
 */
%
Callback from fetching a DLV record.

Resumes the DLV lookup process.
% Callback from fetching a DLV record . Resumes the DLV lookup process .
static void
dlvfetched(isc_task_t *task, isc_event_t *event) {
	char namebuf[DNS_NAME_FORMATSIZE];
	dns_fetchevent_t *devent;
	dns_validator_t *val;
	isc_boolean_t want_destroy;
	isc_result_t eresult;
	isc_result_t result;
	UNUSED(task);
	INSIST(event->ev_type == DNS_EVENT_FETCHDONE);
	devent = (dns_fetchevent_t *)event;
	val = devent->ev_arg;
	eresult = devent->result;
	if (devent->node != NULL)
		dns_db_detachnode(devent->db, &devent->node);
	if (devent->db != NULL)
		dns_db_detach(&devent->db);
	if (dns_rdataset_isassociated(&val->fsigrdataset))
		dns_rdataset_disassociate(&val->fsigrdataset);
	isc_event_free(&event);
	dns_resolver_destroyfetch(&val->fetch);
	INSIST(val->event != NULL);
	validator_log(val, ISC_LOG_DEBUG(3), "in dlvfetched: %s",
		      dns_result_totext(eresult));
	LOCK(&val->lock);
	if (eresult == ISC_R_SUCCESS) {
		dns_name_format(dns_fixedname_name(&val->dlvsep), namebuf,
				sizeof(namebuf));
		dns_rdataset_clone(&val->frdataset, &val->dlv);
		val->havedlvsep = ISC_TRUE;
		if (dlv_algorithm_supported(val)) {
			validator_log(val, ISC_LOG_DEBUG(3), "DLV %s found",
				      namebuf);
			dlv_validator_start(val);
		} else {
			validator_log(val, ISC_LOG_DEBUG(3),
				      "DLV %s found with no supported algorithms",
				      namebuf);
			markanswer(val, "dlvfetched (1)");
			validator_done(val, ISC_R_SUCCESS);
		}
	} else if (eresult == DNS_R_NXRRSET ||
		   eresult == DNS_R_NXDOMAIN ||
		   eresult == DNS_R_NCACHENXRRSET ||
		   eresult == DNS_R_NCACHENXDOMAIN) {
		result = finddlvsep(val, ISC_TRUE);
		if (result == ISC_R_SUCCESS) {
			if (dlv_algorithm_supported(val)) {
				dns_name_format(dns_fixedname_name(&val->dlvsep),
						namebuf, sizeof(namebuf));
				validator_log(val, ISC_LOG_DEBUG(3),
					      "DLV %s found", namebuf);
				dlv_validator_start(val);
			} else {
				validator_log(val, ISC_LOG_DEBUG(3),
					      "DLV %s found with no supported "
					      "algorithms", namebuf);
				markanswer(val, "dlvfetched (2)");
				validator_done(val, ISC_R_SUCCESS);
			}
		} else if (result == ISC_R_NOTFOUND) {
			validator_log(val, ISC_LOG_DEBUG(3), "DLV not found");
			markanswer(val, "dlvfetched (3)");
			validator_done(val, ISC_R_SUCCESS);
		} else {
			validator_log(val, ISC_LOG_DEBUG(3), "DLV lookup: %s",
				      dns_result_totext(result));
			if (result != DNS_R_WAIT)
				validator_done(val, result);
		}
	} else {
		validator_log(val, ISC_LOG_DEBUG(3), "DLV lookup: %s",
			      dns_result_totext(eresult));
		validator_done(val, eresult);
	}
	want_destroy = exit_check(val);
	UNLOCK(&val->lock);
	if (want_destroy)
		destroy(val);
}
static void dlvfetched ( isc_task_t * task , isc_event_t * event ) { char namebuf [ DNS_NAME_FORMATSIZE ] ; dns_fetchevent_t * devent ; dns_validator_t * val ; isc_boolean_t want_destroy ; isc_result_t eresult ; isc_result_t result ; UNUSED ( task ) ; INSIST ( event -> ev_type == DNS_EVENT_FETCHDONE ) ; devent = ( dns_fetchevent_t * ) event ; val = devent -> ev_arg ; eresult = devent -> result ; if ( devent -> node != NULL ) dns_db_detachnode ( devent -> db , & devent -> node ) ; if ( devent -> db != NULL ) dns_db_detach ( & devent -> db ) ; if ( dns_rdataset_isassociated ( & val -> fsigrdataset ) ) dns_rdataset_disassociate ( & val -> fsigrdataset ) ; isc_event_free ( & event ) ; dns_resolver_destroyfetch ( & val -> fetch ) ; INSIST ( val -> event != NULL ) ; validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , dns_result_totext ( eresult ) ) ; LOCK ( & val -> lock ) ; if ( eresult == ISC_R_SUCCESS ) { dns_name_format ( dns_fixedname_name ( & val -> dlvsep ) , namebuf , sizeof ( namebuf ) ) ; dns_rdataset_clone ( & val -> frdataset , & val -> dlv ) ; val -> havedlvsep = ISC_TRUE ; if ( dlv_algorithm_supported ( val ) ) { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , namebuf ) ; dlv_validator_start ( val ) ; } else { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , namebuf ) ; markanswer ( val , " " ) ; validator_done ( val , ISC_R_SUCCESS ) ; } } else if ( eresult == DNS_R_NXRRSET || eresult == DNS_R_NXDOMAIN || eresult == DNS_R_NCACHENXRRSET || eresult == DNS_R_NCACHENXDOMAIN ) { result = finddlvsep ( val , ISC_TRUE ) ; if ( result == ISC_R_SUCCESS ) { if ( dlv_algorithm_supported ( val ) ) { dns_name_format ( dns_fixedname_name ( & val -> dlvsep ) , namebuf , sizeof ( namebuf ) ) ; validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , namebuf ) ; dlv_validator_start ( val ) ; } else { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " " " , namebuf ) ; markanswer ( val , " " ) ; validator_done ( val , ISC_R_SUCCESS ) ; } } else if ( result == ISC_R_NOTFOUND ) { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " ) ; markanswer ( val , " " ) ; validator_done ( val , ISC_R_SUCCESS ) ; } else { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , dns_result_totext ( result ) ) ; if ( result != DNS_R_WAIT ) validator_done ( val , result ) ; } } else { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , dns_result_totext ( eresult ) ) ; validator_done ( val , eresult ) ; } want_destroy = exit_check ( val ) ; UNLOCK ( & val -> lock ) ; if ( want_destroy ) destroy ( val ) ; }
%
 Callback from fetching a DLV record.
% Callback from fetching a DLV record .
/* Free resources which are not of interest. */