summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2016-10-23 15:23:14 +0100
committerPeter Powell <petpow@saberuk.com>2016-10-25 09:36:54 +0100
commit02575ecbbbd7311f7e16ed9f2f3a1c5809deefa8 (patch)
treebf1746ab85d0c59cba3544601578c170068fb20c /src/users.cpp
parent9d6cc28ed0921c5a2fdffce8025ce258d4befeb8 (diff)
Allow classes to take a port range.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 5d1c12b13..498a27d58 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1096,14 +1096,14 @@ void LocalUser::SetClass(const std::string &explicit_name)
}
/* if it requires a port ... */
- int port = c->config->getInt("port");
- if (port)
+ if (!c->ports.empty())
{
- ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires port (%d)", port);
-
/* and our port doesn't match, fail. */
- if (this->GetServerPort() != port)
+ if (!c->ports.count(this->GetServerPort()))
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping");
continue;
+ }
}
if (regdone && !c->config->getString("password").empty())
@@ -1171,7 +1171,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons
softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax),
penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate),
maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxconnwarn(parent.maxconnwarn), maxchans(parent.maxchans),
- limit(parent.limit), resolvehostnames(parent.resolvehostnames)
+ limit(parent.limit), resolvehostnames(parent.resolvehostnames), ports(parent.ports)
{
}
@@ -1195,4 +1195,5 @@ void ConnectClass::Update(const ConnectClass* src)
maxchans = src->maxchans;
limit = src->limit;
resolvehostnames = src->resolvehostnames;
+ ports = src->ports;
}