summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-24 22:52:51 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-24 22:52:51 +0000
commit7b3105e5d4ea1877f8c30daaf069839ea890752d (patch)
treef797652ab543040b3a8b14bbc12476e8ca8a09c9 /src/users.cpp
parentf2d6214247c75342e872c519630f0d5553190ece (diff)
Implement <connect:limit> - limits how many clients can sit inside a <connect> tag. Brain, we have a problem here in that if we User::QuitUser() a user with a NULL MyClass member (connect class), then things break (like sendq et al). What should we do with this, create a generic catchall class or something just in case? (to replicate, set up a single connect class with a low limit, and connect too many clients. Crash is the result)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8357 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 381806e50..1affa67db 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1762,6 +1762,13 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
/* ensure we don't fuck things up refcount wise, only remove them from a class if we find a new one :P */
if (found)
{
+ /* deny change if change will take class over the limit */
+ if (found->RefCount + 1 >= found->limit)
+ {
+ ServerInstance->Log(DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit);
+ return this->MyClass;
+ }
+
/* should always be valid, but just in case .. */
if (this->MyClass)
{