]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Make DNSSECKeeper::clear{All,}Caches() static 8659/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 24 Dec 2019 15:27:23 +0000 (16:27 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 24 Dec 2019 15:27:23 +0000 (16:27 +0100)
pdns/dnsseckeeper.hh
pdns/dynhandler.cc
pdns/tcpreceiver.cc
pdns/ws-auth.cc

index f280f4de985e98bb99fc7fcc4c6953a8acb1181c..c23db851de87b7b9c6a7b2213a8f8c79bb4c0b3d 100644 (file)
@@ -181,9 +181,13 @@ public:
     if(d_ourDB)
       delete d_keymetadb;
   }
+
+  static uint64_t dbdnssecCacheSizes(const std::string& str);
+  static void clearAllCaches();
+  static void clearCaches(const DNSName& name);
+
   bool doesDNSSEC();
   bool isSecuredZone(const DNSName& zone);
-  static uint64_t dbdnssecCacheSizes(const std::string& str);
   keyset_t getEntryPoints(const DNSName& zname);
   keyset_t getKeys(const DNSName& zone, bool useCache = true);
   DNSSECPrivateKey getKeyById(const DNSName& zone, unsigned int id);
@@ -198,8 +202,6 @@ public:
   bool checkNSEC3PARAM(const NSEC3PARAMRecordContent& ns3p, string& msg);
   bool setNSEC3PARAM(const DNSName& zname, const NSEC3PARAMRecordContent& n3p, const bool& narrow=false);
   bool unsetNSEC3PARAM(const DNSName& zname);
-  void clearAllCaches();
-  void clearCaches(const DNSName& name);
   bool getPreRRSIGs(UeberBackend& db, const DNSName& signer, const DNSName& qname, const DNSName& wildcardname, const QType& qtype, DNSResourceRecord::Place, vector<DNSZoneRecord>& rrsigs, uint32_t signTTL);
   bool isPresigned(const DNSName& zname);
   bool setPresigned(const DNSName& zname);
index 7541fdb656a53089a9b2281f8576e3eb6e625657..9e8f36c24017c350a0e575b6a6510f8f359db9bb 100644 (file)
@@ -122,7 +122,6 @@ string DLUptimeHandler(const vector<string>&parts, Utility::pid_t ppid)
 
 string DLPurgeHandler(const vector<string>&parts, Utility::pid_t ppid)
 {
-  DNSSECKeeper dk;
   ostringstream os;
   int ret=0;
 
@@ -130,14 +129,14 @@ string DLPurgeHandler(const vector<string>&parts, Utility::pid_t ppid)
     for (vector<string>::const_iterator i=++parts.begin();i<parts.end();++i) {
       ret+=purgeAuthCaches(*i);
       if(!boost::ends_with(*i, "$"))
-       dk.clearCaches(DNSName(*i));
+        DNSSECKeeper::clearCaches(DNSName(*i));
       else
-       dk.clearAllCaches(); // at least we do what we promise.. and a bit more!
+        DNSSECKeeper::clearAllCaches(); // at least we do what we promise.. and a bit more!
     }
   }
   else {
     ret = purgeAuthCaches();
-    dk.clearAllCaches();
+    DNSSECKeeper::clearAllCaches();
   }
 
   os<<ret;
index b49b362d3c89e1c5575a1315d3e974f4c098d56d..184407789a146ae226ecb05c6e9288299d4743de 100644 (file)
@@ -593,7 +593,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr<DNSPacket>& q,
   }
 
   DNSSECKeeper dk(&db);
-  dk.clearCaches(target);
+  DNSSECKeeper::clearCaches(target);
   bool securedZone = dk.isSecuredZone(target);
   bool presignedZone = dk.isPresigned(target);
 
@@ -1110,7 +1110,7 @@ int TCPNameserver::doIXFR(std::unique_ptr<DNSPacket>& q, int outsock)
   NSEC3PARAMRecordContent ns3pr;
   bool narrow;
 
-  dk.clearCaches(q->qdomain);
+  DNSSECKeeper::clearCaches(q->qdomain);
   bool securedZone = dk.isSecuredZone(q->qdomain);
   if(dk.getNSEC3PARAM(q->qdomain, &ns3pr, &narrow)) {
     if(narrow) {
index 85d64d7752f44383bf036c182c1f0b774927fac4..7beb49c6d5c5471a5e9bf51e11c4bbacfe44571e 100644 (file)
@@ -1747,8 +1747,7 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) {
       throw ApiException("Deleting domain '"+zonename.toString()+"' failed: backend delete failed/unsupported");
 
     // clear caches
-    DNSSECKeeper dk(&B);
-    dk.clearCaches(zonename);
+    DNSSECKeeper::clearCaches(zonename);
     purgeAuthCaches(zonename.toString() + "$");
 
     // empty body on success