summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-01 20:14:50 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-01 20:14:50 +0000
commita23a840749db9646884907ae28588b1962dc2449 (patch)
tree5f1ac6591c6e5bbeb50a2cddece39eac9e8d684e
parentbe2a677ddd01859a61f484aa8f1e5d916a8f3ca5 (diff)
Rip flood/threshold out of config classes also.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10839 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h58
-rw-r--r--src/commands/cmd_stats.cpp2
-rw-r--r--src/configreader.cpp44
3 files changed, 39 insertions, 65 deletions
diff --git a/include/users.h b/include/users.h
index 23a520fe0..624017eee 100644
--- a/include/users.h
+++ b/include/users.h
@@ -80,21 +80,23 @@ class CoreExport ConnectClass : public classbase
/** Type of line, either CC_ALLOW or CC_DENY
*/
char type;
+
/** Connect class name
*/
std::string name;
+
/** Max time to register the connection in seconds
*/
unsigned int registration_timeout;
- /** Number of lines in buffer before excess flood is triggered
- */
- unsigned int flood;
+
/** Host mask for this line
*/
std::string host;
+
/** Number of seconds between pings for this line
*/
unsigned int pingtime;
+
/** (Optional) Password for this line
*/
std::string pass;
@@ -103,10 +105,6 @@ class CoreExport ConnectClass : public classbase
*/
std::string hash;
- /** Threshold value for flood disconnect
- */
- unsigned int threshold;
-
/** Maximum size of sendq for users in this class (bytes)
*/
unsigned long sendqmax;
@@ -136,8 +134,8 @@ public:
/** Create a new connect class based on an existing connect class. This is required for std::vector (at least under windows).
*/
ConnectClass(const ConnectClass* source) : classbase(), type(source->type), name(source->name),
- registration_timeout(source->registration_timeout), flood(source->flood), host(source->host),
- pingtime(source->pingtime), pass(source->pass), hash(source->hash), threshold(source->threshold), sendqmax(source->sendqmax),
+ registration_timeout(source->registration_timeout), host(source->host),
+ pingtime(source->pingtime), pass(source->pass), hash(source->hash), sendqmax(source->sendqmax),
recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans),
port(source->port), RefCount(0), disabled(false), limit(source->limit)
{
@@ -145,37 +143,35 @@ public:
/** Create a new connect class with no settings.
*/
- ConnectClass() : type(CC_DENY), name("unnamed"), registration_timeout(0), flood(0), host(""), pingtime(0), pass(""), hash(""),
- threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), RefCount(0), disabled(false), limit(0)
+ ConnectClass() : type(CC_DENY), name("unnamed"), registration_timeout(0), host(""), pingtime(0), pass(""), hash(""),
+ sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), RefCount(0), disabled(false), limit(0)
{
}
/** Create a new connect class to ALLOW connections.
* @param thename Name of the connect class
* @param timeout The registration timeout
- * @param fld The flood value
* @param hst The IP mask to allow
* @param ping The ping frequency
* @param pas The password to be used
* @param hsh The hash to be used
- * @param thres The flooding threshold
* @param sendq The maximum sendq value
* @param recvq The maximum recvq value
* @param maxl The maximum local sessions
* @param maxg The maximum global sessions
*/
- ConnectClass(const std::string &thename, unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
- const std::string &pas, const std::string &hsh, unsigned int thres, unsigned long sendq, unsigned long recvq,
+ ConnectClass(const std::string &thename, unsigned int timeout,const std::string &hst, unsigned int ping,
+ const std::string &pas, const std::string &hsh, 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), hash(hsh),
- threshold(thres), sendqmax(sendq), recvqmax(recvq), maxlocal(maxl), maxglobal(maxg), maxchans(maxc), port(p), RefCount(0), disabled(false), limit(0) { }
+ type(CC_ALLOW), name(thename), registration_timeout(timeout), host(hst), pingtime(ping), pass(pas), hash(hsh),
+ 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(""), hash(""), threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), RefCount(0), disabled(false), limit(0)
+ host(hst), pingtime(0), pass(""), hash(""), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), RefCount(0), disabled(false), limit(0)
{
}
@@ -184,8 +180,8 @@ public:
* @param source Another connect class to inherit all but the name from
*/
ConnectClass(const std::string &thename, const ConnectClass* source) : type(source->type), name(thename),
- registration_timeout(source->registration_timeout), flood(source->flood), host(source->host),
- pingtime(source->pingtime), pass(source->pass), hash(source->hash), threshold(source->threshold), sendqmax(source->sendqmax),
+ registration_timeout(source->registration_timeout), host(source->host),
+ pingtime(source->pingtime), pass(source->pass), hash(source->hash), sendqmax(source->sendqmax),
recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans),
port(source->port), RefCount(0), disabled(false), limit(source->limit)
{
@@ -203,22 +199,18 @@ public:
/* Update an existing entry with new values
*/
- 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,
+ void Update(unsigned int timeout, const std::string &hst, unsigned int ping,
+ const std::string &pas, unsigned long sendq, unsigned long recvq,
unsigned long maxl, unsigned long maxg, unsigned int maxc, int p, unsigned long llimit)
{
if (timeout)
registration_timeout = timeout;
- if (fld)
- flood = fld;
if (!hst.empty())
host = hst;
if (ping)
pingtime = ping;
if (!pas.empty())
pass = pas;
- if (thres)
- threshold = thres;
if (sendq)
sendqmax = sendq;
if (recvq)
@@ -279,13 +271,6 @@ public:
return (registration_timeout ? registration_timeout : 90);
}
- /** Returns the flood limit
- */
- unsigned int GetFlood()
- {
- return (threshold ? flood : 999);
- }
-
/** Returns the allowed or denied IP mask
*/
const std::string& GetHost()
@@ -328,13 +313,6 @@ public:
return hash;
}
- /** Returns the flood threshold value
- */
- unsigned int GetThreshold()
- {
- return (threshold ? threshold : 1);
- }
-
/** Returns the maximum sendq value
*/
unsigned long GetSendqMax()
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 3219c53e7..d362d4614 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -112,7 +112,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
{
ConnectClass* c = *i;
results.push_back(sn+" 218 "+user->nick+" Y "+ConvToStr(idx)+" "+ConvToStr(c->GetPingTime())+" 0 "+ConvToStr(c->GetSendqMax())+" :"+
- ConvToStr(c->GetFlood())+" "+ConvToStr(c->GetRegTimeout()));
+ ConvToStr(c->GetRecvqMax())+" "+ConvToStr(c->GetRegTimeout()));
idx++;
}
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 9978f24d7..f8f485ec7 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -499,18 +499,16 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
const char* password = values[2].GetString();
int timeout = values[3].GetInteger();
int pingfreq = values[4].GetInteger();
- int flood = values[5].GetInteger();
- int threshold = values[6].GetInteger();
- int sendq = values[7].GetInteger();
- int recvq = values[8].GetInteger();
- int localmax = values[9].GetInteger();
- int globalmax = values[10].GetInteger();
- int port = values[11].GetInteger();
- const char* name = values[12].GetString();
- const char* parent = values[13].GetString();
- int maxchans = values[14].GetInteger();
- unsigned long limit = values[15].GetInteger();
- const char* hashtype = values[16].GetString();
+ int sendq = values[5].GetInteger();
+ int recvq = values[6].GetInteger();
+ int localmax = values[7].GetInteger();
+ int globalmax = values[8].GetInteger();
+ int port = values[9].GetInteger();
+ const char* name = values[10].GetString();
+ const char* parent = values[11].GetString();
+ int maxchans = values[12].GetInteger();
+ unsigned long limit = values[13].GetInteger();
+ const char* hashtype = values[14].GetString();
conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Adding a connect class!");
@@ -529,7 +527,7 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
if (cc->GetName() == parent)
{
cc = new ConnectClass(name, cc);
- cc->Update(timeout, flood, *allow ? allow : deny, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit);
+ cc->Update(timeout, *allow ? allow : deny, pingfreq, password, sendq, recvq, localmax, globalmax, maxchans, port, limit);
conf->Classes.push_back(cc);
break;
}
@@ -546,11 +544,11 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
{
if ((*item)->GetHost() == allow && !(*item)->GetDisabled())
{
- (*item)->Update(timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit);
+ (*item)->Update(timeout, allow, pingfreq, password, sendq, recvq, localmax, globalmax, maxchans, port, limit);
return true;
}
}
- cc = new ConnectClass(name, timeout, flood, allow, pingfreq, password, hashtype, threshold, sendq, recvq, localmax, globalmax, maxchans);
+ cc = new ConnectClass(name, timeout, allow, pingfreq, password, hashtype, sendq, recvq, localmax, globalmax, maxchans);
cc->limit = limit;
cc->SetPort(port);
conf->Classes.push_back(cc);
@@ -856,18 +854,16 @@ void ServerConfig::Read(bool bail, const std::string &useruid)
MultiConfig MultiValues[] = {
{"connect",
- {"allow", "deny", "password", "timeout", "pingfreq", "flood",
- "threshold", "sendq", "recvq", "localmax", "globalmax", "port",
+ {"allow", "deny", "password", "timeout", "pingfreq",
+ "sendq", "recvq", "localmax", "globalmax", "port",
"name", "parent", "maxchans", "limit", "hash",
NULL},
- {"", "", "", "", "120", "",
- "", "", "", "3", "3", "0",
- "", "", "0", "0", "",
+ {"", "", "", "", "120",
+ "", "", "3", "3", "0",
+ "", "", "0", "0", "",
NULL},
- {DT_IPADDRESS|DT_ALLOW_WILD,
- DT_IPADDRESS|DT_ALLOW_WILD,
- DT_CHARPTR, DT_INTEGER, DT_INTEGER, DT_INTEGER,
- DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER,
+ {DT_IPADDRESS|DT_ALLOW_WILD, DT_IPADDRESS|DT_ALLOW_WILD, DT_CHARPTR, DT_INTEGER, DT_INTEGER,
+ DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER,
DT_NOSPACES, DT_NOSPACES, DT_INTEGER, DT_INTEGER, DT_CHARPTR},
InitConnect, DoConnect, DoneConnect},