From b6a5e2bd143cdd2fc610f79c87729d2e211da7ff Mon Sep 17 00:00:00 2001 From: danieldg Date: Fri, 9 Oct 2009 19:00:09 +0000 Subject: Add server ports to ServerInstance->ports, enable SSL on them using OnHookIO git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11810 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqlite3.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 15 +++++---------- src/modules/extra/m_ssl_openssl.cpp | 12 +++--------- 3 files changed, 9 insertions(+), 20 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 680053bf1..cb4fb0b5e 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -74,7 +74,7 @@ class SQLiteListener : public ListenSocketBase FileReader* index; public: - SQLiteListener(ModuleSQLite3* P, int port, const std::string &addr) : ListenSocketBase(port, addr), Parent(P) + SQLiteListener(ModuleSQLite3* P, int port, const std::string &addr) : ListenSocketBase(port, addr, "ITC", "none"), Parent(P) { uslen = sizeof(sock_us); if (getsockname(this->fd,(sockaddr*)&sock_us,&uslen)) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 3530b0e1f..fd572492a 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -122,8 +122,6 @@ class CommandStartTLS : public Command class ModuleSSLGnuTLS : public Module { - std::set listenports; - issl_session* sessions; gnutls_certificate_credentials x509_cred; @@ -171,21 +169,18 @@ class ModuleSSLGnuTLS : public Module { ConfigReader Conf; - listenports.clear(); sslports.clear(); for (size_t i = 0; i < ServerInstance->ports.size(); i++) { ListenSocketBase* port = ServerInstance->ports[i]; - std::string desc = port->GetDescription(); - if (desc != "gnutls") + if (port->hook != "gnutls") continue; - listenports.insert(port); - std::string portid = port->GetBindDesc(); - + const std::string& portid = port->GetBindDesc(); ServerInstance->Logs->Log("m_ssl_gnutls", DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %s", portid.c_str()); - if (port->GetIP() != "127.0.0.1") + + if (port->type == "clients" && port->GetIP() != "127.0.0.1") sslports.append(portid).append(";"); } @@ -345,7 +340,7 @@ class ModuleSSLGnuTLS : public Module void OnHookIO(StreamSocket* user, ListenSocketBase* lsb) { - if (!user->GetIOHook() && listenports.find(lsb) != listenports.end()) + if (!user->GetIOHook() && lsb->hook == "gnutls") { /* Hook the user with our module */ user->AddIOHook(this); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 8af930aa9..a348726e7 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -81,8 +81,6 @@ static int OnVerify(int preverify_ok, X509_STORE_CTX *ctx) class ModuleSSLOpenSSL : public Module { - std::set listenports; - int inbufsize; issl_session* sessions; @@ -135,7 +133,7 @@ class ModuleSSLOpenSSL : public Module void OnHookIO(StreamSocket* user, ListenSocketBase* lsb) { - if (!user->GetIOHook() && listenports.find(lsb) != listenports.end()) + if (!user->GetIOHook() && lsb->hook == "openssl") { /* Hook the user with our module */ user->AddIOHook(this); @@ -146,21 +144,17 @@ class ModuleSSLOpenSSL : public Module { ConfigReader Conf; - listenports.clear(); sslports.clear(); for (size_t i = 0; i < ServerInstance->ports.size(); i++) { ListenSocketBase* port = ServerInstance->ports[i]; - std::string desc = port->GetDescription(); - if (desc != "openssl") + if (port->hook != "openssl") continue; - listenports.insert(port); std::string portid = port->GetBindDesc(); - ServerInstance->Logs->Log("m_ssl_openssl", DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %s", portid.c_str()); - if (port->GetIP() != "127.0.0.1") + if (port->type == "clients" && port->GetIP() != "127.0.0.1") sslports.append(portid).append(";"); } -- cgit v1.2.3