bin/named/update.c
/*
 * Delete expired RRsigs and any RRsigs we are about to re-sign.
 * See also zone.c:del_sigs().
 */
Delete expired RRsigs and any RRsigs we are about to re-sign.
Delete expired RRsigs and any RRsigs we are about to re - sign .
static isc_result_t
del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
	    dns_diff_t *diff, dst_key_t **keys, unsigned int nkeys)
{
	isc_result_t result;
	dns_dbnode_t *node = NULL;
	dns_rdataset_t rdataset;
	dns_rdata_t rdata = DNS_RDATA_INIT;
	unsigned int i;
	dns_rdata_rrsig_t rrsig;
	isc_boolean_t found;
	dns_rdataset_init(&rdataset);
	result = dns_db_findnode(db, name, ISC_FALSE, &node);
	if (result == ISC_R_NOTFOUND)
		return (ISC_R_SUCCESS);
	if (result != ISC_R_SUCCESS)
		goto failure;
	result = dns_db_findrdataset(db, node, ver, dns_rdatatype_rrsig,
				     dns_rdatatype_dnskey, (isc_stdtime_t) 0,
				     &rdataset, NULL);
	dns_db_detachnode(db, &node);
	if (result == ISC_R_NOTFOUND)
		return (ISC_R_SUCCESS);
	if (result != ISC_R_SUCCESS)
		goto failure;
	for (result = dns_rdataset_first(&rdataset);
	     result == ISC_R_SUCCESS;
	     result = dns_rdataset_next(&rdataset)) {
		dns_rdataset_current(&rdataset, &rdata);
		result = dns_rdata_tostruct(&rdata, &rrsig, NULL);
		RUNTIME_CHECK(result == ISC_R_SUCCESS);
		found = ISC_FALSE;
		for (i = 0; i < nkeys; i++) {
			if (rrsig.keyid == dst_key_id(keys[i])) {
				found = ISC_TRUE;
				if (!dst_key_isprivate(keys[i])) {
					break;
				}
				result = update_one_rr(db, ver, diff,
						       DNS_DIFFOP_DEL, name,
						       rdataset.ttl, &rdata);
				break;
			}
		}
		if (!found)
			result = update_one_rr(db, ver, diff, DNS_DIFFOP_DEL,
					       name, rdataset.ttl, &rdata);
		dns_rdata_reset(&rdata);
		if (result != ISC_R_SUCCESS)
			break;
	}
	dns_rdataset_disassociate(&rdataset);
	if (result == ISC_R_NOMORE)
		result = ISC_R_SUCCESS;
failure:
	if (node != NULL)
		dns_db_detachnode(db, &node);
	return (result);
}
static isc_result_t del_keysigs ( dns_db_t * db , dns_dbversion_t * ver , dns_name_t * name , dns_diff_t * diff , dst_key_t * * keys , unsigned int nkeys ) { isc_result_t result ; dns_dbnode_t * node = NULL ; dns_rdataset_t rdataset ; dns_rdata_t rdata = DNS_RDATA_INIT ; unsigned int i ; dns_rdata_rrsig_t rrsig ; isc_boolean_t found ; dns_rdataset_init ( & rdataset ) ; result = dns_db_findnode ( db , name , ISC_FALSE , & node ) ; if ( result == ISC_R_NOTFOUND ) return ( ISC_R_SUCCESS ) ; if ( result != ISC_R_SUCCESS ) goto failure ; result = dns_db_findrdataset ( db , node , ver , dns_rdatatype_rrsig , dns_rdatatype_dnskey , ( isc_stdtime_t ) 0 , & rdataset , NULL ) ; dns_db_detachnode ( db , & node ) ; if ( result == ISC_R_NOTFOUND ) return ( ISC_R_SUCCESS ) ; if ( result != ISC_R_SUCCESS ) goto failure ; for ( result = dns_rdataset_first ( & rdataset ) ; result == ISC_R_SUCCESS ; result = dns_rdataset_next ( & rdataset ) ) { dns_rdataset_current ( & rdataset , & rdata ) ; result = dns_rdata_tostruct ( & rdata , & rrsig , NULL ) ; RUNTIME_CHECK ( result == ISC_R_SUCCESS ) ; found = ISC_FALSE ; for ( i = 0 ; i < nkeys ; i ++ ) { if ( rrsig . keyid == dst_key_id ( keys [ i ] ) ) { found = ISC_TRUE ; if ( ! dst_key_isprivate ( keys [ i ] ) ) { break ; } result = update_one_rr ( db , ver , diff , DNS_DIFFOP_DEL , name , rdataset . ttl , & rdata ) ; break ; } } if ( ! found ) result = update_one_rr ( db , ver , diff , DNS_DIFFOP_DEL , name , rdataset . ttl , & rdata ) ; dns_rdata_reset ( & rdata ) ; if ( result != ISC_R_SUCCESS ) break ; } dns_rdataset_disassociate ( & rdataset ) ; if ( result == ISC_R_NOMORE ) result = ISC_R_SUCCESS ; failure : if ( node != NULL ) dns_db_detachnode ( db , & node ) ; return ( result ) ; }
Delete expired RRsigs and any RRsigs we are about to re-sign.
Delete expired RRsigs and any RRsigs we are about to re - sign .
/*
					 * The re-signing code in zone.c
					 * will mark this as offline.
					 * Just skip the record for now.
					 */ /*
		 * If there is not a matching DNSKEY then delete the RRSIG.
		 */