lib/dns/validator.c
/*%
 * Callback for when NSEC records have been validated.
 *
 * Looks for NOQNAME, NODATA and OPTOUT proofs.
 *
 * Resumes nsecvalidate.
 */
%
Callback for when NSEC records have been validated.

Looks for NOQNAME, NODATA and OPTOUT proofs.

Resumes nsecvalidate.
% Callback for when NSEC records have been validated . Looks for NOQNAME NODATA and OPTOUT proofs . Resumes nsecvalidate .
static void
authvalidated(isc_task_t *task, isc_event_t *event) {
	dns_validatorevent_t *devent;
	dns_validator_t *val;
	dns_rdataset_t *rdataset;
	isc_boolean_t want_destroy;
	isc_result_t result;
	isc_boolean_t exists, data;
	UNUSED(task);
	INSIST(event->ev_type == DNS_EVENT_VALIDATORDONE);
	devent = (dns_validatorevent_t *)event;
	rdataset = devent->rdataset;
	val = devent->ev_arg;
	result = devent->result;
	dns_validator_destroy(&val->subvalidator);
	INSIST(val->event != NULL);
	validator_log(val, ISC_LOG_DEBUG(3), "in authvalidated");
	LOCK(&val->lock);
	if (CANCELED(val)) {
		validator_done(val, ISC_R_CANCELED);
	} else if (result != ISC_R_SUCCESS) {
		validator_log(val, ISC_LOG_DEBUG(3),
			      "authvalidated: got %s",
			      isc_result_totext(result));
		if (result == DNS_R_BROKENCHAIN)
			val->authfail++;
		if (result == ISC_R_CANCELED)
			validator_done(val, result);
		else {
			result = nsecvalidate(val, ISC_TRUE);
			if (result != DNS_R_WAIT)
				validator_done(val, result);
		}
	} else {
		dns_name_t **proofs = val->event->proofs;
		dns_name_t *wild = dns_fixedname_name(&val->wild);
		if (rdataset->trust == dns_trust_secure)
			val->seensig = ISC_TRUE;
		if (rdataset->type == dns_rdatatype_nsec &&
		    rdataset->trust == dns_trust_secure &&
		    (NEEDNODATA(val) || NEEDNOQNAME(val)) &&
		    !FOUNDNODATA(val) && !FOUNDNOQNAME(val) &&
		    nsecnoexistnodata(val, val->event->name, devent->name,
				      rdataset, &exists, &data, wild)
				      == ISC_R_SUCCESS)
		{
			if (exists && !data) {
				val->attributes |= VALATTR_FOUNDNODATA;
				if (NEEDNODATA(val))
					proofs[DNS_VALIDATOR_NODATAPROOF] =
						devent->name;
			}
			if (!exists) {
				val->attributes |= VALATTR_FOUNDNOQNAME;
				val->attributes |= VALATTR_FOUNDCLOSEST;
				if (NEEDNOQNAME(val))
					proofs[DNS_VALIDATOR_NOQNAMEPROOF] =
						devent->name;
			}
		}
		result = nsecvalidate(val, ISC_TRUE);
		if (result != DNS_R_WAIT)
			validator_done(val, result);
	}
	want_destroy = exit_check(val);
	UNLOCK(&val->lock);
	if (want_destroy)
		destroy(val);
	isc_event_free(&event);
}
static void authvalidated ( isc_task_t * task , isc_event_t * event ) { dns_validatorevent_t * devent ; dns_validator_t * val ; dns_rdataset_t * rdataset ; isc_boolean_t want_destroy ; isc_result_t result ; isc_boolean_t exists , data ; UNUSED ( task ) ; INSIST ( event -> ev_type == DNS_EVENT_VALIDATORDONE ) ; devent = ( dns_validatorevent_t * ) event ; rdataset = devent -> rdataset ; val = devent -> ev_arg ; result = devent -> result ; dns_validator_destroy ( & val -> subvalidator ) ; INSIST ( val -> event != NULL ) ; validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " ) ; LOCK ( & val -> lock ) ; if ( CANCELED ( val ) ) { validator_done ( val , ISC_R_CANCELED ) ; } else if ( result != ISC_R_SUCCESS ) { validator_log ( val , ISC_LOG_DEBUG ( 3 ) , " " , isc_result_totext ( result ) ) ; if ( result == DNS_R_BROKENCHAIN ) val -> authfail ++ ; if ( result == ISC_R_CANCELED ) validator_done ( val , result ) ; else { result = nsecvalidate ( val , ISC_TRUE ) ; if ( result != DNS_R_WAIT ) validator_done ( val , result ) ; } } else { dns_name_t * * proofs = val -> event -> proofs ; dns_name_t * wild = dns_fixedname_name ( & val -> wild ) ; if ( rdataset -> trust == dns_trust_secure ) val -> seensig = ISC_TRUE ; if ( rdataset -> type == dns_rdatatype_nsec && rdataset -> trust == dns_trust_secure && ( NEEDNODATA ( val ) || NEEDNOQNAME ( val ) ) && ! FOUNDNODATA ( val ) && ! FOUNDNOQNAME ( val ) && nsecnoexistnodata ( val , val -> event -> name , devent -> name , rdataset , & exists , & data , wild ) == ISC_R_SUCCESS ) { if ( exists && ! data ) { val -> attributes |= VALATTR_FOUNDNODATA ; if ( NEEDNODATA ( val ) ) proofs [ DNS_VALIDATOR_NODATAPROOF ] = devent -> name ; } if ( ! exists ) { val -> attributes |= VALATTR_FOUNDNOQNAME ; val -> attributes |= VALATTR_FOUNDCLOSEST ; if ( NEEDNOQNAME ( val ) ) proofs [ DNS_VALIDATOR_NOQNAMEPROOF ] = devent -> name ; } } result = nsecvalidate ( val , ISC_TRUE ) ; if ( result != DNS_R_WAIT ) validator_done ( val , result ) ; } want_destroy = exit_check ( val ) ; UNLOCK ( & val -> lock ) ; if ( want_destroy ) destroy ( val ) ; isc_event_free ( & event ) ; }
%
 Callback for when NSEC records have been validated.
% Callback for when NSEC records have been validated .
/*
				 * The NSEC noqname proof also contains
				 * the closest encloser.

				 */ /*
	 * Free stuff from the event.
	 */