mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-12 12:09:03 -04:00
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
This commit is contained in:
parent
4f946291b7
commit
e588fdca3b
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -30,9 +30,15 @@ class ModuleXMLSocket : public Module
|
||||
ServerInstance->Modules->Attach(eventlist, this, 6);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
virtual void OnRehash(User* user, const std::string ¶m)
|
||||
@ -51,6 +57,7 @@ class ModuleXMLSocket : public Module
|
||||
// Get the port we're meant to be listening on with SSL
|
||||
std::string port = Conf->ReadValue("bind", "port", i);
|
||||
std::string addr = Conf->ReadValue("bind", "address", i);
|
||||
|
||||
irc::portparser portrange(port, false);
|
||||
long portno = -1;
|
||||
while ((portno = portrange.GetToken()))
|
||||
@ -107,7 +114,7 @@ class ModuleXMLSocket : 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user