Add a subclass of IOHookProvider for SSL modules.

This commit is contained in:
Sadie Powell 2021-03-09 01:00:16 +00:00
parent a670bd81f6
commit 6c2b6fa23d
4 changed files with 16 additions and 6 deletions

View File

@ -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 class SSLIOHook : public IOHook
{ {
protected: protected:

View File

@ -1243,13 +1243,13 @@ int GnuTLS::X509Credentials::cert_callback(gnutls_session_t sess, const gnutls_d
return 0; return 0;
} }
class GnuTLSIOHookProvider : public IOHookProvider class GnuTLSIOHookProvider : public SSLIOHookProvider
{ {
GnuTLS::Profile profile; GnuTLS::Profile profile;
public: public:
GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config) GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config)
: IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) : SSLIOHookProvider(mod, config.name)
, profile(config) , profile(config)
{ {
ServerInstance->Modules->AddService(*this); ServerInstance->Modules->AddService(*this);

View File

@ -817,13 +817,13 @@ class mbedTLSIOHook : public SSLIOHook
bool IsHandshakeDone() const { return (status == ISSL_HANDSHAKEN); } bool IsHandshakeDone() const { return (status == ISSL_HANDSHAKEN); }
}; };
class mbedTLSIOHookProvider : public IOHookProvider class mbedTLSIOHookProvider : public SSLIOHookProvider
{ {
mbedTLS::Profile profile; mbedTLS::Profile profile;
public: public:
mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config) mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config)
: IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) : SSLIOHookProvider(mod, config.name)
, profile(config) , profile(config)
{ {
ServerInstance->Modules->AddService(*this); ServerInstance->Modules->AddService(*this);

View File

@ -936,13 +936,13 @@ static int OpenSSL::BIOMethod::read(BIO* bio, char* buffer, int size)
return ret; return ret;
} }
class OpenSSLIOHookProvider : public IOHookProvider class OpenSSLIOHookProvider : public SSLIOHookProvider
{ {
OpenSSL::Profile profile; OpenSSL::Profile profile;
public: public:
OpenSSLIOHookProvider(Module* mod, const std::string& profilename, ConfigTag* tag) OpenSSLIOHookProvider(Module* mod, const std::string& profilename, ConfigTag* tag)
: IOHookProvider(mod, "ssl/" + profilename, IOHookProvider::IOH_SSL) : SSLIOHookProvider(mod, profilename)
, profile(profilename, tag) , profile(profilename, tag)
{ {
ServerInstance->Modules->AddService(*this); ServerInstance->Modules->AddService(*this);