From 08895e2aa3c1bfe604cf85249ea2ee62743e73ff Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Sat, 4 Sep 2010 19:30:44 -0400 Subject: Do not apply parameter length restrictions or CleanMask when unsetting modes --- src/mode.cpp | 2 +- src/modes/cmode_b.cpp | 5 +---- src/modules/u_listmode.h | 9 ++++++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mode.cpp b/src/mode.cpp index bda0f81aa..a3f8ab6fe 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -266,7 +266,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool int pcnt = mh->GetNumParams(adding); // crop mode parameter size to 250 characters - if (parameter.length() > 250) + if (parameter.length() > 250 && adding) parameter = parameter.substr(0, 250); ModResult MOD_RESULT; diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 5fcebfde9..0bd8d286d 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -105,7 +105,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan /* Attempt to tidy the mask */ ModeParser::CleanMask(dest); /* If the mask was invalid, we exit */ - if (dest == "") + if (dest == "" || dest.length() > 250) return dest; long maxbans = chan->GetMaxBans(); @@ -150,9 +150,6 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan return dest; } - /* 'Clean' the mask, e.g. nick -> nick!*@* */ - ModeParser::CleanMask(dest); - for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++) { if (!strcasecmp(i->data.c_str(), dest.c_str())) diff --git a/src/modules/u_listmode.h b/src/modules/u_listmode.h index a79828403..c18ac0f71 100644 --- a/src/modules/u_listmode.h +++ b/src/modules/u_listmode.h @@ -222,11 +222,14 @@ class ListModeBase : public ModeHandler // Try and grab the list modelist* el = extItem.get(channel); - if (this->tidy) - ModeParser::CleanMask(parameter); - if (adding) { + if (tidy) + ModeParser::CleanMask(parameter); + + if (parameter.length() > 250) + return MODEACTION_DENY; + // If there was no list if (!el) { -- cgit v1.2.3