summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-01 20:14:49 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-01 20:14:49 +0000
commitbe2a677ddd01859a61f484aa8f1e5d916a8f3ca5 (patch)
treef0b5fe8049221ecaebbe6cdf00b55d1331e85e68
parent9994478a85358bfa48bd5b764ebc1e74e928d57a (diff)
Remove lines_in and reset_due flood protection mechanism, recvq/sendq on their own now fill this role, as we have proper penalties.
This tidies up *a lot* of code, and also saves a further sizeof(time_t) + sizeof(unsigned int) per user. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10838 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h8
-rw-r--r--src/command_parse.cpp24
-rw-r--r--src/userprocess.cpp26
-rw-r--r--src/users.cpp3
4 files changed, 2 insertions, 59 deletions
diff --git a/include/users.h b/include/users.h
index 6bb37f3e0..23a520fe0 100644
--- a/include/users.h
+++ b/include/users.h
@@ -633,14 +633,6 @@ class CoreExport User : public EventHandler
*/
bool quietquit;
- /** Flood counters - lines received
- */
- unsigned int lines_in;
-
- /** Flood counters - time lines_in is due to be reset
- */
- time_t reset_due;
-
/** If this is set to true, then all socket operations for the user
* are dropped into the bit-bucket.
* This value is set by QuitUser, and is not needed seperately from that call.
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 1b91a86ef..8798f03f0 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -218,32 +218,8 @@ CmdResult CommandParser::CallHandler(const std::string &commandname, const std::
void CommandParser::DoLines(User* current, bool one_only)
{
- // while there are complete lines to process...
- unsigned int floodlines = 0;
-
while (current->BufferIsReady())
{
- if (current->MyClass)
- {
- if (ServerInstance->Time() > current->reset_due)
- {
- current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
- current->lines_in = 0;
- }
-
- if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
- {
- ServerInstance->FloodQuitUser(current);
- return;
- }
-
- if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
- {
- ServerInstance->FloodQuitUser(current);
- return;
- }
- }
-
// use GetBuffer to copy single lines into the sanitized string
std::string single_line = current->GetBuffer();
current->bytes_in += single_line.length();
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index a529f4476..30260f23e 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -102,31 +102,7 @@ void ProcessUserHandler::Call(User* cu)
if (!current->AddBuffer(ReadBuffer))
{
// AddBuffer returned false, theres too much data in the user's buffer and theyre up to no good.
- if (current->registered == REG_ALL)
- {
- if (current->MyClass)
- {
- // Make sure they arn't flooding long lines.
- if (Server->Time() > current->reset_due)
- {
- current->reset_due = Server->Time() + current->MyClass->GetThreshold();
- current->lines_in = 0;
- }
-
- current->lines_in++;
-
- if (current->MyClass->GetFlood() && current->lines_in > current->MyClass->GetFlood())
- Server->FloodQuitUser(current);
- else
- {
- current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick.c_str(), MAXBUF-2);
- current->recvq.clear();
- }
- }
- }
- else
- Server->FloodQuitUser(current);
-
+ Server->FloodQuitUser(current);
return;
}
diff --git a/src/users.cpp b/src/users.cpp
index 48e0bcd12..851e0a1d6 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -209,10 +209,9 @@ void User::DecrementModes()
User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance)
{
server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
- reset_due = ServerInstance->Time();
age = ServerInstance->Time();
Penalty = 0;
- lines_in = lastping = signon = idle_lastmsg = nping = registered = 0;
+ lastping = signon = idle_lastmsg = nping = registered = 0;
bytes_in = bytes_out = cmds_in = cmds_out = 0;
quietquit = quitting = exempt = haspassed = dns_done = false;
fd = -1;