namespace {
bool g_verbose;
+ bool g_force;
}
ArgvMap &arg()
return -1;
}
+ DomainInfo info;
+ if (!B.getDomainInfo(zone, info, false)) {
+ cout << "[Warning] Unable to get zone information for zone '" << zone << "'" << endl;
+ if (!g_force) {
+ throw PDNSException("Operation is not allowed unless --force");
+ }
+ }
+ else {
+ if (info.isSecondaryType() && !g_force) {
+ throw PDNSException("Operation on a secondary zone is not allowed unless --force");
+ }
+ }
+
string soaEditKind;
dk.getSoaEdit(zone, soaEditKind);
return EXIT_FAILURE;
}
+ if (isatty(STDIN_FILENO) == 0) {
+ cerr << "edit-zone requires a terminal" << endl;
+ return EXIT_FAILURE;
+ }
+
+ if (di.isSecondaryType() && !g_force) {
+ cout << "Zone '" << zone << "' is a secondary zone." << endl;
+ while (true) {
+ cout << "Edit the zone anyway? (N/y) " << std::flush;
+ int resp = read1char();
+ if (resp != '\n') {
+ cout << endl;
+ }
+ if (resp == 'y' || resp == 'Y') {
+ break;
+ }
+ if (resp == 'n' || resp == 'N' || resp == '\n') {
+ return EXIT_FAILURE;
+ }
+ }
+ }
+
/* ensure that the temporary file will only
be accessible by the current user, not even
by other users in the same group, and certainly
cerr << "Zone '" << zone << "' does not exist" << endl;
return EXIT_FAILURE;
}
+ if (di.isSecondaryType() && !g_force) {
+ throw PDNSException("Operation on a secondary zone is not allowed unless --force");
+ }
rr.auth = true;
rr.domain_id = di.id;
rr.qname = name;
cerr << "Zone '" << zone << "' does not exist" << endl;
return EXIT_FAILURE;
}
+ if (di.isSecondaryType() && !g_force) {
+ throw PDNSException("Operation on a secondary zone is not allowed unless --force");
+ }
DNSName name;
if(name_=="@")
}
g_verbose = g_vm.count("verbose") != 0;
+ g_force = g_vm.count("force") != 0;
if (g_vm.count("version") != 0) {
cout<<"pdnsutil "<<VERSION<<endl;