From f08dda3cad24f68719e9c58d28b9381aad7f8689 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 18 Jun 2007 19:17:40 +0000 Subject: Add ISUPPORT SSL token requested by tabris. Syntax: SSL=:[;: ...] Note that the insp implementation due to API limitations (ick, we have some) will print '*' in the host/ip section, meaning 'bound to all', a client should just connect-back to the ip it connected to initially, on the new port to make use of this. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7386 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 10 +++++++++- src/modules/extra/m_ssl_openssl.cpp | 13 ++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 8c08fb80b..a6fd64fa7 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -80,6 +80,7 @@ class ModuleSSLGnuTLS : public Module std::string certfile; std::string cafile; std::string crlfile; + std::string sslports; int dh_bits; int clientactive; @@ -124,6 +125,7 @@ class ModuleSSLGnuTLS : public Module listenports.clear(); clientactive = 0; + sslports.clear(); for(int i = 0; i < Conf->Enumerate("bind"); i++) { @@ -147,6 +149,7 @@ class ModuleSSLGnuTLS : public Module if (ServerInstance->Config->ports[i]->GetPort() == portno) ServerInstance->Config->ports[i]->SetDescription("ssl"); ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); + sslports.append("*:").append(ConvToStr(portno)).append(";"); } else { @@ -281,10 +284,15 @@ class ModuleSSLGnuTLS : public Module void Implements(char* List) { - List[I_OnRawSocketConnect] = List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1; + List[I_On005Numeric] = List[I_OnRawSocketConnect] = List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1; List[I_OnRequest] = List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1; } + virtual void On005Numeric(std::string &output) + { + output.append(" SSL=" + sslports); + } + virtual char* OnRequest(Request* request) { ISHRequest* ISR = (ISHRequest*)request; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 943d88843..1d323e3b8 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -122,6 +122,7 @@ class ModuleSSLOpenSSL : public Module std::string cafile; // std::string crlfile; std::string dhfile; + std::string sslports; int clientactive; @@ -168,6 +169,7 @@ class ModuleSSLOpenSSL : public Module listenports.clear(); clientactive = 0; + sslports.clear(); for (int i = 0; i < Conf->Enumerate("bind"); i++) { @@ -191,6 +193,7 @@ class ModuleSSLOpenSSL : public Module if (ServerInstance->Config->ports[i]->GetPort() == portno) ServerInstance->Config->ports[i]->SetDescription("ssl"); ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno); + sslports.append("*:").append(ConvToStr(portno)).append(";"); } else { @@ -205,6 +208,9 @@ class ModuleSSLOpenSSL : public Module } } + if (!sslports.empty()) + sslports.erase(sslports.end() - 1); + std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / confdir = confdir.substr(0, confdir.find_last_of('/') + 1); @@ -285,6 +291,11 @@ class ModuleSSLOpenSSL : public Module DELETE(Conf); } + virtual void On005Numeric(std::string &output) + { + output.append(" SSL=" + sslports); + } + virtual ~ModuleSSLOpenSSL() { SSL_CTX_free(ctx); @@ -334,7 +345,7 @@ class ModuleSSLOpenSSL : public Module void Implements(char* List) { - List[I_OnRawSocketConnect] = List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1; + List[I_OnRawSocketConnect] = List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = List[I_On005Numeric] = 1; List[I_OnRequest] = List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1; } -- cgit v1.2.3