]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make check-zone also check whether there are duplicate key value pair domaindatas...
authorRobin Geuze <robing@transip.nl>
Tue, 11 Feb 2020 17:05:09 +0000 (18:05 +0100)
committerRobin Geuze <robing@transip.nl>
Mon, 8 Feb 2021 09:36:35 +0000 (10:36 +0100)
pdns/pdnsutil.cc

index ecabdd61fab43aa5f00bb649697e63857b004113..08cfbf8ed7ff3bffc69cc8b6254cd38f6bf8c52b 100644 (file)
@@ -713,6 +713,27 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     }
   }
 
+  std::map<std::string, std::vector<std::string>> metadatas;
+  if (!B.getAllDomainMetadata(zone, metadatas)) {
+    cout << "[Error] Unable to retrieve metadata for zone " << zone << endl;
+    numerrors++;
+  }
+
+  for (const auto &metaData : metadatas) {
+    set<string> seen;
+    set<string> messaged;
+
+    for (const auto &value : metaData.second) {
+      if (seen.count(value) <= 0) {
+        seen.insert(value);
+      } else if (messaged.count(value) <= 0) {
+        cout << "[Error] Found duplicate metadata key value pair for zone " << zone << " with key " << metaData.first << " and value " << value << endl;
+        numerrors++;
+        messaged.insert(value);
+      }
+    }
+  }
+
   cout<<"Checked "<<records.size()<<" records of '"<<zone<<"', "<<numerrors<<" errors, "<<numwarnings<<" warnings."<<endl;
   if(!numerrors)
     return EXIT_SUCCESS;