diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-15 14:29:03 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-15 14:29:03 +0000 |
commit | f2c88404376249c34436c1de286e42e76e2c6c47 (patch) | |
tree | 957175ddd48293cfcc5f76583c54390afee7c05c /src | |
parent | 4c25d5ecbb2f782cc4eccb9833e68f9bcb02320c (diff) |
Slight security fix of sorts
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7027 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/users.cpp | 29 |
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); |