]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: ignore broken SOA content in getAllDomains()
authorKees Monshouwer <mind04@monshouwer.org>
Fri, 1 Oct 2021 21:39:13 +0000 (23:39 +0200)
committermind04 <mind04@monshouwer.org>
Wed, 6 Oct 2021 11:11:37 +0000 (13:11 +0200)
modules/tinydnsbackend/tinydnsbackend.cc
pdns/backends/gsql/gsqlbackend.cc

index 0dbcf85d16541aa7507a4ba9e41026c40a404beb..3936a23d9ea2e8c93728dcd1da22630624f85d96 100644 (file)
@@ -173,17 +173,23 @@ void TinyDNSBackend::getAllDomains(vector<DomainInfo>* domains, bool include_dis
 
   while (get(rr)) {
     if (rr.qtype.getCode() == QType::SOA && dupcheck.insert(rr.qname).second) {
-      SOAData sd;
-      fillSOAData(rr.content, sd);
-
       DomainInfo di;
       di.id = -1; //TODO: Check if this is ok.
       di.backend = this;
       di.zone = rr.qname;
-      di.serial = sd.serial;
-      di.notified_serial = sd.serial;
       di.kind = DomainInfo::Master;
       di.last_check = time(0);
+
+      SOAData sd;
+      try {
+        fillSOAData(rr.content, sd);
+        di.serial = sd.serial;
+      }
+      catch (const PDNSException& e) {
+        di.serial = 0;
+      }
+
+      di.notified_serial = di.serial;
       domains->push_back(di);
     }
   }
index 51cece2f4717052e1e9a7c4777d657bd4a3d968d..13b833ffb89fa969590ac7f7e400d9ed12967864 100644 (file)
@@ -1443,10 +1443,15 @@ void GSQLBackend::getAllDomains(vector<DomainInfo> *domains, bool include_disabl
         }
       }
 
-      if(!row[2].empty()) {
+      if (!row[2].empty()) {
         SOAData sd;
-        fillSOAData(row[2], sd);
-        di.serial = sd.serial;
+        try {
+          fillSOAData(row[2], sd);
+          di.serial = sd.serial;
+        }
+        catch (const PDNSException& e) {
+          di.serial = 0;
+        }
       }
       try {
         di.notified_serial = pdns_stou(row[5]);