summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/users.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/users.cpp b/src/users.cpp
index eacbe2779..5116b3e5f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -908,6 +908,20 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
return;
}
+ /* fix: do maxperlocal/global IP here, not on full connect to stop fd exhaustion attempts */
+ if ((i->GetMaxLocal()) && (New->LocalCloneCount() > i->GetMaxLocal()))
+ {
+ userrec::QuitUser(Instance, New, "No more connections allowed from your host via this connect class (local)");
+ Instance->WriteOpers("*** WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", i->GetMaxLocal(), New->GetIPString());
+ return;
+ }
+ else if ((i->GetMaxGlobal()) && (New->GlobalCloneCount() > i->GetMaxGlobal()))
+ {
+ userrec::QuitUser(Instance, New, "No more connections allowed from your host via this connect class (global)");
+ Instance->WriteOpers("*** WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s",i->GetMaxGlobal(), New->GetIPString());
+ return;
+ }
+
New->pingmax = i->GetPingTime();
New->nping = Instance->Time() + i->GetPingTime() + Instance->Config->dns_timeout;
New->timeout = Instance->Time() + i->GetRegTimeout();
@@ -1008,21 +1022,6 @@ void userrec::FullConnect()
return;
}
- if ((a->GetMaxLocal()) && (this->LocalCloneCount() > a->GetMaxLocal()))
- {
- this->muted = true;
- ServerInstance->GlobalCulls.AddItem(this, "No more connections allowed from your host via this connect class (local)");
- ServerInstance->WriteOpers("*** WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString());
- return;
- }
- else if ((a->GetMaxGlobal()) && (this->GlobalCloneCount() > a->GetMaxGlobal()))
- {
- this->muted = true;
- ServerInstance->GlobalCulls.AddItem(this, "No more connections allowed from your host via this connect class (global)");
- ServerInstance->WriteOpers("*** WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s",a->GetMaxGlobal(), this->GetIPString());
- return;
- }
-
if (!this->exempt)
{
GLine* r = ServerInstance->XLines->matches_gline(this);