From 6c2b6fa23d3a65ecdcebbf9154b8daa2e55727e9 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 9 Mar 2021 01:00:16 +0000 Subject: Add a subclass of IOHookProvider for SSL modules. --- include/modules/ssl.h | 10 ++++++++++ src/modules/extra/m_ssl_gnutls.cpp | 4 ++-- src/modules/extra/m_ssl_mbedtls.cpp | 4 ++-- src/modules/extra/m_ssl_openssl.cpp | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/modules/ssl.h b/include/modules/ssl.h index ac2e367fd..c9229cf9d 100644 --- a/include/modules/ssl.h +++ b/include/modules/ssl.h @@ -151,6 +151,16 @@ class ssl_cert : public refcountbase } }; +/** I/O hook provider for SSL modules. */ +class SSLIOHookProvider : public IOHookProvider +{ +public: + SSLIOHookProvider(Module* mod, const std::string& Name) + : IOHookProvider(mod, "ssl/" + Name, IOH_SSL) + { + } +}; + class SSLIOHook : public IOHook { protected: diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index b6eee5836..4e6b09564 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1243,13 +1243,13 @@ int GnuTLS::X509Credentials::cert_callback(gnutls_session_t sess, const gnutls_d return 0; } -class GnuTLSIOHookProvider : public IOHookProvider +class GnuTLSIOHookProvider : public SSLIOHookProvider { GnuTLS::Profile profile; public: GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config) - : IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, config.name) , profile(config) { ServerInstance->Modules->AddService(*this); diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 9c2a535ae..77c81b7fa 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -817,13 +817,13 @@ class mbedTLSIOHook : public SSLIOHook bool IsHandshakeDone() const { return (status == ISSL_HANDSHAKEN); } }; -class mbedTLSIOHookProvider : public IOHookProvider +class mbedTLSIOHookProvider : public SSLIOHookProvider { mbedTLS::Profile profile; public: mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config) - : IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, config.name) , profile(config) { ServerInstance->Modules->AddService(*this); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 55efd2dd6..fb965a5ab 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -936,13 +936,13 @@ static int OpenSSL::BIOMethod::read(BIO* bio, char* buffer, int size) return ret; } -class OpenSSLIOHookProvider : public IOHookProvider +class OpenSSLIOHookProvider : public SSLIOHookProvider { OpenSSL::Profile profile; public: OpenSSLIOHookProvider(Module* mod, const std::string& profilename, ConfigTag* tag) - : IOHookProvider(mod, "ssl/" + profilename, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, profilename) , profile(profilename, tag) { ServerInstance->Modules->AddService(*this); -- cgit v1.2.3