From 7527d8dd9515ec05a2640de4b48b8ffb254384de Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 14 Aug 2009 15:08:15 +0000 Subject: 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 --- src/command_parse.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/command_parse.cpp') 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(); -- cgit v1.2.3