]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: implement getAllDomains() in geoip backend
authorKees Monshouwer <mind04@monshouwer.org>
Wed, 26 May 2021 21:32:12 +0000 (23:32 +0200)
committermind04 <mind04@monshouwer.org>
Mon, 31 May 2021 11:05:25 +0000 (13:05 +0200)
modules/geoipbackend/geoipbackend.cc
modules/geoipbackend/geoipbackend.hh
pdns/receiver.cc

index 980c0643d5b4d36f60c406b6af12740eb3ba2ebb..3d563eab218bdb34e6a9ea8d23a80a2a6ae4a422 100644 (file)
@@ -850,6 +850,23 @@ bool GeoIPBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool get
   return false;
 }
 
+void GeoIPBackend::getAllDomains(vector<DomainInfo>* domains, bool include_disabled)
+{
+  ReadLock rl(&s_state_lock);
+
+  DomainInfo di;
+  for (const auto& dom : s_domains) {
+    SOAData sd;
+    this->getSOA(dom.domain, sd);
+    di.id = dom.id;
+    di.zone = dom.domain;
+    di.serial = sd.serial;
+    di.kind = DomainInfo::Native;
+    di.backend = this;
+    domains->emplace_back(di);
+  }
+}
+
 bool GeoIPBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string>>& meta)
 {
   if (!d_dnssec)
index c8f786202ce787bde7a4d6e9b0300a20ff2d2571..cb463cc08010165de1a4defd3f00da508802fdcd 100644 (file)
@@ -55,6 +55,7 @@ public:
   void reload() override;
   void rediscover(string* status = 0) override;
   bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override;
+  void getAllDomains(vector<DomainInfo>* domains, bool include_disabled = false) override;
 
   // dnssec support
   bool doesDNSSEC() override { return d_dnssec; };
index 9e04452fe1f1f5842bb6209e9379d51cc7cd2008..4d9c5a3f2f10959099148a78a3c593b073bcc15c 100644 (file)
@@ -628,13 +628,14 @@ int main(int argc, char **argv)
       }
     }
 
+    UeberBackend::go();
+
     g_zoneCache.setRefreshInterval(::arg().asNum("zone-cache-refresh-interval"));
     {
       UeberBackend B;
       B.updateZoneCache();
     }
 
-    UeberBackend::go();
     N=std::make_shared<UDPNameserver>(); // this fails when we are not root, throws exception
     g_udpReceivers.push_back(N);