From 3af9d9b0605a503ed16a8b8314587451979103d7 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 9 Dec 2006 22:06:15 +0000 Subject: Make it all work properly. Have it wait for handshake to complete before sending anything down the line git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5898 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 14 ++++++++++++++ src/modules/extra/m_ssl_openssl.cpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 0006c9de9..6ad14561d 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -273,6 +273,20 @@ class ModuleSSLGnuTLS : public Module { return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; } + else if (strcmp("IS_HSDONE", request->GetId()) == 0) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + return (session->status == ISSL_HANDSHAKING_READ || session->status == ISSL_HANDSHAKING_WRITE || session->status == ISSL_HANDSHAKEN) ? NULL : (char*)"OK"; + } + else if (strcmp("IS_ATTACH", request->GetId()) == 0) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + if (session) + { + VerifyCertificate(session, (InspSocket*)ISR->Sock); + return "OK"; + } + } return NULL; } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 06708ff54..2f393f718 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -311,6 +311,20 @@ class ModuleSSLOpenSSL : public Module ServerInstance->Log(DEBUG, "Unhooking socket %08x", ISR->Sock); return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; } + else if (strcmp("IS_HSDONE", request->GetId()) == 0) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + return (session->status == ISSL_HANDSHAKING) ? NULL : (char*)"OK"; + } + else if (strcmp("IS_ATTACH", request->GetId()) == 0) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + if (session) + { + VerifyCertificate(session, (InspSocket*)ISR->Sock); + return "OK"; + } + } return NULL; } -- cgit v1.2.3