summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorDaniel Vassdal <shutter@canternet.org>2013-07-01 12:31:36 -0700
committerDaniel Vassdal <shutter@canternet.org>2013-07-02 10:55:51 -0700
commit3ae91bafe711b26ffae1aa27cfd4f5fe7bfc2347 (patch)
tree2bf6f811b277b633fedc0ba2abdee2886183bea8 /src/users.cpp
parentf2cdf27dd9c45f91f4184b81ea3b9be7c5d88173 (diff)
Allow for skipping clone checking before DNS is complete.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 468c2aa36..0dc9cea57 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -600,7 +600,7 @@ void User::UnOper()
/*
* Check class restrictions
*/
-void LocalUser::CheckClass()
+void LocalUser::CheckClass(bool clone_count)
{
ConnectClass* a = this->MyClass;
@@ -614,19 +614,22 @@ void LocalUser::CheckClass()
ServerInstance->Users->QuitUser(this, a->config->getString("reason", "Unauthorised connection"));
return;
}
- else if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal()))
+ else if (clone_count)
{
- ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)");
- if (a->maxconnwarn)
- ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString().c_str());
- return;
- }
- else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal()))
- {
- ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)");
- if (a->maxconnwarn)
- ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString().c_str());
- return;
+ if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal()))
+ {
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)");
+ if (a->maxconnwarn)
+ ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString().c_str());
+ return;
+ }
+ else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal()))
+ {
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)");
+ if (a->maxconnwarn)
+ ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString().c_str());
+ return;
+ }
}
this->nping = ServerInstance->Time() + a->GetPingTime() + ServerInstance->Config->dns_timeout;