From 05373aca9d696de67fe0dfcfc426ff4d178c308c Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sat, 15 Oct 2011 05:10:04 +0000 Subject: [PATCH] 3173. [port] Correctly validate root DS responses. [RT #25726] --- CHANGES | 2 ++ bin/tests/system/dnssec/tests.sh | 13 ++++++++++++- lib/dns/validator.c | 10 ++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index f30bede0b1..1df754e659 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +3173. [port] Correctly validate root DS responses. [RT #25726] + 3171. [bug] Exclusively lock the task when adding a zone using 'rndc addzone'. [RT #25600] diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh index 86718d1e32..671b4a2022 100644 --- a/bin/tests/system/dnssec/tests.sh +++ b/bin/tests/system/dnssec/tests.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: tests.sh,v 1.73.14.13 2011/09/02 21:54:52 each Exp $ +# $Id: tests.sh,v 1.73.14.14 2011/10/15 05:10:04 marka Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh @@ -1171,6 +1171,17 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:checking that root DS queries validate ($n)" +ret=0 +$DIG $DIGOPTS +noauth . @10.53.0.1 ds > dig.out.ns1.test$n || ret=1 +$DIG $DIGOPTS +noauth . @10.53.0.4 ds > dig.out.ns4.test$n || ret=1 +$PERL ../digcomp.pl dig.out.ns1.test$n dig.out.ns4.test$n || ret=1 +grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1 +grep "status: NOERROR" dig.out.ns4.test$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + echo "I:checking expired signatures remain with "'"allow-update { none; };"'" and no keys available ($n)" ret=0 $DIG $DIGOPTS +noauth expired.example. +dnssec @10.53.0.3 soa > dig.out.ns2.test$n || ret=1 diff --git a/lib/dns/validator.c b/lib/dns/validator.c index c35875dcfb..27b8459258 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -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: validator.c,v 1.197.14.8 2011/10/15 05:10:04 marka Exp $ */ #include @@ -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) {