From: Kees Monshouwer Date: Sat, 19 May 2018 13:25:56 +0000 (+0200) Subject: pdnsutil: auth check improvements X-Git-Tag: dnsdist-1.3.1~53^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6653%2Fhead;p=thirdparty%2Fpdns.git pdnsutil: auth check improvements --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 70a190d0ff..07179ae50e 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -487,12 +487,6 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vect numwarnings++; } } - - if(!suppliedrecords && rr.auth == 0 && rr.qtype.getCode()!=QType::NS && rr.qtype.getCode()!=QType::A && rr.qtype.getCode()!=QType::AAAA) - { - cout<<"[Error] Following record is auth=0, run pdnsutil rectify-zone?: "<doesDNSSEC()); + for( const auto &qname : checkOcclusion ) { + if( qname.second == QType::NS ) { + if( qname.first == rr.qname ) { + ds_ns = true; + } + if ( done ) { + continue; + } + if( rr.auth == 0 ) { + if( rr.qname.isPartOf( qname.first ) && ( qname.first != rr.qname || rr.qtype != QType::DS ) ) { + ok = done = true; + } + if( rr.qtype == QType::ENT && qname.first.isPartOf( rr.qname ) ) { + ok = done = true; + } + } else if( rr.qname.isPartOf( qname.first ) && ( ( qname.first != rr.qname || rr.qtype != QType::DS ) || rr.qtype == QType::NS ) ) { + ok = false; + done = true; + } + } + } + if( ! ds_ns && rr.qtype.getCode() == QType::DS && rr.qname != zone ) { + cout << "[Warning] DS record without a delegation '" << rr.qname<<"'." << endl; + numwarnings++; + } + if( ! ok && ! suppliedrecords ) { + cout << "[Error] Following record is auth=" << rr.auth << ", run pdnsutil rectify-zone?: " << rr.qname << " IN " << rr.qtype.getName() << " " << rr.content << endl; + numerrors++; + } + } + cout<<"Checked "<