Permalink
Browse files

check for duplicate records with pdnssec check-all-zones (Issue #607)

  • Loading branch information...
1 parent 7eaa83a commit fd53bd06d4851d0f90434ffce1374be7716193aa @mind04 mind04 committed with mind04 Sep 9, 2013
Showing with 14 additions and 1 deletion.
  1. +14 −1 pdns/pdnssec.cc
View
@@ -339,7 +339,7 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
DNSResourceRecord rr;
uint64_t numrecords=0, numerrors=0, numwarnings=0;
- set<string> cnames, noncnames;
+ set<string> records, cnames, noncnames;
while(sd.db->get(rr)) {
if(!endsOn(rr.qname, zone)) {
@@ -351,6 +351,18 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
if(!rr.qtype.getCode())
continue;
+ ostringstream content;
+ content<<rr.qname<<" "<<rr.qtype.getName();
+ if (rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV)
+ content<<" "<<rr.priority;
+ content<<" "<<rr.content;
+ if (records.count(content.str())) {
+ cout<<"[Error] Duplicate record found '"<<content.str()<<"' This do not belong in the database."<<endl;
+ numerrors++;
+ continue;
+ } else
+ records.insert(content.str());
+
if (rr.qtype.getCode() == QType::CNAME) {
if (!cnames.count(rr.qname))
cnames.insert(rr.qname);
@@ -364,6 +376,7 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
if(!dk.isPresigned(zone)) {
cout<<"[Error] RRSIG found at '"<<rr.qname<<"' in non-presigned zone. These do not belong in the database."<<endl;
numerrors++;
+ continue;
}
} else
noncnames.insert(rr.qname);

0 comments on commit fd53bd0

Please sign in to comment.