X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_ssl_openssl.cpp;h=f46f04988c96da37e7c5849356cbeb1588287b8b;hb=5adff9af1b71adb9ebaaa09159821b1947f7f625;hp=49c2ecfc85b364b2ba683084871e01fb90c3ecb9;hpb=c015aa4c0e1cfc031109c18af497cca9a72c844c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 49c2ecfc8..f46f04988 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -1,7 +1,20 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + #include #include -#include +#include #include #include "inspircd_config.h" @@ -120,10 +133,10 @@ class ModuleSSLOpenSSL : public Module SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify); // Needs the flag as it ignores a plain /rehash - OnRehash("ssl"); + OnRehash(NULL,"ssl"); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { if (param != "ssl") return; @@ -151,6 +164,9 @@ class ModuleSSLOpenSSL : public Module if (ServerInstance->Config->AddIOHook(portno, this)) { listenports.push_back(portno); + for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++) + if (ServerInstance->Config->ports[i] == portno) + ServerInstance->Config->openSockfd[i]->SetDescription("ssl"); ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno); } else @@ -277,7 +293,13 @@ class ModuleSSLOpenSSL : public Module ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers); for(unsigned int i = 0; i < listenports.size(); i++) + { ServerInstance->Config->DelIOHook(listenports[i]); + for (unsigned int j = 0; j < ServerInstance->stats->BoundPortCount; j++) + if (ServerInstance->Config->ports[j] == listenports[i]) + if (ServerInstance->Config->openSockfd[j]) + ServerInstance->Config->openSockfd[j]->SetDescription("plaintext"); + } } } @@ -302,8 +324,17 @@ class ModuleSSLOpenSSL : public Module } 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; + char* ret = "OK"; + try + { + ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + } + catch (ModuleException &e) + { + return NULL; + } + + return ret; } else if (strcmp("IS_UNHOOK", request->GetId()) == 0) {