]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Properly initialize a new BindBackend domain (kind, ctime)
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 10:26:04 +0000 (12:26 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 10:26:04 +0000 (12:26 +0200)
Reported by Coverity (CID 1401635).

modules/bindbackend/bindbackend2.cc
modules/bindbackend/bindbackend2.hh

index 69d0450fc9999bbb8e2ecdc36a77ce9f85e97482..f513addfbcaa574ef3ebe53dce72bd086f662b9c 100644 (file)
@@ -603,6 +603,7 @@ string Bind2Backend::DLAddDomainHandler(const vector<string>&parts, Utility::pid
   bbd.d_loaded=true;
   bbd.d_lastcheck=0;
   bbd.d_status="parsing into memory";
+  bbd.setCtime();
 
   safePutBBDomainInfo(bbd);
 
@@ -1262,11 +1263,13 @@ BB2DomainInfo Bind2Backend::createDomainEntry(const DNSName& domain, const strin
   }
   
   BB2DomainInfo bbd;
+  bbd.d_kind = DomainInfo::Native;
   bbd.d_id = newid;
   bbd.d_records = shared_ptr<recordstorage_t >(new recordstorage_t);
   bbd.d_name = domain;
   bbd.setCheckInterval(getArgAsNum("check-interval"));
   bbd.d_filename = filename;
+  
   return bbd;
 }
 
@@ -1300,6 +1303,7 @@ bool Bind2Backend::createSlaveDomain(const string &ip, const DNSName& domain, co
   BB2DomainInfo bbd = createDomainEntry(domain, filename);
   bbd.d_kind = DomainInfo::Slave;
   bbd.d_masters.push_back(ComboAddress(ip, 53));
+  bbd.setCtime();
   safePutBBDomainInfo(bbd);
   return true;
 }
index 424c5683b0865b39599b4624b5b474c31d6c3e2c..ee545d636555e69d42c4fdb5340e5cd6232a590c 100644 (file)
@@ -165,9 +165,9 @@ public:
   vector<ComboAddress> d_masters;     //!< IP address of the master of this domain
   set<string> d_also_notify; //!< IP list of hosts to also notify
   LookButDontTouch<recordstorage_t> d_records;  //!< the actual records belonging to this domain
-  time_t d_ctime;  //!< last known ctime of the file on disk
-  time_t d_lastcheck; //!< last time domain was checked for freshness
-  uint32_t d_lastnotified; //!< Last serial number we notified our slaves of
+  time_t d_ctime{0};  //!< last known ctime of the file on disk
+  time_t d_lastcheck{0}; //!< last time domain was checked for freshness
+  uint32_t d_lastnotified{0}; //!< Last serial number we notified our slaves of
   unsigned int d_id;  //!< internal id of the domain
   mutable bool d_checknow; //!< if this domain has been flagged for a check
   bool d_loaded;  //!< if a domain is loaded