From: Remi Gacogne Date: Thu, 11 Jan 2018 14:05:22 +0000 (+0100) Subject: rec: Correctly handle ancestor delegation NSEC{,3} for children X-Git-Tag: dnsdist-1.3.0~140^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b580fad23a06d68550b20dba5bf6d119fd5287a7;p=pdns rec: Correctly handle ancestor delegation NSEC{,3} for children --- diff --git a/pdns/validate.cc b/pdns/validate.cc index 99258de24..2aa29748d 100644 --- a/pdns/validate.cc +++ b/pdns/validate.cc @@ -155,6 +155,20 @@ static DNSName getNSECOwnerName(const DNSName& initialOwner, const std::vector nsec) +{ + return nsec->d_set.count(QType::NS) && + !nsec->d_set.count(QType::SOA) && + signer.countLabels() < owner.countLabels(); +} + +static bool isNSEC3AncestorDelegation(const DNSName& signer, const DNSName& owner, const std::shared_ptr nsec3) +{ + return nsec3->d_set.count(QType::NS) && + !nsec3->d_set.count(QType::SOA) && + signer.countLabels() < owner.countLabels(); +} + static bool provesNoDataWildCard(const DNSName& qname, const uint16_t qtype, const cspmap_t& validrrsets) { LOG("Trying to prove that there is no data in wildcard for "<d_set.count(QType::NS) && !nsec->d_set.count(QType::SOA) && - signer.countLabels() < owner.countLabels()) { + if (qtype != QType::DS && (qname == owner || qname.isPartOf(owner)) && isNSECAncestorDelegation(signer, owner, nsec)) { LOG("type is "<d_set.count(QType::NS))<<", SOA is "<d_set.count(QType::SOA))<<", signer is "<d_set.count(qtype)) { LOG("Does _not_ deny existence of type "<d_set.count(QType::NS) && !nsec3->d_set.count(QType::SOA) && - signer.countLabels() < v.first.first.countLabels()) { + if (qtype != QType::DS && beginHash == h && isNSEC3AncestorDelegation(signer, v.first.first, nsec3)) { LOG("type is "<d_set.count(QType::NS))<<", SOA is "<d_set.count(QType::SOA))<<", signer is "<d_set.count(qtype)) { LOG("Does _not_ deny existence of type "<