From 52a8a6d2bd1f015103f42eb7f1902f4f470f2318 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 21 Oct 2007 17:59:08 +0000 Subject: Fixed ssl clients on trunk. The problem peavey was having was that before ReadBuffer was char[] now its char*. sizeof() on char[] returns its size in chars, and sizeof on char* returns 4. :p git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8263 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/commands/cmd_pass.h | 2 +- src/modules/extra/m_ssl_openssl.cpp | 22 +++++++++++++++------- src/userprocess.cpp | 4 +++- src/users.cpp | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h index c4087c86a..ca667a36b 100644 --- a/include/commands/cmd_pass.h +++ b/include/commands/cmd_pass.h @@ -32,7 +32,7 @@ class cmd_pass : public Command public: /** Constructor for pass. */ - cmd_pass (InspIRCd* Instance) : Command(Instance,"PASS",0,1,true,false,0) { syntax = ""; } + cmd_pass (InspIRCd* Instance) : Command(Instance,"PASS",0,1,true,0) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index df47762af..2e86151ce 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -414,6 +414,8 @@ class ModuleSSLOpenSSL : public Module return; } + ServerInstance->Log(DEBUG,"OnRawSocketAccept begin handshake"); + Handshake(session); } @@ -446,6 +448,7 @@ class ModuleSSLOpenSSL : public Module virtual void OnRawSocketClose(int fd) { + ServerInstance->Log(DEBUG,"OnRawSocketClose %d", fd); /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */ if ((fd < 0) || (fd > MAX_DESCRIPTORS)) return; @@ -465,6 +468,7 @@ class ModuleSSLOpenSSL : public Module virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult) { + ServerInstance->Log(DEBUG,"OnRawSocketRead"); /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */ if ((fd < 0) || (fd > MAX_DESCRIPTORS)) return 0; @@ -535,13 +539,10 @@ class ModuleSSLOpenSSL : public Module // Zero the offset, as there's nothing there.. session->inbufoffset = 0; } - + ServerInstance->Log(DEBUG,"Read result=%d",readresult); return 1; } - else - { - return ret; - } + return ret; } } @@ -722,9 +723,7 @@ class ModuleSSLOpenSSL : public Module int ret; if (session->outbound) - { ret = SSL_connect(session->sess); - } else ret = SSL_accept(session->sess); @@ -734,12 +733,14 @@ class ModuleSSLOpenSSL : public Module if (err == SSL_ERROR_WANT_READ) { + ServerInstance->Log(DEBUG,"Handshake Want read"); session->rstat = ISSL_READ; session->status = ISSL_HANDSHAKING; return true; } else if (err == SSL_ERROR_WANT_WRITE) { + ServerInstance->Log(DEBUG,"Handshake Want write"); session->wstat = ISSL_WRITE; session->status = ISSL_HANDSHAKING; MakePollWrite(session); @@ -747,6 +748,7 @@ class ModuleSSLOpenSSL : public Module } else { + ServerInstance->Log(DEBUG,"Handshake close session"); CloseSession(session); } @@ -754,6 +756,7 @@ class ModuleSSLOpenSSL : public Module } else if (ret > 0) { + ServerInstance->Log(DEBUG,"Handshake complete"); // Handshake complete. // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater. User* u = ServerInstance->FindDescriptor(session->fd); @@ -809,7 +812,12 @@ class ModuleSSLOpenSSL : public Module //OnRawSocketWrite(session->fd, NULL, 0); EventHandler* eh = ServerInstance->FindDescriptor(session->fd); if (eh) + { ServerInstance->SE->WantWrite(eh); + ServerInstance->Log(DEBUG,"Made want write"); + } + else + ServerInstance->Log(DEBUG,"Couldnt find descriptor to make writeable!"); } virtual void OnBufferFlushed(User* user) diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 68c469aac..3a97a82c7 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -47,7 +47,9 @@ void ProcessUserHandler::Call(User* cu) try { - MOD_RESULT = Server->Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->GetFd(),ReadBuffer,sizeof(ReadBuffer),result2); + MOD_RESULT = Server->Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->GetFd(),ReadBuffer,Server->Config->NetBufferSize,result2); + + Server->Log(DEBUG,"MOD_RESULT=%d, result2=%d",MOD_RESULT,result2); } catch (CoreException& modexcept) { diff --git a/src/users.cpp b/src/users.cpp index 060e90782..7dd2a71ec 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -701,8 +701,8 @@ void User::UnOper() void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreason, const char* operreason) { - Instance->Log(DEBUG,"QuitUser: %s", user->nick); - user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, operreason); + Instance->Log(DEBUG,"QuitUser: %s '%s'", user->nick, quitreason.c_str()); + user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, *operreason ? operreason : quitreason.c_str()); user->muted = true; Instance->GlobalCulls.AddItem(user, quitreason.c_str(), operreason); } -- cgit v1.2.3