From: Remi Gacogne Date: Fri, 1 Mar 2024 16:00:41 +0000 (+0100) Subject: rec: Fix clang-tidy warnings X-Git-Tag: rec-5.0.3~3^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78af7b1f2c6eff70df3e632dbaed42f4ef0c25d5;p=thirdparty%2Fpdns.git rec: Fix clang-tidy warnings (cherry picked from commit f74ca9e44868f44c4fe6460bed1b7629dcf027f4) --- diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 22433d4f47..2ee8ee5706 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -4385,11 +4385,11 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, const string& } auto initial = qname; while (true) { - auto it = cnames.find(initial); - if (it == cnames.end()) { + auto cnameIt = cnames.find(initial); + if (cnameIt == cnames.end()) { break; } - initial = it->second; + initial = cnameIt->second; wildcardCandidates.emplace(initial, false); } } @@ -4701,7 +4701,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, const string& } bool thisRRNeedsWildcardProof = false; if (gatherWildcardProof) { - if (auto wcIt = wildcardCandidates.find(tCacheEntry->first.name); wcIt != wildcardCandidates.end() && wcIt->second == true) { + if (auto wcIt = wildcardCandidates.find(tCacheEntry->first.name); wcIt != wildcardCandidates.end() && wcIt->second) { thisRRNeedsWildcardProof = true; } } @@ -4751,7 +4751,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, const string& } if (gatherWildcardProof) { - if (auto it = wildcardCandidates.find(qname); it != wildcardCandidates.end() && it->second == false) { + if (auto wcIt = wildcardCandidates.find(qname); wcIt != wildcardCandidates.end() && !wcIt->second) { // the queried name was not expended from a wildcard, a record in the CNAME chain was, so we don't need to gather wildcard proof now: we will do that when looking up the CNAME chain gatherWildcardProof = false; } diff --git a/pdns/recursordist/test-syncres_cc3.cc b/pdns/recursordist/test-syncres_cc3.cc index bba6083559..65535a6982 100644 --- a/pdns/recursordist/test-syncres_cc3.cc +++ b/pdns/recursordist/test-syncres_cc3.cc @@ -1265,10 +1265,10 @@ BOOST_AUTO_TEST_CASE(test_forward_zone_recurse_rd_dnssec_nodata_bogus) BOOST_AUTO_TEST_CASE(test_forward_zone_recurse_rd_dnssec_cname_wildcard_expanded) { - std::unique_ptr sr; - initSR(sr, true); + std::unique_ptr testSR; + initSR(testSR, true); - setDNSSECValidation(sr, DNSSECMode::ValidateAll); + setDNSSECValidation(testSR, DNSSECMode::ValidateAll); primeHints(); /* unsigned */ @@ -1286,12 +1286,12 @@ BOOST_AUTO_TEST_CASE(test_forward_zone_recurse_rd_dnssec_cname_wildcard_expanded const ComboAddress forwardedNS("192.0.2.42:53"); size_t queriesCount = 0; - SyncRes::AuthDomain ad; - ad.d_rdForward = true; - ad.d_servers.push_back(forwardedNS); - (*SyncRes::t_sstorage.domainmap)[g_rootdnsname] = ad; + SyncRes::AuthDomain authDomain; + authDomain.d_rdForward = true; + authDomain.d_servers.push_back(forwardedNS); + (*SyncRes::t_sstorage.domainmap)[g_rootdnsname] = authDomain; - sr->setAsyncCallback([&](const ComboAddress& address, const DNSName& domain, int type, bool /* doTCP */, bool sendRDQuery, int /* EDNS0Level */, struct timeval* /* now */, boost::optional& /* srcmask */, boost::optional /* context */, LWResult* res, bool* /* chained */) { + testSR->setAsyncCallback([&](const ComboAddress& address, const DNSName& domain, int type, bool /* doTCP */, bool sendRDQuery, int /* EDNS0Level */, struct timeval* /* now */, boost::optional& /* srcmask */, boost::optional /* context */, LWResult* res, bool* /* chained */) { queriesCount++; BOOST_CHECK_EQUAL(sendRDQuery, true); @@ -1321,17 +1321,17 @@ BOOST_AUTO_TEST_CASE(test_forward_zone_recurse_rd_dnssec_cname_wildcard_expanded }); vector ret; - int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); + int res = testSR->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); - BOOST_CHECK_EQUAL(sr->getValidationState(), vState::Insecure); + BOOST_CHECK_EQUAL(testSR->getValidationState(), vState::Insecure); BOOST_REQUIRE_EQUAL(ret.size(), 5U); BOOST_CHECK_EQUAL(queriesCount, 5U); /* again, to test the cache */ ret.clear(); - res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); + res = testSR->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); - BOOST_CHECK_EQUAL(sr->getValidationState(), vState::Insecure); + BOOST_CHECK_EQUAL(testSR->getValidationState(), vState::Insecure); BOOST_REQUIRE_EQUAL(ret.size(), 5U); BOOST_CHECK_EQUAL(queriesCount, 5U); }