]> granicus.if.org Git - pdns/commitdiff
supermaster: check for missing ns records
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 13 Dec 2014 21:14:42 +0000 (22:14 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 13 Dec 2014 21:14:42 +0000 (22:14 +0100)
If the master has a SOA record for a domain but
no NS records, we tried to look up the SOA record
in the supermasters table.

pdns/packethandler.cc

index dfa0bba2baec66b4260d08a56d44da42c2c6bbee..9152c087e3b8505feee56ddab85bb3fd0d342845 100644 (file)
@@ -730,6 +730,18 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p)
     return RCode::ServFail;
   }
 
+  // check if the returned records are NS records
+  bool haveNS=false;
+  BOOST_FOREACH(const DNSResourceRecord& ns, nsset) {
+    if(ns.qtype.getCode()==QType::NS)
+      haveNS=true;
+  }
+
+  if(!haveNS) {
+    L<<Logger::Error<<"Error resolving NS for "<<p->qdomain<<" at: "<< p->getRemote()<<endl;
+    return RCode::ServFail;
+  }
+
   string nameserver, account;
   DNSBackend *db;
   if(!B.superMasterBackend(p->getRemote(), p->qdomain, nsset, &nameserver, &account, &db)) {