From: Chris Hofstaedtler Date: Fri, 10 Aug 2018 12:08:48 +0000 (+0200) Subject: check-all-zones: find duplicate zones and SOAs X-Git-Tag: dnsdist-1.3.3~163^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9e61eb773eb1a85cce24bfd063af613307de57f;p=thirdparty%2Fpdns.git check-all-zones: find duplicate zones and SOAs --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index a8ae1c18f1..f6d7b7ffde 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -604,15 +604,41 @@ int checkAllZones(DNSSECKeeper &dk, bool exitOnError) { UeberBackend B("default"); vector domainInfo; + struct name{}; + struct id{}; + multi_index_container< + DomainInfo, + indexed_by< + ordered_non_unique< member, CanonDNSNameCompare >, + ordered_non_unique< member > + > + > seenInfos; + auto& seenNames = seenInfos.get<0>(); + auto& seenIds = seenInfos.get<1>(); B.getAllDomains(&domainInfo, true); int errors=0; for(auto di : domainInfo) { if (checkZone(dk, B, di.zone) > 0) { errors++; - if(exitOnError) - return EXIT_FAILURE; } + + auto seenName = seenNames.find(di.zone); + if (seenName != seenNames.end()) { + cout<<"[Error] Another SOA for zone '"<serial<<")."<getPrefix()<<" has already been used by zone '"<zone<<"' in backend "<backend->getPrefix()<<"."<