From 6d2bf07374515c88734a19ffaac179b7357059ea Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 9 Dec 2006 21:15:56 +0000 Subject: It works! WOO AND YAY! (this isnt finished yet, only an idiot would use this on a production net atm) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5897 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 5 ++++- src/modules/extra/m_ssl_openssl.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 4f22a5e70..0006c9de9 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -445,7 +445,10 @@ class ModuleSSLGnuTLS : public Module } virtual int OnRawSocketWrite(int fd, const char* buffer, int count) - { + { + if (!count) + return 0; + issl_session* session = &sessions[fd]; const char* sendbuffer = buffer; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 0da67d677..06708ff54 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -296,16 +296,19 @@ class ModuleSSLOpenSSL : public Module virtual char* OnRequest(Request* request) { ISHRequest* ISR = (ISHRequest*)request; + ServerInstance->Log(DEBUG, "hook OnRequest"); if (strcmp("IS_NAME", request->GetId()) == 0) { return "openssl"; } else if (strcmp("IS_HOOK", request->GetId()) == 0) { + ServerInstance->Log(DEBUG, "Hooking socket %08x", ISR->Sock); return ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; } else if (strcmp("IS_UNHOOK", request->GetId()) == 0) { + ServerInstance->Log(DEBUG, "Unhooking socket %08x", ISR->Sock); return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; } return NULL; @@ -314,6 +317,7 @@ class ModuleSSLOpenSSL : public Module virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport) { + ServerInstance->Log(DEBUG, "Hook accept %d", fd); issl_session* session = &sessions[fd]; session->fd = fd; @@ -515,6 +519,10 @@ class ModuleSSLOpenSSL : public Module int DoWrite(issl_session* session) { + if (!session->outbuf.size()) + return -1; + + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: To write: %d", session->outbuf.size()); int ret = SSL_write(session->sess, session->outbuf.data(), session->outbuf.size()); if (ret == 0) -- cgit v1.2.3