}
}
-bool Bind2Backend::getDomainInfo(const DNSName& domain, DomainInfo &di)
+bool Bind2Backend::getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial)
{
BB2DomainInfo bbd;
if(!safeGetBBDomainInfo(domain, &bbd))
di.backend=this;
di.kind=bbd.d_kind;
di.serial=0;
- try {
- SOAData sd;
- sd.serial=0;
-
- getSOA(bbd.d_name,sd); // we might not *have* a SOA yet
- di.serial=sd.serial;
+ if(getSerial) {
+ try {
+ SOAData sd;
+ sd.serial=0;
+
+ getSOA(bbd.d_name,sd); // we might not *have* a SOA yet
+ di.serial=sd.serial;
+ }
+ catch(...){}
}
- catch(...){}
return true;
}
~Bind2Backend();
void getUnfreshSlaveInfos(vector<DomainInfo> *unfreshDomains) override;
void getUpdatedMasters(vector<DomainInfo> *changedDomains) override;
- bool getDomainInfo(const DNSName &domain, DomainInfo &di) override;
+ bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true ) override;
time_t getCtime(const string &fname);
// DNSSEC
bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override;
reload();
}
-bool GeoIPBackend::getDomainInfo(const DNSName& domain, DomainInfo &di) {
+bool GeoIPBackend::getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial) {
ReadLock rl(&s_state_lock);
for(GeoIPDomain dom : s_domains) {
bool get(DNSResourceRecord &r) override;
void reload() override;
void rediscover(string *status = 0) override;
- bool getDomainInfo(const DNSName& domain, DomainInfo &di) override;
+ bool getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial=true) override;
// dnssec support
bool doesDNSSEC() override { return d_dnssec; };
-bool LdapBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
+bool LdapBackend::getDomainInfo( const DNSName& domain, DomainInfo& di, bool getSerial )
{
string filter;
SOAData sd;
void lookup( const QType& qtype, const DNSName& qdomain, DNSPacket* p = 0, int zoneid = -1 ) override;
bool get( DNSResourceRecord& rr ) override;
- bool getDomainInfo( const DNSName& domain, DomainInfo& di ) override;
+ bool getDomainInfo( const DNSName& domain, DomainInfo& di, bool getSerial=true ) override;
// Master backend
void getUpdatedMasters( vector<DomainInfo>* domains ) override;
// SLAVE BACKEND
- bool getDomainInfo(const DNSName& domain, DomainInfo &di) override;
+ bool getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial=true) override;
bool isMaster(const DNSName& name, const string &ip) override;
void getUnfreshSlaveInfos(vector<DomainInfo>* domains) override;
void setFresh(uint32_t id) override;
return ok;
}
-bool LUABackend::getDomainInfo(const DNSName&domain, DomainInfo &di) {
+bool LUABackend::getDomainInfo(const DNSName&domain, DomainInfo &di, bool getSerial) {
if (f_lua_getdomaininfo == 0)
return false;
-bool OdbxBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
+bool OdbxBackend::getDomainInfo( const DNSName& domain, DomainInfo& di, bool getSerial )
{
const char* tmp;
di.backend = this;
di.serial = 0;
- if( ( tmp = odbx_field_value( m_result, 6 ) ) != NULL )
+ if( getSerial && ( tmp = odbx_field_value( m_result, 6 ) ) != NULL )
{
SOAData sd;
bool abortTransaction() override;
bool isMaster( const DNSName& domain, const string& ip ) override;
- bool getDomainInfo( const DNSName& domain, DomainInfo& di ) override;
+ bool getDomainInfo( const DNSName& domain, DomainInfo& di, bool getSerial=true ) override;
bool feedRecord( const DNSResourceRecord& rr, const DNSName& ordername ) override;
bool createSlaveDomain( const string& ip, const DNSName& domain, const string &nameserver, const string& account ) override;
bool superMasterBackend( const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string *nameserver, string* account, DNSBackend** ddb ) override;
di.backend = this;
}
-bool RemoteBackend::getDomainInfo(const DNSName& domain, DomainInfo &di) {
+bool RemoteBackend::getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial) {
if (domain.empty()) return false;
Json query = Json::object{
{ "method", "getDomainInfo" },
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;
+ bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial=true ) override;
void setNotified(uint32_t id, uint32_t serial) override;
bool doesDNSSEC() override;
bool isMaster(const DNSName& name, const string &ip) override;
return true;
}
-bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di)
+bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial)
{
/* fill DomainInfo from database info:
id,name,master IP(s),last_check,notified_serial,type,account */
di.backend=this;
di.serial = 0;
- try {
- SOAData sd;
- if(!getSOA(domain, sd))
- g_log<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl;
- else
- di.serial = sd.serial;
- }
- catch(PDNSException &ae){
- g_log<<Logger::Error<<"Error retrieving serial for '"<<domain<<"': "<<ae.reason<<endl;
+ if(getSerial) {
+ try {
+ SOAData sd;
+ if(!getSOA(domain, sd))
+ g_log<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl;
+ else
+ di.serial = sd.serial;
+ }
+ catch(PDNSException &ae){
+ g_log<<Logger::Error<<"Error retrieving serial for '"<<domain<<"': "<<ae.reason<<endl;
+ }
}
di.kind = DomainInfo::stringToKind(type);
void setFresh(uint32_t domain_id) override;
void getUnfreshSlaveInfos(vector<DomainInfo> *domains) override;
void getUpdatedMasters(vector<DomainInfo> *updatedDomains) override;
- bool getDomainInfo(const DNSName &domain, DomainInfo &di) override;
+ bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true) 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;
}
//! if this returns true, DomainInfo di contains information about the domain
- virtual bool getDomainInfo(const DNSName &domain, DomainInfo &di)
+ virtual bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true)
{
return false;
}
DNSBackend *db=0;
DomainInfo di;
- di.serial = 0;
- if(!B.getDomainInfo(p->qdomain, di) || !(db=di.backend)) {
+ if(!B.getDomainInfo(p->qdomain, di, false) || !(db=di.backend)) {
g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" for which we are not authoritative"<<endl;
return trySuperMaster(p, p->getTSIGKeyname());
}
return RCode::Refused;
}
- // ok, we've done our checks
- di.backend = 0;
-
if(!s_forwardNotify.empty()) {
set<string> forwardNotify(s_forwardNotify);
for(set<string>::const_iterator j=forwardNotify.begin();j!=forwardNotify.end();++j) {
pthread_mutex_unlock(&d_mut);
}
-bool UeberBackend::getDomainInfo(const DNSName &domain, DomainInfo &di)
+bool UeberBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial)
{
for(vector<DNSBackend *>::const_iterator i=backends.begin();i!=backends.end();++i)
- if((*i)->getDomainInfo(domain, di))
+ if((*i)->getDomainInfo(domain, di, getSerial))
return true;
return false;
}
void getUnfreshSlaveInfos(vector<DomainInfo>* domains);
void getUpdatedMasters(vector<DomainInfo>* domains);
- bool getDomainInfo(const DNSName &domain, DomainInfo &di);
+ bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true);
bool createDomain(const DNSName &domain);
bool doesDNSSEC();