]> granicus.if.org Git - pdns/commitdiff
Check that the domain isn't already served by the new master
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 9 Dec 2013 18:16:31 +0000 (20:16 +0200)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 9 Dec 2013 18:16:31 +0000 (20:16 +0200)
pdns/packethandler.cc

index 0d2daa66efe93533aaef8c8d88c1fdfbddfc4e26..e43802403d1a7977b3b8eccc8076fb871c72759a 100644 (file)
@@ -735,6 +735,7 @@ int PacketHandler::trySuperMaster(DNSPacket *p)
 
 int PacketHandler::trySuperMasterSynchronous(DNSPacket *p)
 {
+  DomainInfo di;
   Resolver::res_t nsset;
   try {
     Resolver resolver;
@@ -747,6 +748,14 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p)
     return RCode::ServFail;
   }
 
+  if (B.getDomainInfo(p->qdomain, di)) {
+    // maybe it is listed as master already
+    BOOST_FOREACH(string& master, di.masters) {
+      if (master == p->getRemote())
+        return RCode::NoError; // is already a master for this zone
+    }
+  }
+
   string account;
   DNSBackend *db;
   if(!B.superMasterBackend(p->getRemote(), p->qdomain, nsset, &account, &db)) {