Fix CommandFloodPenalty overflow on connect

This commit is contained in:
Daniel De Graaf 2010-03-23 09:51:10 -05:00
parent 55a095e924
commit 70b8955adf
2 changed files with 8 additions and 3 deletions

View File

@ -56,11 +56,11 @@ class CloakUser : public ModeHandler
return MODEACTION_ALLOW;
}
if (adding && !dest->IsModeSet('x'))
{
/* don't allow this user to spam modechanges */
IS_LOCAL(dest)->CommandFloodPenalty += 5000;
if (adding && !dest->IsModeSet('x'))
{
std::string* cloak = ext.get(dest);
if (!cloak)
@ -78,6 +78,9 @@ class CloakUser : public ModeHandler
}
else if (!adding && dest->IsModeSet('x'))
{
/* don't allow this user to spam modechanges */
IS_LOCAL(dest)->CommandFloodPenalty += 5000;
/* User is removing the mode, so restore their real host
* and make it match the displayed one.
*/

View File

@ -863,6 +863,8 @@ void LocalUser::FullConnect()
this->GetServerPort(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str());
ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding NEGATIVE hit for %s", this->GetIPString());
ServerInstance->BanCache->AddHit(this->GetIPString(), "", "");
// reset the flood penalty (which could have been raised due to things like auto +x)
CommandFloodPenalty = 0;
}
void User::InvalidateCache()