summaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-14 15:08:15 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-14 15:08:15 +0000
commit7527d8dd9515ec05a2640de4b48b8ffb254384de (patch)
treed99f37138b3c023f1bbf8bf1a326199245d027cb /src/command_parse.cpp
parent1fb8a3f1b120db764375911be9ad8019a807a8ad (diff)
Apply fake lag on garbage input to discourage crap
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11511 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 94a4a55fe..bf025be7c 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -266,6 +266,16 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
/* find the command, check it exists */
Commandtable::iterator cm = cmdlist.find(command);
+ /* Modify the user's penalty regardless of whether or not the command exists */
+ bool do_more = true;
+ if (!user->HasPrivPermission("users/flood/no-throttle"))
+ {
+ // If it *doesn't* exist, give it a slightly heftier penalty than normal to deter flooding us crap
+ user->IncreasePenalty(cm != cmdlist.end() ? cm->second->Penalty : 2);
+ do_more = (user->Penalty < 10);
+ }
+
+
if (cm == cmdlist.end())
{
int MOD_RESULT = 0;
@@ -336,14 +346,6 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
if (MOD_RESULT == 1)
return true;
- /* Modify the user's penalty */
- bool do_more = true;
- if (!user->HasPrivPermission("users/flood/no-throttle"))
- {
- user->IncreasePenalty(cm->second->Penalty);
- do_more = (user->Penalty < 10);
- }
-
/* activity resets the ping pending timer */
if (user->MyClass)
user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();