From: Hannu Ylitalo Date: Sat, 27 Aug 2016 08:09:58 +0000 (+0300) Subject: pdnsutil: Added change-slave-zone-master for changing slave zone master(s) X-Git-Tag: dnsdist-1.1.0-beta2~139^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=324ead90a394420eee5a9c19ccf97cc19f0f46ca;p=thirdparty%2Fpdns.git pdnsutil: Added change-slave-zone-master for changing slave zone master(s) --- diff --git a/contrib/pdnsutil.bash_completion.d b/contrib/pdnsutil.bash_completion.d index 4837f602b2..747de2d66e 100644 --- a/contrib/pdnsutil.bash_completion.d +++ b/contrib/pdnsutil.bash_completion.d @@ -15,7 +15,7 @@ have pdnsutil && { _pdnsutil_helper_local_() { local cur prev cmd - local _PDNSUTIL_ALL_CMDS="activate-tsig-key activate-zone-key add-record add-zone-key backend-cmd b2b-migrate bench-db check-zone check-all-zones clear-zone + local _PDNSUTIL_ALL_CMDS="activate-tsig-key activate-zone-key add-record add-zone-key backend-cmd b2b-migrate bench-db change-slave-zone-master check-zone check-all-zones clear-zone create-bind-db create-slave-zone create-zone deactivate-tsig-key deactivate-zone-key delete-rrset delete-tsig-key delete-zone disable-dnssec edit-zone export-zone-dnskey export-zone-key generate-tsig-key generate-zone-key get-meta hash-zone-record increase-serial import-tsig-key import-zone-key load-zone list-algorithms list-keys list-zone list-all-zones list-tsig-keys rectify-zone rectify-all-zones remove-zone-key diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index c2d72f86a1..51d34326e4 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1197,6 +1197,24 @@ int createSlaveZone(const vector& cmds) { return EXIT_SUCCESS; } +int changeSlaveZoneMaster(const vector& cmds) { + UeberBackend B; + DomainInfo di; + DNSName zone(cmds[1]); + if (!B.getDomainInfo(zone, di)) { + cerr<<"Domain '"< masters; + for (unsigned i=2; i < cmds.size(); i++) { + ComboAddress master(cmds[i], 53); + masters.push_back(master.toStringWithPort()); + } + cerr<<"Updating slave zone '"<setMaster(zone, boost::join(masters, ",")); + return EXIT_SUCCESS; +} + // add-record ZONE name type [ttl] "content" ["content"] int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { DNSResourceRecord rr; @@ -1920,6 +1938,8 @@ try cout<<"create-bind-db FNAME Create DNSSEC db for BIND backend (bind-dnssec-db)"<()); } exit(createSlaveZone(cmds)); } + else if(cmds[0] == "change-slave-zone-master") { + if(cmds.size() < 3 ) { + cerr<<"Syntax: pdnsutil change-slave-zone-master ZONE master-ip [master-ip..]"<