::arg().set("zone-metadata-cache-ttl", "Seconds to cache zone metadata from the database") = "60";
::arg().set("consistent-backends", "Assume individual zones are not divided over backends. Send only ANY lookup operations to the backend to reduce the number of lookups") = "yes";
+
// Keep this line below all ::arg().set() statements
if (! ::arg().laxFile(configname)) {
cerr<<"Warning: unable to read configuration file '"<<configname<<"': "<<stringerror()<<endl;
UeberBackend::go();
}
+// This is a wrapper around UeberBackend, in order to be able to perform
+// a file creation check at destructor time.
+class UtilBackend : public UeberBackend
+{
+public:
+ UtilBackend(const string& pname = "default"): UeberBackend(pname) {}
+ UtilBackend(const UtilBackend &) = delete;
+ UtilBackend(UtilBackend &&) = delete;
+ UtilBackend& operator=(const UtilBackend&) = delete;
+ UtilBackend& operator=(UtilBackend&&) = delete;
+ ~UtilBackend();
+};
+
+UtilBackend::~UtilBackend()
+{
+ if (hasCreatedLocalFiles()) {
+ cout<<"WARNING: local files have been created as a result of this operation."<<endl
+ <<"Be sure to check the files owner, group and permission to make sure that"<<endl
+ <<"the authoritative server can correctly use them."<<endl;
+ }
+}
+
static bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true)
{
string output;
{
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
vector<string> domains;
if(!fname.empty()) {
static bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
vector<DomainInfo> domainInfo;
bool result = true;
static int checkAllZones(DNSSECKeeper &dk, bool exitOnError)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
vector<DomainInfo> domainInfo;
multi_index_container<
DomainInfo,
static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
SOAData sd;
if(!B.getSOAUncached(zone, sd)) {
cerr<<"No SOA for zone '"<<zone<<"'"<<endl;
}
static int deleteZone(const DNSName &zone) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if (! B.getDomainInfo(zone, di)) {
cerr << "Zone '" << zone << "' not found!" << endl;
}
static int listKeys(const string &zname, DNSSECKeeper& dk){
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
if (!zname.empty()) {
DomainInfo di;
}
static int listZone(const DNSName &zone) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if (! B.getDomainInfo(zone, di)) {
}
static int clearZone(const DNSName &zone) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if (! B.getDomainInfo(zone, di)) {
};
static int editZone(const DNSName &zone, const PDNSColors& col) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
DNSSECKeeper dk(&B);
}
static int loadZone(const DNSName& zone, const string& fname) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if (B.getDomainInfo(zone, di)) {
}
static int createZone(const DNSName &zone, const DNSName& nsname) {
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if (B.getDomainInfo(zone, di)) {
cerr << "Zone '" << zone << "' exists already" << endl;
rr.qtype = DNSRecordContent::TypeToNumber(cmds.at(3));
rr.ttl = ::arg().asNum("default-ttl");
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
if(!B.getDomainInfo(zone, di)) {
cerr << "Zone '" << zone << "' does not exist" << endl;
// addAutoPrimary add a new autoprimary
static int addAutoPrimary(const std::string& IP, const std::string& nameserver, const std::string& account)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
const AutoPrimary primary(IP, nameserver, account);
if (B.autoPrimaryAdd(primary)) {
return EXIT_SUCCESS;
static int removeAutoPrimary(const std::string &IP, const std::string &nameserver)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
const AutoPrimary primary(IP, nameserver, "");
if ( B.autoPrimaryRemove(primary) ){
return EXIT_SUCCESS;
static int listAutoPrimaries()
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
vector<AutoPrimary> primaries;
if ( !B.autoPrimariesList(primaries) ){
cerr<<"could not find a backend with autosecondary support"<<endl;
// delete-rrset zone name type
static int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_)
{
- UeberBackend B;
+ UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
DNSName zone(zone_);
if(!B.getDomainInfo(zone, di)) {
}
}
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
vector<DomainInfo> domains;
B.getAllDomains(&domains, false, g_verbose);
static int listMemberZones(const string& catalog)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DNSName catz(catalog);
DomainInfo di;
rr.auth=true;
rr.qclass = QClass::IN;
- UeberBackend db("key-only");
+ UtilBackend db("key-only"); //NOLINT(readability-identifier-length)
if ( db.backends.empty() )
{
static bool disableDNSSECOnZone(DNSSECKeeper& dk, const DNSName& zone)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)){
static int setZoneOptionsJson(const DNSName& zone, const string& options)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)) {
static int setZoneOption(const DNSName& zone, const string& type, const string& option, const set<string>& values)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
CatalogInfo ci;
static int setZoneCatalog(const DNSName& zone, const DNSName& catalog)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)) {
static int setZoneAccount(const DNSName& zone, const string &account)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)){
static int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)){
static bool showZone(DNSSECKeeper& dnsseckeeper, const DNSName& zone, bool exportDS = false) // NOLINT(readability-function-cognitive-complexity)
{
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)){
}
DomainInfo di;
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
// di.backend and B are mostly identical
if(!B.getDomainInfo(zone, di, false) || di.backend == nullptr) {
cerr<<"Can't find a zone called '"<<zone<<"'"<<endl;
cout<<endl;
cout<<"If this test reports an error and aborts, please check your database schema."<<endl;
cout<<"Constructing UeberBackend"<<endl;
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
cout<<"Picking first backend - if this is not what you want, edit launch line!"<<endl;
DNSBackend *db = B.backends[0].get();
cout << "Creating secondary zone " << zone << endl;
}
static int addOrSetMeta(const DNSName& zone, const string& kind, const vector<string>& values, bool clobber) {
- UeberBackend B("default");
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di;
if (!B.getDomainInfo(zone, di)) {
return 0;
}
DNSSECKeeper dk; //NOLINT(readability-identifier-length)
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
return checkZone(dk, B, DNSName(cmds.at(1)));
}
DNSSECKeeper dk; //NOLINT(readability-identifier-length)
DNSName zone(cmds.at(1));
- UeberBackend B("default"); //NOLINT(readability-identifier-length)
+ UtilBackend B("default"); //NOLINT(readability-identifier-length)
DomainInfo di; //NOLINT(readability-identifier-length)
if (!B.getDomainInfo(zone, di)){
cerr << "Syntax: pdnsutil create-secondary-zone ZONE primary-ip [primary-ip..]" << endl;
return 0;
}
- UeberBackend B; // NOLINT(readability-identifier-length)
+ UtilBackend B; // NOLINT(readability-identifier-length)
DomainInfo di; // NOLINT(readability-identifier-length)
DNSName zone(cmds.at(1));
if (B.getDomainInfo(zone, di)) {
cerr << "Syntax: pdnsutil change-secondary-zone-primary ZONE primary-ip [primary-ip..]" << endl;
return 0;
}
- UeberBackend B; // NOLINT(readability-identifier-length)
+ UtilBackend B; // NOLINT(readability-identifier-length)
DomainInfo di; // NOLINT(readability-identifier-length)
DNSName zone(cmds.at(1));
if (!B.getDomainInfo(zone, di)) {
}
DNSSECKeeper dk; //NOLINT(readability-identifier-length)
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
vector<DomainInfo> domainInfo;
B.getAllDomains(&domainInfo, false, false);
return 1;
}
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
if (B.setTSIGKey(name, DNSName(algo), key)) { // you are feeling bored, put up DNSName(algo) up earlier
cout << "Create new TSIG key " << name << " " << algo << " " << key << endl;
} else {
string algo = cmds.at(2);
string key = cmds.at(3);
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
if (B.setTSIGKey(name, DNSName(algo), key)) {
cout << "Imported TSIG key " << name << " " << algo << endl;
}
}
DNSName name(cmds.at(1));
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
if (B.deleteTSIGKey(name)) {
cout << "Deleted TSIG key " << name << endl;
}
static int listTSIGKeys([[maybe_unused]] vector<string>& cmds)
{
std::vector<struct TSIGKey> keys;
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
if (B.getTSIGKeys(keys)) {
for (const TSIGKey& key : keys) {
cout << key.name.toString() << " " << key.algorithm.toString() << " " << key.key << endl;
cerr << "Invalid parameter '" << cmds.at(3) << "', expected primary or secondary type" << endl;
return 1;
}
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
DomainInfo di; // NOLINT(readability-identifier-length)
if (!B.getDomainInfo(zname, di)) {
cerr << "Zone '" << zname << "' does not exist" << endl;
return 1;
}
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
DomainInfo di; // NOLINT(readability-identifier-length)
if (!B.getDomainInfo(zname, di)) {
cerr << "Zone '" << zname << "' does not exist" << endl;
static int getMeta(vector<string>& cmds)
{
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
if (cmds.size() < 2) {
cerr << "Syntax: " << cmds.at(0) << " zone [kind kind ..]" << endl;
return 1;
return 1;
}
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
DNSName zone(cmds.at(2));
// verify zone
cerr << "Usage: pdnsutil hsm create-key ZONE KEY-ID [BITS]" << endl;
return 1;
}
- UeberBackend B("default"); // NOLINT(readability-identifier-length)
+ UtilBackend B("default"); // NOLINT(readability-identifier-length)
DomainInfo di; // NOLINT(readability-identifier-length)
DNSName zone(cmds.at(2));
unsigned int id{0}; // NOLINT(readability-identifier-length)