From 3b797caab6583a6a7452a0eaf45fd7a670b4242c Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Mon, 9 Dec 2013 20:16:31 +0200 Subject: [PATCH] Check that the domain isn't already served by the new master --- pdns/packethandler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 0d2daa66e..e43802403 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -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)) { -- 2.40.0