diff options
author | dougb <dougb@FreeBSD.org> | 2012-04-05 04:29:35 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2012-04-05 04:29:35 +0000 |
commit | 0adb91c0ac8b4cb02cf5b6c0214cfbaed14c3ca7 (patch) | |
tree | cf3176c0801c94a4f298353cc450f10cf1aae9c0 /contrib/bind9/lib/dns/validator.c | |
parent | cc55f4943b841b3772901d62a327ad4f9edb2c95 (diff) | |
download | FreeBSD-src-0adb91c0ac8b4cb02cf5b6c0214cfbaed14c3ca7.zip FreeBSD-src-0adb91c0ac8b4cb02cf5b6c0214cfbaed14c3ca7.tar.gz |
Update to version 9.8.2, the latest from ISC, which contains numerous bug fixes.
Diffstat (limited to 'contrib/bind9/lib/dns/validator.c')
-rw-r--r-- | contrib/bind9/lib/dns/validator.c | 75 |
1 files changed, 56 insertions, 19 deletions
diff --git a/contrib/bind9/lib/dns/validator.c b/contrib/bind9/lib/dns/validator.c index 9c532a2..3f9aae7 100644 --- a/contrib/bind9/lib/dns/validator.c +++ b/contrib/bind9/lib/dns/validator.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: validator.c,v 1.197.14.7 2011-06-08 23:02:43 each Exp $ */ +/* $Id$ */ #include <config.h> @@ -846,7 +846,7 @@ cnamevalidated(isc_task_t *task, isc_event_t *event) { * Return ISC_R_IGNORE when the NSEC is not the appropriate one. */ static isc_result_t -nsecnoexistnodata(dns_validator_t *val, dns_name_t* name, dns_name_t *nsecname, +nsecnoexistnodata(dns_validator_t *val, dns_name_t *name, dns_name_t *nsecname, dns_rdataset_t *nsecset, isc_boolean_t *exists, isc_boolean_t *data, dns_name_t *wild) { @@ -887,9 +887,11 @@ nsecnoexistnodata(dns_validator_t *val, dns_name_t* name, dns_name_t *nsecname, if (order == 0) { /* - * The names are the same. + * The names are the same. If we are validating "." + * then atparent should not be set as there is no parent. */ - atparent = dns_rdatatype_atparent(val->event->type); + atparent = (olabels != 1) && + dns_rdatatype_atparent(val->event->type); ns = dns_nsec_typepresent(&rdata, dns_rdatatype_ns); soa = dns_nsec_typepresent(&rdata, dns_rdatatype_soa); if (ns && !soa) { @@ -1920,14 +1922,17 @@ verify(dns_validator_t *val, dst_key_t *key, dns_rdata_t *rdata, isc_result_t result; dns_fixedname_t fixed; isc_boolean_t ignore = ISC_FALSE; + dns_name_t *wild; val->attributes |= VALATTR_TRIEDVERIFY; dns_fixedname_init(&fixed); + wild = dns_fixedname_name(&fixed); again: result = dns_dnssec_verify2(val->event->name, val->event->rdataset, - key, ignore, val->view->mctx, rdata, - dns_fixedname_name(&fixed)); - if (result == DNS_R_SIGEXPIRED && val->view->acceptexpired) { + key, ignore, val->view->mctx, rdata, wild); + if ((result == DNS_R_SIGEXPIRED || result == DNS_R_SIGFUTURE) && + val->view->acceptexpired) + { ignore = ISC_TRUE; goto again; } @@ -1936,14 +1941,29 @@ verify(dns_validator_t *val, dst_key_t *key, dns_rdata_t *rdata, "accepted expired %sRRSIG (keyid=%u)", (result == DNS_R_FROMWILDCARD) ? "wildcard " : "", keyid); + else if (result == DNS_R_SIGEXPIRED || result == DNS_R_SIGFUTURE) + validator_log(val, ISC_LOG_INFO, + "verify failed due to bad signature (keyid=%u): " + "%s", keyid, isc_result_totext(result)); else validator_log(val, ISC_LOG_DEBUG(3), "verify rdataset (keyid=%u): %s", keyid, isc_result_totext(result)); if (result == DNS_R_FROMWILDCARD) { - if (!dns_name_equal(val->event->name, - dns_fixedname_name(&fixed))) + if (!dns_name_equal(val->event->name, wild)) { + dns_name_t *closest; + unsigned int labels; + + /* + * Compute the closest encloser in case we need it + * for the NSEC3 NOQNAME proof. + */ + closest = dns_fixedname_name(&val->closest); + dns_name_copy(wild, closest, NULL); + labels = dns_name_countlabels(closest) - 1; + dns_name_getlabelsequence(closest, 1, labels, closest); val->attributes |= VALATTR_NEEDNOQNAME; + } result = ISC_R_SUCCESS; } return (result); @@ -2871,9 +2891,9 @@ findnsec3proofs(dns_validator_t *val) { dns_name_t *name, tname; isc_result_t result; isc_boolean_t exists, data, optout, unknown; - isc_boolean_t setclosest, setnearest; + isc_boolean_t setclosest, setnearest, *setclosestp; dns_fixedname_t fclosest, fnearest, fzonename; - dns_name_t *closest, *nearest, *zonename; + dns_name_t *closest, *nearest, *zonename, *closestp; dns_name_t **proofs = val->event->proofs; dns_rdataset_t *rdataset, trdataset; @@ -2920,6 +2940,25 @@ findnsec3proofs(dns_validator_t *val) { if (dns_name_countlabels(zonename) == 0) return (ISC_R_SUCCESS); + /* + * If the val->closest is set then we want to use it otherwise + * we need to discover it. + */ + if (dns_name_countlabels(dns_fixedname_name(&val->closest)) != 0) { + char namebuf[DNS_NAME_FORMATSIZE]; + + dns_name_format(dns_fixedname_name(&val->closest), + namebuf, sizeof(namebuf)); + validator_log(val, ISC_LOG_DEBUG(3), "closest encloser from " + "wildcard signature '%s'", namebuf); + dns_name_copy(dns_fixedname_name(&val->closest), closest, NULL); + closestp = NULL; + setclosestp = NULL; + } else { + closestp = closest; + setclosestp = &setclosest; + } + for (result = val_rdataset_first(val, &name, &rdataset); result == ISC_R_SUCCESS; result = val_rdataset_next(val, &name, &rdataset)) @@ -2937,8 +2976,8 @@ findnsec3proofs(dns_validator_t *val) { unknown = ISC_FALSE; (void)nsec3noexistnodata(val, val->event->name, name, rdataset, zonename, &exists, &data, &optout, - &unknown, &setclosest, &setnearest, - closest, nearest); + &unknown, setclosestp, &setnearest, + closestp, nearest); if (setclosest) proofs[DNS_VALIDATOR_CLOSESTENCLOSER] = name; if (unknown) @@ -3704,9 +3743,8 @@ proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume) result = ISC_R_SUCCESS; goto out; } - result = startfinddlvsep(val, - dns_fixedname_name(&val->fname)); - goto out; + return(startfinddlvsep(val, + dns_fixedname_name(&val->fname))); } val->labels++; } @@ -3842,8 +3880,7 @@ proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume) result = ISC_R_SUCCESS; goto out; } - result = startfinddlvsep(val, tname); - goto out; + return(startfinddlvsep(val, tname)); } continue; } |