]> granicus.if.org Git - pdns/commitdiff
Auth: PDNSException for bad SOA MNAME or RNAME
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 29 Jul 2016 10:21:25 +0000 (12:21 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 29 Jul 2016 10:21:25 +0000 (12:21 +0200)
This prevents blowing up the bind backend on startup when one zone
contains a bad SOA record.

pdns/zoneparser-tng.cc

index d1f8bacf794bc954e5ea15a0dc3ae0a06533b37b..c4f4becba4f7c13a79f38541e69853f315db608b 100644 (file)
@@ -452,8 +452,12 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
     if(recparts.size() > 7)
       throw PDNSException("SOA record contents for "+rr.qname.toString()+" contains too many parts");
     if(recparts.size() > 1) {
-      recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
-      recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
+      try {
+        recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
+        recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
+      } catch (runtime_error &re) {
+        throw PDNSException(re.what());
+      }
     }
     rr.content.clear();
     for(string::size_type n = 0; n < recparts.size(); ++n) {