From: Remi Gacogne Date: Fri, 13 Sep 2024 14:38:16 +0000 (+0200) Subject: dnsdist: Fix clang-tidy warnings X-Git-Tag: dnsdist-1.9.7~3^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc77d04e07121ebaab4fbd83335b0ecd4104c7bb;p=thirdparty%2Fpdns.git dnsdist: Fix clang-tidy warnings (cherry picked from commit afcd4ccefb73efbf025b2f910a6506e18b4cf116) --- diff --git a/pdns/tcpiohandler.cc b/pdns/tcpiohandler.cc index 6fac935811..b31a6cd8a3 100644 --- a/pdns/tcpiohandler.cc +++ b/pdns/tcpiohandler.cc @@ -554,7 +554,7 @@ public: d_ktls = true; } - bool isClient() const + [[nodiscard]] bool isClient() const { return d_isClient; } @@ -604,9 +604,9 @@ class OpenSSLTLSIOCtx: public TLSCtx, public std::enable_shared_from_this createServerSideContext(TLSFrontend& fe) + static std::shared_ptr createServerSideContext(TLSFrontend& frontend) { - return std::make_shared(fe, Private()); + return std::make_shared(frontend, Private()); } static std::shared_ptr createClientSideContext(const TLSContextParameters& params) @@ -615,13 +615,13 @@ public: } /* server side context */ - OpenSSLTLSIOCtx(TLSFrontend& fe, [[maybe_unused]] Private priv): d_feContext(std::make_unique(fe.d_addr, fe.d_tlsConfig)) + OpenSSLTLSIOCtx(TLSFrontend& frontend, [[maybe_unused]] Private priv): d_feContext(std::make_unique(frontend.d_addr, frontend.d_tlsConfig)) { OpenSSLTLSConnection::generateConnectionIndexIfNeeded(); - d_ticketsKeyRotationDelay = fe.d_tlsConfig.d_ticketsKeyRotationDelay; + d_ticketsKeyRotationDelay = frontend.d_tlsConfig.d_ticketsKeyRotationDelay; - if (fe.d_tlsConfig.d_enableTickets && fe.d_tlsConfig.d_numberOfTicketsKeys > 0) { + if (frontend.d_tlsConfig.d_enableTickets && frontend.d_tlsConfig.d_numberOfTicketsKeys > 0) { /* use our own ticket keys handler so we can rotate them */ #if OPENSSL_VERSION_MAJOR >= 3 SSL_CTX_set_tlsext_ticket_key_evp_cb(d_feContext->d_tlsCtx.get(), &OpenSSLTLSIOCtx::ticketKeyCb); @@ -638,22 +638,22 @@ public: } #endif /* DISABLE_OCSP_STAPLING */ - if (fe.d_tlsConfig.d_readAhead) { + if (frontend.d_tlsConfig.d_readAhead) { SSL_CTX_set_read_ahead(d_feContext->d_tlsCtx.get(), 1); } - libssl_set_error_counters_callback(d_feContext->d_tlsCtx, &fe.d_tlsCounters); + libssl_set_error_counters_callback(d_feContext->d_tlsCtx, &frontend.d_tlsCounters); - if (!fe.d_tlsConfig.d_keyLogFile.empty()) { - d_feContext->d_keyLogFile = libssl_set_key_log_file(d_feContext->d_tlsCtx, fe.d_tlsConfig.d_keyLogFile); + if (!frontend.d_tlsConfig.d_keyLogFile.empty()) { + d_feContext->d_keyLogFile = libssl_set_key_log_file(d_feContext->d_tlsCtx, frontend.d_tlsConfig.d_keyLogFile); } try { - if (fe.d_tlsConfig.d_ticketKeyFile.empty()) { + if (frontend.d_tlsConfig.d_ticketKeyFile.empty()) { handleTicketsKeyRotation(time(nullptr)); } else { - OpenSSLTLSIOCtx::loadTicketsKeys(fe.d_tlsConfig.d_ticketKeyFile); + OpenSSLTLSIOCtx::loadTicketsKeys(frontend.d_tlsConfig.d_ticketKeyFile); } } catch (const std::exception& e) { @@ -662,7 +662,7 @@ public: } /* client side context */ - OpenSSLTLSIOCtx(const TLSContextParameters& params, [[maybe_unused]] Private) + OpenSSLTLSIOCtx(const TLSContextParameters& params, [[maybe_unused]] Private priv) { int sslOptions = SSL_OP_NO_SSLv2 | @@ -753,6 +753,11 @@ public: #endif } + OpenSSLTLSIOCtx(const OpenSSLTLSIOCtx&) = delete; + OpenSSLTLSIOCtx(OpenSSLTLSIOCtx&&) = delete; + OpenSSLTLSIOCtx& operator=(const OpenSSLTLSIOCtx&) = delete; + OpenSSLTLSIOCtx& operator=(OpenSSLTLSIOCtx&&) = delete; + ~OpenSSLTLSIOCtx() override { d_tlsCtx.reset();