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: rec-4.1.1^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91c294836c22550e7c63a5acfbdd539140f3a79d;p=thirdparty%2Fpdns.git rec: Correctly handle ancestor delegation NSEC{,3} for children (cherry picked from commit c943eb59dacc1ea2b178a8dcd28d1ecbe160cb7c) --- diff --git a/pdns/validate.cc b/pdns/validate.cc index 810bc8dd3a..00afcd7f26 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 "<