summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/users.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/users.h b/include/users.h
index d51e06ba9..b11d346b7 100644
--- a/include/users.h
+++ b/include/users.h
@@ -181,14 +181,14 @@ public:
registration_timeout(source->registration_timeout), flood(source->flood), host(source->host),
pingtime(source->pingtime), pass(source->pass), threshold(source->threshold), sendqmax(source->sendqmax),
recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans),
- port(source->port), RefCount(0), disabled(false)
+ port(source->port), RefCount(0), disabled(false), limit(0)
{
}
/** Create a new connect class with no settings.
*/
ConnectClass() : type(CC_DENY), name("unnamed"), registration_timeout(0), flood(0), host(""), pingtime(0), pass(""),
- threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), RefCount(0), disabled(false)
+ threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), RefCount(0), disabled(false), limit(0)
{
}
@@ -209,14 +209,14 @@ public:
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
unsigned long maxl, unsigned long maxg, unsigned int maxc, int p = 0) :
type(CC_ALLOW), name(thename), registration_timeout(timeout), flood(fld), host(hst), pingtime(ping), pass(pas),
- threshold(thres), sendqmax(sendq), recvqmax(recvq), maxlocal(maxl), maxglobal(maxg), maxchans(maxc), port(p), RefCount(0), disabled(false) { }
+ threshold(thres), sendqmax(sendq), recvqmax(recvq), maxlocal(maxl), maxglobal(maxg), maxchans(maxc), port(p), RefCount(0), disabled(false), limit(0) { }
/** Create a new connect class to DENY connections
* @param thename Name of the connect class
* @param hst The IP mask to deny
*/
ConnectClass(const std::string &thename, const std::string &hst) : type(CC_DENY), name(thename), registration_timeout(0),
- flood(0), host(hst), pingtime(0), pass(""), threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), RefCount(0), disabled(false)
+ flood(0), host(hst), pingtime(0), pass(""), threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), RefCount(0), disabled(false), limit(0)
{
}
@@ -228,7 +228,7 @@ public:
registration_timeout(source->registration_timeout), flood(source->flood), host(source->host),
pingtime(source->pingtime), pass(source->pass), threshold(source->threshold), sendqmax(source->sendqmax),
recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans),
- port(source->port), RefCount(0), disabled(false)
+ port(source->port), RefCount(0), disabled(false), limit(0)
{
}
@@ -246,7 +246,7 @@ public:
*/
void Update(unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
- unsigned long maxl, unsigned long maxg, unsigned int maxc, int p)
+ unsigned long maxl, unsigned long maxg, unsigned int maxc, int p, unsigned long limit)
{
if (timeout)
registration_timeout = timeout;
@@ -272,6 +272,8 @@ public:
maxchans = maxc;
if (p)
port = p;
+
+ this->limit = limit;
}
/** Reference counter. Contains an int as to how many users are connected to this class. :)
@@ -284,6 +286,10 @@ public:
*/
bool disabled;
+ /** How many users may be in this connect class before they are refused? (0 = disabled = default)
+ */
+ unsigned long limit;
+
int GetMaxChans()
{
return maxchans;