aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_timedbans.cpp
diff options
context:
space:
mode:
authorGravatar brain2008-04-21 16:24:04 +0000
committerGravatar brain2008-04-21 16:24:04 +0000
commitf7e22cf3e341010902f462aa9d13b282a176eca7 (patch)
treef59df2d67642e9ecace0a102dd5a26c11ce8a2c4 /src/modules/m_timedbans.cpp
parent1.1.19+Cheshire (This is the oldest british cheese apparently) (diff)
Patch to fix timedbans crash reported earlier today, thanks for the headsup wonderwal
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@9562 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_timedbans.cpp')
-rw-r--r--src/modules/m_timedbans.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index daaf23898..27cc2b091 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -164,9 +164,11 @@ class ModuleTimedBans : public Module
if (cr)
{
const char *setban[3];
+ std::string mask = i->mask;
+
setban[0] = i->channel.c_str();
setban[1] = "-b";
- setban[2] = i->mask.c_str();
+ setban[2] = mask.c_str();
// kludge alert!
// ::SendMode expects a userrec* to send the numeric replies
// back to, so we create it a fake user that isnt in the user
@@ -186,6 +188,15 @@ class ModuleTimedBans : public Module
Event rmode((char *)&n, NULL, "send_mode");
rmode.Send(ServerInstance);
DELETE(temp);
+
+ bool was_removed = true;
+ for (BanList::iterator j = cr->bans.begin(); j != cr->bans.end(); j++)
+ if (!strcasecmp(j->data, mask.c_str()))
+ was_removed = false;
+
+ /* Fix for crash if user cycles before the ban expires */
+ if (!was_removed)
+ TimedBanList.erase(i);
}
else
{