_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
return EXIT_SUCCESS;
}
+int changeSlaveZoneMaster(const vector<string>& cmds) {
+ UeberBackend B;
+ DomainInfo di;
+ DNSName zone(cmds[1]);
+ if (!B.getDomainInfo(zone, di)) {
+ cerr<<"Domain '"<<zone<<"' doesn't exist"<<endl;
+ return EXIT_FAILURE;
+ }
+ vector<string> masters;
+ for (unsigned i=2; i < cmds.size(); i++) {
+ ComboAddress master(cmds[i], 53);
+ masters.push_back(master.toStringWithPort());
+ }
+ cerr<<"Updating slave zone '"<<zone<<"', master(s) to '"<<boost::join(masters, ",")<<"'"<<endl;
+ di.backend->setMaster(zone, boost::join(masters, ","));
+ return EXIT_SUCCESS;
+}
+
// add-record ZONE name type [ttl] "content" ["content"]
int addOrReplaceRecord(bool addOrReplace, const vector<string>& cmds) {
DNSResourceRecord rr;
cout<<"create-bind-db FNAME Create DNSSEC db for BIND backend (bind-dnssec-db)"<<endl;
cout<<"create-slave-zone ZONE master-ip [master-ip..]"<<endl;
cout<<" Create slave zone ZONE with master IP address master-ip"<<endl;
+ cout<<"change-slave-zone-master ZONE master-ip [master-ip..]"<<endl;
+ cout<<" Change slave zone ZONE master IP address to master-ip"<<endl;
cout<<"create-zone ZONE [nsname] Create empty zone ZONE"<<endl;
cout<<"deactivate-tsig-key ZONE NAME {master|slave}"<<endl;
cout<<" Disable TSIG key for a zone"<<endl;
}
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..]"<<endl;
+ return 0;
+ }
+ exit(changeSlaveZoneMaster(cmds));
+ }
else if(cmds[0] == "add-record") {
if(cmds.size() < 5) {
cerr<<"Syntax: pdnsutil add-record ZONE name type [ttl] \"content\" [\"content\"...]"<<endl;