]> granicus.if.org Git - pdns/commitdiff
api: use uncached results for getKeys()
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 25 Nov 2014 15:09:26 +0000 (16:09 +0100)
committermind04 <mind04@monshouwer.org>
Mon, 22 Dec 2014 19:26:46 +0000 (20:26 +0100)
pdns/dbdnsseckeeper.cc
pdns/dnsseckeeper.hh
pdns/ws-auth.cc

index da7b37f56d810eb04e8fb087bfb408adb05cf7d4..c1d3ba4f7b903a72a8b556b2d8ee20af6de66e27 100644 (file)
@@ -294,7 +294,7 @@ bool DNSSECKeeper::unsetPresigned(const std::string& zname)
 }
 
 
-DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tribool allOrKeyOrZone
+DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tribool allOrKeyOrZone, bool useCache)
 {
   unsigned int now = time(0);
 
@@ -302,7 +302,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tri
     cleanup();
   }
 
-  {
+  if (useCache) {
     ReadLock l(&s_keycachelock);
     keycache_t::const_iterator iter = s_keycache.find(zone);
       
index 1707aef0b8e820e3bbfdceb2e63760ecd5d0f282..748ab8e4b9f47656f3200075320eb2e3e2c17fc7 100644 (file)
@@ -71,7 +71,7 @@ public:
   }
   bool isSecuredZone(const std::string& zone);
   
-  keyset_t getKeys(const std::string& zone, boost::tribool allOrKeyOrZone = boost::indeterminate);
+  keyset_t getKeys(const std::string& zone, boost::tribool allOrKeyOrZone = boost::indeterminate, bool useCache = true);
   DNSSECPrivateKey getKeyById(const std::string& zone, unsigned int id);
   bool addKey(const std::string& zname, bool keyOrZone, int algorithm=5, int bits=0, bool active=true);
   bool addKey(const std::string& zname, const DNSSECPrivateKey& dpk, bool active=true);
index 69d27a6c7a8baf567119c3eb5f6e99d4b4b69adf..f9eda83fea6ab2f3703d871dee9e244c6ecb4343 100644 (file)
@@ -492,7 +492,7 @@ static void apiZoneCryptokeys(HttpRequest* req, HttpResponse* resp) {
   if(!dk.isSecuredZone(zonename))
     throw ApiException("Zone '"+zonename+"' is not secured");
 
-  DNSSECKeeper::keyset_t keyset=dk.getKeys(zonename);
+  DNSSECKeeper::keyset_t keyset=dk.getKeys(zonename, boost::indeterminate, false);
 
   if (keyset.empty())
     throw ApiException("No keys for zone '"+zonename+"'");