]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
pdnsutil load-zone: reject zones with broken rrs 10081/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 15 Feb 2021 08:23:01 +0000 (09:23 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 15 Feb 2021 08:23:01 +0000 (09:23 +0100)
pdns/pdnsutil.cc

index f5194473efb872d1b7521f91ef7af2d1e1b4a9cd..8ab839794062e828b554b511acba697dcbd95051 100644 (file)
@@ -1278,6 +1278,17 @@ static int loadZone(const DNSName& zone, const string& fname) {
       else
         haveSOA = true;
     }
+    try {
+      DNSRecordContent::mastermake(rr.qtype, QClass::IN, rr.content);
+    }
+    catch (const PDNSException &pe) {
+      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.getName()<<": "<<pe.reason<<endl;
+      return EXIT_FAILURE;
+    }
+    catch (const std::exception &e) {
+      cerr<<"Bad record content in record for "<<rr.qname<<"|"<<rr.qtype.getName()<<": "<<e.what()<<endl;
+      return EXIT_FAILURE;
+    }
     db->feedRecord(rr, DNSName());
   }
   db->commitTransaction();