From d8455c788a75dcef9e3d7d30b92891bdb5dadf44 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Tue, 25 Nov 2014 16:09:26 +0100 Subject: [PATCH] api: use uncached results for getKeys() --- pdns/dbdnsseckeeper.cc | 4 ++-- pdns/dnsseckeeper.hh | 2 +- pdns/ws-auth.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pdns/dbdnsseckeeper.cc b/pdns/dbdnsseckeeper.cc index da7b37f56d..c1d3ba4f7b 100644 --- a/pdns/dbdnsseckeeper.cc +++ b/pdns/dbdnsseckeeper.cc @@ -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); diff --git a/pdns/dnsseckeeper.hh b/pdns/dnsseckeeper.hh index 1707aef0b8..748ab8e4b9 100644 --- a/pdns/dnsseckeeper.hh +++ b/pdns/dnsseckeeper.hh @@ -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); diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 839dc2d024..6ec8fd9e52 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -486,7 +486,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+"'"); -- 2.47.2