From 68d20993290c18babbed8f7d8a4dc02e64cc32f3 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 12 Jun 2025 15:29:26 +0200 Subject: [PATCH] Throw some bones to clang-tidy. --- pdns/dnssecsigner.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 58b9721511..9b93a41357 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -37,7 +37,7 @@ extern StatBag S; using signaturecache_t = map, string>; static SharedLockGuarded g_signatures; -static int g_cacheweekno; +static time_t g_cacheweekno; const static std::set g_KSKSignedQTypes {QType::DNSKEY, QType::CDS, QType::CDNSKEY}; AtomicCounter* g_signatureCount; @@ -65,11 +65,12 @@ static std::string getLookupKeyFromPublicKey(const std::string& pubKey) static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGRecordContent& rrc, const sortedRecords_t& toSign) { - if(!g_signatureCount) + if (g_signatureCount == nullptr) { g_signatureCount = S.getPointer("signatures"); + } DNSKEYRecordContent drc = dpk.getDNSKEY(); - const std::shared_ptr& rc = dpk.getKey(); + const std::shared_ptr& engine = dpk.getKey(); rrc.d_tag = drc.getTag(); rrc.d_algorithm = drc.d_algorithm; @@ -79,19 +80,18 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR bool doCache = true; if (doCache) { auto signatures = g_signatures.read_lock(); - signaturecache_t::const_iterator iter = signatures->find(lookup); - if (iter != signatures->end()) { + if (const auto iter = signatures->find(lookup); iter != signatures->end()) { rrc.d_signature=iter->second; return; } // else cerr<<"Miss!"<sign(msg); + rrc.d_signature = engine->sign(msg); (*g_signatureCount)++; if(doCache) { /* we add some jitter here so not all your secondaries start pruning their caches at the very same millisecond */ - int weekno = (time(nullptr) - dns_random(3600)) / (86400*7); // we just spent milliseconds doing a signature, microsecond more won't kill us + time_t weekno = (time(nullptr) - dns_random(3600)) / static_cast(86400*7); // we just spent milliseconds doing a signature, microsecond more won't kill us const static int maxcachesize=::arg().asNum("max-signature-cache-entries", INT_MAX); signaturecache_t oldsigs; -- 2.47.2