From 7b3105e5d4ea1877f8c30daaf069839ea890752d Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 24 Oct 2007 22:52:51 +0000 Subject: Implement - limits how many clients can sit inside a 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 --- src/users.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/users.cpp') 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) { -- cgit v1.3.1-10-gc9f91