diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-10-27 14:40:02 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-10-27 14:40:02 +0100 |
commit | cba05046ce20eed4c429093296eb481bf95d7e07 (patch) | |
tree | c21c9ceb1a940f7026e5d7a08ee586d698743cac | |
parent | 8c2cdeaf33bf6fa2d51df0e6e2c0cbdfc3e1230b (diff) |
m_ssl_openssl Store a pointer to the OpenSSLIOHook object in SSL objects
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index dab59ffa6..b09539e50 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -45,6 +45,7 @@ enum issl_status { ISSL_NONE, ISSL_HANDSHAKING, ISSL_OPEN }; static bool SelfSigned = false; +static int exdataindex; char* get_error() { @@ -393,6 +394,7 @@ class OpenSSLIOHook : public SSLIOHook if (SSL_set_fd(sess, sock->GetFd()) == 0) throw ModuleException("Can't set fd with SSL_set_fd: " + ConvToStr(sock->GetFd())); + SSL_set_ex_data(sess, exdataindex, this); sock->AddIOHook(this); Handshake(sock); } @@ -643,6 +645,12 @@ class ModuleSSLOpenSSL : public Module void init() CXX11_OVERRIDE { + // Register application specific data + char exdatastr[] = "inspircd"; + exdataindex = SSL_get_ex_new_index(0, exdatastr, NULL, NULL, NULL); + if (exdataindex < 0) + throw ModuleException("Failed to register application specific data"); + ReadProfiles(); } |