summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp12
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp12
2 files changed, 18 insertions, 6 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 5d8ae98d7..51408067f 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -41,9 +41,15 @@
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
-bool isin(const std::string &hostandport, const std::vector<std::string> &portlist)
+bool isin(const std::string &host, int port, const std::vector<std::string> &portlist)
{
- return std::find(portlist.begin(), portlist.end(), hostandport) != portlist.end();
+ if (std::find(portlist.begin(), portlist.end(), "*:" + ConvToStr(port)) != portlist.end())
+ return true;
+
+ if (std::find(portlist.begin(), portlist.end(), ":" + ConvToStr(port)) != portlist.end())
+ return true;
+
+ return std::find(portlist.begin(), portlist.end(), host + ":" + ConvToStr(port)) != portlist.end();
}
/** Represents an SSL user's extra data
@@ -319,7 +325,7 @@ class ModuleSSLGnuTLS : public Module
virtual void OnHookUserIO(User* user, const std::string &targetip)
{
- if (!user->io && isin(targetip+":"+ConvToStr(user->GetPort()),listenports))
+ if (!user->io && isin(targetip,user->GetPort(),listenports))
{
/* Hook the user with our module */
user->io = this;
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 45b88b4c4..c4bc180e5 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -46,9 +46,15 @@ enum issl_io_status { ISSL_WRITE, ISSL_READ };
static bool SelfSigned = false;
-bool isin(const std::string &hostandport, const std::vector<std::string> &portlist)
+bool isin(const std::string &host, int port, const std::vector<std::string> &portlist)
{
- return std::find(portlist.begin(), portlist.end(), hostandport) != portlist.end();
+ if (std::find(portlist.begin(), portlist.end(), "*:" + ConvToStr(port)) != portlist.end())
+ return true;
+
+ if (std::find(portlist.begin(), portlist.end(), ":" + ConvToStr(port)) != portlist.end())
+ return true;
+
+ return std::find(portlist.begin(), portlist.end(), host + ":" + ConvToStr(port)) != portlist.end();
}
char* get_error()
@@ -152,7 +158,7 @@ class ModuleSSLOpenSSL : public Module
virtual void OnHookUserIO(User* user, const std::string &targetip)
{
- if (!user->io && isin(targetip + ":" + ConvToStr(user->GetPort()), listenports))
+ if (!user->io && isin(targetip,user->GetPort(), listenports))
{
/* Hook the user with our module */
user->io = this;