diff options
author | Sadie Powell <sadie@witchery.services> | 2021-03-09 01:00:16 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-03-09 01:00:16 +0000 |
commit | 6c2b6fa23d3a65ecdcebbf9154b8daa2e55727e9 (patch) | |
tree | 5468dd9987050ed627fea9b7749dcf3c8027fb87 | |
parent | a670bd81f6b22e2cecf9a21cf8592bc0a1e7fb95 (diff) |
Add a subclass of IOHookProvider for SSL modules.
-rw-r--r-- | include/modules/ssl.h | 10 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_mbedtls.cpp | 4 | ||||
-rw-r--r-- | 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); |