From: Kees Monshouwer Date: Tue, 25 Nov 2014 15:09:26 +0000 (+0100) Subject: api: use uncached results for getKeys() X-Git-Tag: auth-3.4.2~15^2~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f35ba264a06cd4e5b4124a6e71511c5b1fa1dd6;p=pdns api: use uncached results for getKeys() --- diff --git a/pdns/dbdnsseckeeper.cc b/pdns/dbdnsseckeeper.cc index da7b37f56..c1d3ba4f7 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 1707aef0b..748ab8e4b 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 69d27a6c7..f9eda83fe 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -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+"'");