diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-24 17:01:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-24 17:01:50 +0000 |
commit | e588fdca3b29dc3bab6051cf409637a5bace35d8 (patch) | |
tree | ace33c4781ef56c9aff6dbc60a4ba3e2707346be /src/modules/extra/m_ssl_gnutls.cpp | |
parent | 4f946291b7fd022b50fe5aacb9b851cebfbb2278 (diff) |
Should now work with ports bound to all interfaces
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9192 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_ssl_gnutls.cpp')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 12 |
1 files changed, 9 insertions, 3 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; |