summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel De Graaf <danieldg@inspircd.org>2010-09-04 19:30:44 -0400
committerDaniel De Graaf <danieldg@inspircd.org>2010-09-04 19:30:44 -0400
commit08895e2aa3c1bfe604cf85249ea2ee62743e73ff (patch)
tree6f8fe1c023052f7f16ce503c483d591955da926b
parent3ee7abb7b9127edd8b730602376a9e827afb95f6 (diff)
Do not apply parameter length restrictions or CleanMask when unsetting modes
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modes/cmode_b.cpp5
-rw-r--r--src/modules/u_listmode.h9
3 files changed, 8 insertions, 8 deletions
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)
{