From: Kees Monshouwer Date: Mon, 5 Jun 2017 19:39:43 +0000 (+0200) Subject: auth: use override in backends to prevent future mistakes X-Git-Tag: rec-4.1.0-alpha1~93^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d57d715567fc01ae169a0ed4ecddb75f707becc5;p=thirdparty%2Fpdns.git auth: use override in backends to prevent future mistakes --- diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index d8c6f50c22..08e424ab90 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -188,44 +188,43 @@ class Bind2Backend : public DNSBackend public: Bind2Backend(const string &suffix="", bool loadZones=true); ~Bind2Backend(); - void getUnfreshSlaveInfos(vector *unfreshDomains); - void getUpdatedMasters(vector *changedDomains); - bool getDomainInfo(const DNSName &domain, DomainInfo &di); + void getUnfreshSlaveInfos(vector *unfreshDomains) override; + void getUpdatedMasters(vector *changedDomains) override; + bool getDomainInfo(const DNSName &domain, DomainInfo &di) override; time_t getCtime(const string &fname); // DNSSEC - virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after); - void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1); - bool list(const DNSName &target, int id, bool include_disabled=false); - bool get(DNSResourceRecord &); - // bool get(DNSZoneRecord &) override; - void getAllDomains(vector *domains, bool include_disabled=false); + bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override; + void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1) override; + bool list(const DNSName &target, int id, bool include_disabled=false) override; + bool get(DNSResourceRecord &) override; + void getAllDomains(vector *domains, bool include_disabled=false) override; static DNSBackend *maker(); static pthread_mutex_t s_startup_lock; - void setFresh(uint32_t domain_id); - void setNotified(uint32_t id, uint32_t serial); - bool startTransaction(const DNSName &qname, int id); - bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername); - bool commitTransaction(); - bool abortTransaction(); - void alsoNotifies(const DNSName &domain, set *ips); - bool searchRecords(const string &pattern, int maxResults, vector& result); + void setFresh(uint32_t domain_id) override; + void setNotified(uint32_t id, uint32_t serial) override; + bool startTransaction(const DNSName &qname, int id) override; + bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) override; + bool commitTransaction() override; + bool abortTransaction() override; + void alsoNotifies(const DNSName &domain, set *ips) override; + bool searchRecords(const string &pattern, int maxResults, vector& result) override; // the DNSSEC related (getDomainMetadata has broader uses too) - virtual bool getAllDomainMetadata(const DNSName& name, std::map >& meta); - virtual bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); - virtual bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta); - virtual bool getDomainKeys(const DNSName& name, std::vector& keys); - virtual bool removeDomainKey(const DNSName& name, unsigned int id); - virtual bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id); - virtual bool activateDomainKey(const DNSName& name, unsigned int id); - virtual bool deactivateDomainKey(const DNSName& name, unsigned int id); - virtual bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content); - virtual bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content); - virtual bool deleteTSIGKey(const DNSName& name); - virtual bool getTSIGKeys(std::vector< struct TSIGKey > &keys); - virtual bool doesDNSSEC(); + bool getAllDomainMetadata(const DNSName& name, std::map >& meta) override; + bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; + bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) override; + bool getDomainKeys(const DNSName& name, std::vector& keys) override; + bool removeDomainKey(const DNSName& name, unsigned int id) override; + bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override; + bool activateDomainKey(const DNSName& name, unsigned int id) override; + bool deactivateDomainKey(const DNSName& name, unsigned int id) override; + bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) override; + bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override; + bool deleteTSIGKey(const DNSName& name) override; + bool getTSIGKeys(std::vector< struct TSIGKey > &keys) override; + bool doesDNSSEC() override; // end of DNSSEC typedef multi_index_container < BB2DomainInfo , diff --git a/modules/geoipbackend/geoipbackend.hh b/modules/geoipbackend/geoipbackend.hh index 79bfca291f..6f0c678980 100644 --- a/modules/geoipbackend/geoipbackend.hh +++ b/modules/geoipbackend/geoipbackend.hh @@ -51,22 +51,22 @@ public: GeoIPBackend(const std::string& suffix=""); ~GeoIPBackend(); - virtual void lookup(const QType &qtype, const DNSName &qdomain, DNSPacket *pkt_p=0, int zoneId=-1); - virtual bool list(const DNSName &target, int domain_id, bool include_disabled=false) { return false; } // not supported - virtual bool get(DNSResourceRecord &r); - virtual void reload(); - virtual void rediscover(string *status = 0); - virtual bool getDomainInfo(const DNSName& domain, DomainInfo &di); + void lookup(const QType &qtype, const DNSName &qdomain, DNSPacket *pkt_p=0, int zoneId=-1) override; + bool list(const DNSName &target, int domain_id, bool include_disabled=false) override { return false; } // not supported + bool get(DNSResourceRecord &r) override; + void reload() override; + void rediscover(string *status = 0) override; + bool getDomainInfo(const DNSName& domain, DomainInfo &di) override; // dnssec support - virtual bool doesDNSSEC() { return d_dnssec; }; - virtual bool getAllDomainMetadata(const DNSName& name, std::map >& meta); - virtual bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); - virtual bool getDomainKeys(const DNSName& name, std::vector& keys); - virtual bool removeDomainKey(const DNSName& name, unsigned int id); - virtual bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id); - virtual bool activateDomainKey(const DNSName& name, unsigned int id); - virtual bool deactivateDomainKey(const DNSName& name, unsigned int id); + bool doesDNSSEC() override { return d_dnssec; }; + bool getAllDomainMetadata(const DNSName& name, std::map >& meta) override; + bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; + bool getDomainKeys(const DNSName& name, std::vector& keys) override; + bool removeDomainKey(const DNSName& name, unsigned int id) override; + bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override; + bool activateDomainKey(const DNSName& name, unsigned int id) override; + bool deactivateDomainKey(const DNSName& name, unsigned int id) override; enum GeoIPQueryAttribute { ASn, diff --git a/modules/godbcbackend/sodbc.hh b/modules/godbcbackend/sodbc.hh index 9a1468f7b6..d01377a4cd 100644 --- a/modules/godbcbackend/sodbc.hh +++ b/modules/godbcbackend/sodbc.hh @@ -67,9 +67,9 @@ public: SSqlStatement* prepare(const string& query, int nparams); void execute(const string& query); - void startTransaction(); - void rollback(); - void commit(); + void startTransaction() override; + void rollback() override; + void commit() override; //! Returns an exception. SSqlException sPerrorException( const std::string & reason ); diff --git a/modules/ldapbackend/ldapbackend.hh b/modules/ldapbackend/ldapbackend.hh index f3e584c8df..265d93e800 100644 --- a/modules/ldapbackend/ldapbackend.hh +++ b/modules/ldapbackend/ldapbackend.hh @@ -139,15 +139,15 @@ class LdapBackend : public DNSBackend ~LdapBackend(); // Native backend - bool list( const DNSName& target, int domain_id, bool include_disabled=false ); - void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ); - bool get( DNSResourceRecord& rr ); + bool list( const DNSName& target, int domain_id, bool include_disabled=false ) override; + void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ) override; + bool get( DNSResourceRecord& rr ) override; - bool getDomainInfo( const string& domain, DomainInfo& di ); + bool getDomainInfo( const string& domain, DomainInfo& di ) override; // Master backend - void getUpdatedMasters( vector* domains ); - void setNotified( uint32_t id, uint32_t serial ); + void getUpdatedMasters( vector* domains ) override; + void setNotified( uint32_t id, uint32_t serial ) override; }; #endif /* LDAPBACKEND_HH */ diff --git a/modules/luabackend/luabackend.hh b/modules/luabackend/luabackend.hh index 7b4722bfb6..c6004a0639 100644 --- a/modules/luabackend/luabackend.hh +++ b/modules/luabackend/luabackend.hh @@ -54,11 +54,11 @@ public: LUABackend(const string &suffix=""); ~LUABackend(); - bool list(const DNSName &target, int domain_id, bool include_disabled=false); - void lookup(const QType &qtype, const DNSName &qname, DNSPacket *p, int domain_id); - bool get(DNSResourceRecord &rr); + bool list(const DNSName &target, int domain_id, bool include_disabled=false) override; + void lookup(const QType &qtype, const DNSName &qname, DNSPacket *p, int domain_id) override; + bool get(DNSResourceRecord &rr) override; //! fills the soadata struct with the SOA details. Returns false if there is no SOA. - bool getSOA(const string &name, SOAData &soadata, DNSPacket *p=0); + bool getSOA(const string &name, SOAData &soadata, DNSPacket *p=0) override; // MASTER BACKEND diff --git a/modules/mydnsbackend/mydnsbackend.hh b/modules/mydnsbackend/mydnsbackend.hh index 28c56e3cd2..0ee6afa134 100644 --- a/modules/mydnsbackend/mydnsbackend.hh +++ b/modules/mydnsbackend/mydnsbackend.hh @@ -36,11 +36,11 @@ public: MyDNSBackend(const string &suffix); ~MyDNSBackend(); - void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1); - bool list(const DNSName &target, int domain_id, bool include_disabled=false); - bool get(DNSResourceRecord &r); - bool getSOA(const DNSName& name, SOAData& soadata, DNSPacket*); - void getAllDomains(vector *domains, bool include_disabled=false); + void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1) override; + bool list(const DNSName &target, int domain_id, bool include_disabled=false) override; + bool get(DNSResourceRecord &r) override; + bool getSOA(const DNSName& name, SOAData& soadata, DNSPacket*) override; + void getAllDomains(vector *domains, bool include_disabled=false) override; private: SMySQL *d_db; diff --git a/modules/opendbxbackend/odbxbackend.cc b/modules/opendbxbackend/odbxbackend.cc index d6e9fb963a..5932f4da93 100644 --- a/modules/opendbxbackend/odbxbackend.cc +++ b/modules/opendbxbackend/odbxbackend.cc @@ -674,7 +674,7 @@ bool OdbxBackend::createSlaveDomain( const string& ip, const string& domain, con -bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName ordername ) +bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordername ) { try { diff --git a/modules/opendbxbackend/odbxbackend.hh b/modules/opendbxbackend/odbxbackend.hh index efe3b6b4cd..67f0106797 100644 --- a/modules/opendbxbackend/odbxbackend.hh +++ b/modules/opendbxbackend/odbxbackend.hh @@ -76,26 +76,26 @@ public: OdbxBackend( const string& suffix="" ); ~OdbxBackend(); - void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ); - bool getSOA( const DNSName& domain, SOAData& sd, DNSPacket* p ); - bool list( const DNSName& target, int domain_id, bool include_disabled=false ); - bool get( DNSResourceRecord& rr ); - - bool startTransaction( const string& domain, int domain_id ); - bool commitTransaction(); - bool abortTransaction(); - - bool isMaster( const string& domain, const string& ip ); - bool getDomainInfo( const string& domain, DomainInfo& di ); - bool feedRecord( const DNSResourceRecord& rr, const DNSName ordername ); - bool createSlaveDomain( const string& ip, const string& domain, const string &nameserver, const string& account ); - bool superMasterBackend( const string& ip, const string& domain, const vector& nsset, string *nameserver, string* account, DNSBackend** ddb ); - - void getUpdatedMasters( vector* updated ); - void getUnfreshSlaveInfos( vector* unfresh ); - - void setFresh( uint32_t domain_id ); - void setNotified( uint32_t domain_id, uint32_t serial ); + void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ) override; + bool getSOA( const DNSName& domain, SOAData& sd, DNSPacket* p ) override; + bool list( const DNSName& target, int domain_id, bool include_disabled=false ) override; + bool get( DNSResourceRecord& rr ) override; + + bool startTransaction( const string& domain, int domain_id ) override; + bool commitTransaction() override; + bool abortTransaction() override; + + bool isMaster( const string& domain, const string& ip ) override; + bool getDomainInfo( const string& domain, DomainInfo& di ) override; + bool feedRecord( const DNSResourceRecord& rr, const DNSName& ordername ) override; + bool createSlaveDomain( const string& ip, const string& domain, const string &nameserver, const string& account ) override; + bool superMasterBackend( const string& ip, const string& domain, const vector& nsset, string *nameserver, string* account, DNSBackend** ddb ) override; + + void getUpdatedMasters( vector* updated ) override; + void getUnfreshSlaveInfos( vector* unfresh ) override; + + void setFresh( uint32_t domain_id ) override; + void setNotified( uint32_t domain_id, uint32_t serial ) override; }; diff --git a/modules/oraclebackend/oraclebackend.hh b/modules/oraclebackend/oraclebackend.hh index 2013fb53b6..c141a93ad4 100644 --- a/modules/oraclebackend/oraclebackend.hh +++ b/modules/oraclebackend/oraclebackend.hh @@ -64,51 +64,51 @@ public: virtual ~OracleBackend(); void lookup(const QType &qtype, const DNSName& qname, DNSPacket *p = 0, - int zoneId = -1); + int zoneId = -1) override; bool getBeforeAndAfterNames(uint32_t zoneId, const DNSName& zone, const DNSName& name, - DNSName& before, DNSName& after); + DNSName& before, DNSName& after) override; bool getBeforeAndAfterNamesAbsolute(uint32_t zoneId, const DNSName& name, DNSName& unhashed, DNSName& before, - DNSName& after); - bool get(DNSResourceRecord &rr); - vector getDomainMasters(const DNSName& domain, int zoneId); - bool isMaster(const DNSName& domain, const string &master); - bool getDomainInfo(const DNSName& domain, DomainInfo &di); - void alsoNotifies(const DNSName& domain, set *addrs); - void getUnfreshSlaveInfos(vector* domains); - void getUpdatedMasters(vector* domains); - void setFresh(uint32_t zoneId); - void setNotified(uint32_t zoneId, uint32_t serial); - bool list(const DNSName& domain, int zoneId, bool include_disabled=false); - bool startTransaction(const DNSName& domain, int zoneId); - bool feedRecord(const DNSResourceRecord &rr, const DNSName ordername); - bool commitTransaction(); - bool abortTransaction(); + DNSName& after) override; + bool get(DNSResourceRecord &rr) override; + vector getDomainMasters(const DNSName& domain, int zoneId) override; + bool isMaster(const DNSName& domain, const string &master) override; + bool getDomainInfo(const DNSName& domain, DomainInfo &di) override; + void alsoNotifies(const DNSName& domain, set *addrs) override; + void getUnfreshSlaveInfos(vector* domains) override; + void getUpdatedMasters(vector* domains) override; + void setFresh(uint32_t zoneId) override; + void setNotified(uint32_t zoneId, uint32_t serial) override; + bool list(const DNSName& domain, int zoneId, bool include_disabled=false) override; + bool startTransaction(const DNSName& domain, int zoneId) override; + bool feedRecord(const DNSResourceRecord &rr, const DNSName ordername) override; + bool commitTransaction() override; + bool abortTransaction() override; bool superMasterBackend(const string &ip, const DNSName& domain, const vector &nsset, string *account, string *nameserver, - DNSBackend **backend); + DNSBackend **backend) override; bool createSlaveDomain(const string &ip, const DNSName& domain, - const string &nameserver, const string &account); - - bool getAllDomainMetadata(const DNSName& name, std::map >& meta); - bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); - bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta); - - bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content); - bool delTSIGKey(const DNSName& name); - bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content); - bool getTSIGKeys(std::vector< struct TSIGKey > &keys); - - bool getDomainKeys(const DNSName& name, vector& keys); - bool removeDomainKey(const DNSName& name, unsigned int id); - bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id); - bool activateDomainKey(const DNSName& name, unsigned int id); - bool deactivateDomainKey(const DNSName& name, unsigned int id); + const string &nameserver, const string &account) override; + + bool getAllDomainMetadata(const DNSName& name, std::map >& meta) override; + bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; + bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) override; + + bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) override; + bool delTSIGKey(const DNSName& name) override; + bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override; + bool getTSIGKeys(std::vector< struct TSIGKey > &keys) override; + + bool getDomainKeys(const DNSName& name, vector& keys) override; + bool removeDomainKey(const DNSName& name, unsigned int id) override; + bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override; + bool activateDomainKey(const DNSName& name, unsigned int id) override; + bool deactivateDomainKey(const DNSName& name, unsigned int id) override; private: diff --git a/modules/pipebackend/pipebackend.hh b/modules/pipebackend/pipebackend.hh index 92ed12fe65..abdfb85829 100644 --- a/modules/pipebackend/pipebackend.hh +++ b/modules/pipebackend/pipebackend.hh @@ -53,10 +53,10 @@ class PipeBackend : public DNSBackend public: PipeBackend(const string &suffix=""); ~PipeBackend(); - void lookup(const QType&, const DNSName& qdomain, DNSPacket *p=0, int zoneId=-1); - bool list(const DNSName& target, int domain_id, bool include_disabled=false); - bool get(DNSResourceRecord &r); - string directBackendCmd(const string &query); + void lookup(const QType&, const DNSName& qdomain, DNSPacket *p=0, int zoneId=-1) override; + bool list(const DNSName& target, int domain_id, bool include_disabled=false) override; + bool get(DNSResourceRecord &r) override; + string directBackendCmd(const string &query) override; static DNSBackend *maker(); private: diff --git a/modules/randombackend/randombackend.cc b/modules/randombackend/randombackend.cc index 7e433048f0..286e606b1a 100644 --- a/modules/randombackend/randombackend.cc +++ b/modules/randombackend/randombackend.cc @@ -44,11 +44,11 @@ public: d_ourdomain.chopOff(); } - bool list(const DNSName &target, int id, bool include_disabled) { + bool list(const DNSName &target, int id, bool include_disabled) override { return false; // we don't support AXFR } - void lookup(const QType &type, const DNSName &qdomain, DNSPacket *p, int zoneId) + void lookup(const QType &type, const DNSName &qdomain, DNSPacket *p, int zoneId) override { if(qdomain == d_ourdomain){ if(type.getCode() == QType::SOA || type.getCode() == QType::ANY) { @@ -69,7 +69,7 @@ public: } } - bool get(DNSResourceRecord &rr) + bool get(DNSResourceRecord &rr) override { if(d_answer.empty()) return false; diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index fe26ad3f7b..ef2fbb2c68 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -716,7 +716,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const return true; } -bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, const DNSName ordername) { +bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) { Json query = Json::object{ { "method", "feedRecord" }, { "parameters", Json::object{ diff --git a/modules/remotebackend/remotebackend.hh b/modules/remotebackend/remotebackend.hh index ba2a9407a6..b44af82c98 100644 --- a/modules/remotebackend/remotebackend.hh +++ b/modules/remotebackend/remotebackend.hh @@ -153,41 +153,41 @@ class RemoteBackend : public DNSBackend RemoteBackend(const std::string &suffix=""); ~RemoteBackend(); - void lookup(const QType &qtype, const DNSName& qdomain, DNSPacket *pkt_p=0, int zoneId=-1); - bool get(DNSResourceRecord &rr); - bool list(const DNSName& target, int domain_id, bool include_disabled=false); - - virtual bool getAllDomainMetadata(const DNSName& name, std::map >& meta); - virtual bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); - virtual bool getDomainKeys(const DNSName& name, std::vector& keys); - virtual bool getTSIGKey(const DNSName& name, DNSName* algorithm, std::string* content); - virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after); - virtual bool setDomainMetadata(const DNSName& name, const string& kind, const std::vector >& meta); - virtual bool removeDomainKey(const DNSName& name, unsigned int id); - virtual bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id); - virtual bool activateDomainKey(const DNSName& name, unsigned int id); - virtual bool deactivateDomainKey(const DNSName& name, unsigned int id); - virtual bool getDomainInfo(const DNSName& domain, DomainInfo& di); - virtual void setNotified(uint32_t id, uint32_t serial); - virtual bool doesDNSSEC(); - virtual bool isMaster(const DNSName& name, const string &ip); - virtual bool superMasterBackend(const string &ip, const DNSName& domain, const vector&nsset, string *nameserver, string *account, DNSBackend **ddb); - virtual bool createSlaveDomain(const string &ip, const DNSName& domain, const string& nameserver, const string &account); - virtual bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset); - virtual bool feedRecord(const DNSResourceRecord &r, const DNSName ordername); - virtual bool feedEnts(int domain_id, map& nonterm); - virtual bool feedEnts3(int domain_id, const DNSName& domain, map& nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow); - virtual bool startTransaction(const DNSName& domain, int domain_id); - virtual bool commitTransaction(); - virtual bool abortTransaction(); - virtual bool calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial); - virtual bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content); - virtual bool deleteTSIGKey(const DNSName& name); - virtual bool getTSIGKeys(std::vector< struct TSIGKey > &keys); - virtual string directBackendCmd(const string& querystr); - virtual bool searchRecords(const string &pattern, int maxResults, vector& result); - virtual bool searchComments(const string &pattern, int maxResults, vector& result); - virtual void getAllDomains(vector *domains, bool include_disabled=false); + void lookup(const QType &qtype, const DNSName& qdomain, DNSPacket *pkt_p=0, int zoneId=-1) override; + bool get(DNSResourceRecord &rr) override; + bool list(const DNSName& target, int domain_id, bool include_disabled=false) override; + + bool getAllDomainMetadata(const DNSName& name, std::map >& meta) override; + bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; + bool getDomainKeys(const DNSName& name, std::vector& keys) override; + bool getTSIGKey(const DNSName& name, DNSName* algorithm, std::string* content) override; + bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override; + bool setDomainMetadata(const DNSName& name, const string& kind, const std::vector >& meta) override; + bool removeDomainKey(const DNSName& name, unsigned int id) override; + bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override; + bool activateDomainKey(const DNSName& name, unsigned int id) override; + bool deactivateDomainKey(const DNSName& name, unsigned int id) override; + bool getDomainInfo(const DNSName& domain, DomainInfo& di) override; + void setNotified(uint32_t id, uint32_t serial) override; + bool doesDNSSEC() override; + bool isMaster(const DNSName& name, const string &ip) override; + bool superMasterBackend(const string &ip, const DNSName& domain, const vector&nsset, string *nameserver, string *account, DNSBackend **ddb) override; + bool createSlaveDomain(const string &ip, const DNSName& domain, const string& nameserver, const string &account) override; + bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset) override; + bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername) override; + bool feedEnts(int domain_id, map& nonterm) override; + bool feedEnts3(int domain_id, const DNSName& domain, map& nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override; + bool startTransaction(const DNSName& domain, int domain_id) override; + bool commitTransaction() override; + bool abortTransaction() override; + bool calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial) override; + bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override; + bool deleteTSIGKey(const DNSName& name) override; + bool getTSIGKeys(std::vector< struct TSIGKey > &keys) override; + string directBackendCmd(const string& querystr) override; + bool searchRecords(const string &pattern, int maxResults, vector& result) override; + bool searchComments(const string &pattern, int maxResults, vector& result) override; + void getAllDomains(vector *domains, bool include_disabled=false) override; static DNSBackend *maker(); diff --git a/modules/tinydnsbackend/tinydnsbackend.hh b/modules/tinydnsbackend/tinydnsbackend.hh index 56f7add24d..bdb4888dac 100644 --- a/modules/tinydnsbackend/tinydnsbackend.hh +++ b/modules/tinydnsbackend/tinydnsbackend.hh @@ -68,14 +68,14 @@ class TinyDNSBackend : public DNSBackend public: // Methods for simple operation TinyDNSBackend(const string &suffix); - void lookup(const QType &qtype, const DNSName &qdomain, DNSPacket *pkt_p=0, int zoneId=-1); - bool list(const DNSName &target, int domain_id, bool include_disabled=false); - bool get(DNSResourceRecord &rr); - void getAllDomains(vector *domains, bool include_disabled=false); + void lookup(const QType &qtype, const DNSName &qdomain, DNSPacket *pkt_p=0, int zoneId=-1) override; + bool list(const DNSName &target, int domain_id, bool include_disabled=false) override; + bool get(DNSResourceRecord &rr) override; + void getAllDomains(vector *domains, bool include_disabled=false) override; //Master mode operation - void getUpdatedMasters(vector* domains); - void setNotified(uint32_t id, uint32_t serial); + void getUpdatedMasters(vector* domains) override; + void setNotified(uint32_t id, uint32_t serial) override; private: vector getLocations(); diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 5335bdc381..559c8043c3 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -179,70 +179,68 @@ public: release(&d_SearchCommentsQuery_stmt); } - void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1); - bool list(const DNSName &target, int domain_id, bool include_disabled=false); - bool get(DNSResourceRecord &r); - void getAllDomains(vector *domains, bool include_disabled=false); - bool isMaster(const DNSName &domain, const string &ip); - void alsoNotifies(const DNSName &domain, set *ips); - bool startTransaction(const DNSName &domain, int domain_id=-1); - bool commitTransaction(); - bool abortTransaction(); - bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername); - bool feedEnts(int domain_id, map& nonterm); - bool feedEnts3(int domain_id, const DNSName &domain, map &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow); - bool createDomain(const DNSName &domain, const string &type, const string &masters, const string &account); - bool createDomain(const DNSName &domain) { + void lookup(const QType &, const DNSName &qdomain, DNSPacket *p=0, int zoneId=-1) override; + bool list(const DNSName &target, int domain_id, bool include_disabled=false) override; + bool get(DNSResourceRecord &r) override; + void getAllDomains(vector *domains, bool include_disabled=false) override; + bool isMaster(const DNSName &domain, const string &ip) override; + void alsoNotifies(const DNSName &domain, set *ips) override; + bool startTransaction(const DNSName &domain, int domain_id=-1) override; + bool commitTransaction() override; + bool abortTransaction() override; + bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername) override; + bool feedEnts(int domain_id, map& nonterm) override; + bool feedEnts3(int domain_id, const DNSName &domain, map &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override; + bool createDomain(const DNSName &domain) override { return createDomain(domain, "NATIVE", "", ""); }; - bool createSlaveDomain(const string &ip, const DNSName &domain, const string &nameserver, const string &account); - bool deleteDomain(const DNSName &domain); - bool superMasterBackend(const string &ip, const DNSName &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **db); - void setFresh(uint32_t domain_id); - void getUnfreshSlaveInfos(vector *domains); - void getUpdatedMasters(vector *updatedDomains); - bool getDomainInfo(const DNSName &domain, DomainInfo &di); - void setNotified(uint32_t domain_id, uint32_t serial); - bool setMaster(const DNSName &domain, const string &ip); - bool setKind(const DNSName &domain, const DomainInfo::DomainKind kind); - bool setAccount(const DNSName &domain, const string &account); + bool createSlaveDomain(const string &ip, const DNSName &domain, const string &nameserver, const string &account) override; + bool deleteDomain(const DNSName &domain) override; + bool superMasterBackend(const string &ip, const DNSName &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **db) override; + void setFresh(uint32_t domain_id) override; + void getUnfreshSlaveInfos(vector *domains) override; + void getUpdatedMasters(vector *updatedDomains) override; + bool getDomainInfo(const DNSName &domain, DomainInfo &di) override; + void setNotified(uint32_t domain_id, uint32_t serial) override; + bool setMaster(const DNSName &domain, const string &ip) override; + bool setKind(const DNSName &domain, const DomainInfo::DomainKind kind) override; + bool setAccount(const DNSName &domain, const string &account) override; - virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after); - virtual bool updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName& qname, const DNSName& ordername, bool auth, const uint16_t=QType::ANY); + bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override; + bool updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName& qname, const DNSName& ordername, bool auth, const uint16_t=QType::ANY) override; - virtual bool updateEmptyNonTerminals(uint32_t domain_id, set& insert ,set& erase, bool remove); - virtual bool doesDNSSEC(); + bool updateEmptyNonTerminals(uint32_t domain_id, set& insert ,set& erase, bool remove) override; + bool doesDNSSEC() override; - virtual bool calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial); + bool calculateSOASerial(const DNSName& domain, const SOAData& sd, time_t& serial) override; - bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset); - bool listSubZone(const DNSName &zone, int domain_id); - bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id); - bool getDomainKeys(const DNSName& name, std::vector& keys); - bool getAllDomainMetadata(const DNSName& name, std::map >& meta); - bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta); - bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta); - bool clearDomainAllMetadata(const DNSName& domain); + bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset) override; + bool listSubZone(const DNSName &zone, int domain_id) override; + bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override; + bool getDomainKeys(const DNSName& name, std::vector& keys) override; + bool getAllDomainMetadata(const DNSName& name, std::map >& meta) override; + bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; + bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) override; - bool removeDomainKey(const DNSName& name, unsigned int id); - bool activateDomainKey(const DNSName& name, unsigned int id); - bool deactivateDomainKey(const DNSName& name, unsigned int id); + bool removeDomainKey(const DNSName& name, unsigned int id) override; + bool activateDomainKey(const DNSName& name, unsigned int id) override; + bool deactivateDomainKey(const DNSName& name, unsigned int id) override; - bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content); - bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content); - bool deleteTSIGKey(const DNSName& name); - bool getTSIGKeys(std::vector< struct TSIGKey > &keys); + bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) override; + bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) override; + bool deleteTSIGKey(const DNSName& name) override; + bool getTSIGKeys(std::vector< struct TSIGKey > &keys) override; - bool listComments(const uint32_t domain_id); - bool getComment(Comment& comment); - void feedComment(const Comment& comment); - bool replaceComments(const uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& comments); - bool replaceComments(const uint32_t domain_id, const string& qname, const QType& qt, const vector& comments); - string directBackendCmd(const string &query); - bool searchRecords(const string &pattern, int maxResults, vector& result); - bool searchComments(const string &pattern, int maxResults, vector& result); + bool listComments(const uint32_t domain_id) override; + bool getComment(Comment& comment) override; + void feedComment(const Comment& comment) override; + bool replaceComments(const uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& comments) override; + string directBackendCmd(const string &query) override; + bool searchRecords(const string &pattern, int maxResults, vector& result) override; + bool searchComments(const string &pattern, int maxResults, vector& result) override; protected: + bool createDomain(const DNSName &domain, const string &type, const string &masters, const string &account); string pattern2SQLPattern(const string& pattern); void extractRecord(const SSqlStatement::row_t& row, DNSResourceRecord& rr); void extractComment(const SSqlStatement::row_t& row, Comment& c);