summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_gnutls.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-24 19:34:25 +0200
committerattilamolnar <attilamolnar@hush.com>2013-06-07 01:00:10 +0200
commit3d6d9cda32d72ff25cf6e624bb271b629898e018 (patch)
tree78f47c8f6f74b273beb40e0a37578f5324e02785 /src/modules/extra/m_ssl_gnutls.cpp
parent79db1cf848c64ba50bebadef4c683ae4237080b7 (diff)
Create SSLIOHook interface that provides GetCertificate()
Diffstat (limited to 'src/modules/extra/m_ssl_gnutls.cpp')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index e051b34e7..3c82a5beb 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -100,7 +100,7 @@ public:
issl_session() : socket(NULL), sess(NULL) {}
};
-class GnuTLSIOHook : public IOHook
+class GnuTLSIOHook : public SSLIOHook
{
private:
void InitSession(StreamSocket* user, bool me_server)
@@ -359,7 +359,7 @@ info_done_dealloc:
int dh_bits;
GnuTLSIOHook(Module* parent)
- : IOHook(parent, "ssl/gnutls")
+ : SSLIOHook(parent, "ssl/gnutls")
{
sessions = new issl_session[ServerInstance->SE->GetMaxFds()];
}
@@ -501,6 +501,13 @@ info_done_dealloc:
return 0;
}
+ ssl_cert* GetCertificate(StreamSocket* sock) CXX11_OVERRIDE
+ {
+ int fd = sock->GetFd();
+ issl_session* session = &sessions[fd];
+ return session->cert;
+ }
+
void TellCiphersAndFingerprint(LocalUser* user)
{
const gnutls_session_t& sess = sessions[user->eh.GetFd()].sess;
@@ -895,18 +902,6 @@ class ModuleSSLGnuTLS : public Module
}
}
- void OnRequest(Request& request) CXX11_OVERRIDE
- {
- if (strcmp("GET_SSL_CERT", request.id) == 0)
- {
- SocketCertificateRequest& req = static_cast<SocketCertificateRequest&>(request);
- int fd = req.sock->GetFd();
- issl_session* session = &iohook.sessions[fd];
-
- req.cert = session->cert;
- }
- }
-
void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
{
if (user->eh.GetIOHook() == &iohook)