summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-21 16:24:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-21 16:24:44 +0000
commit516e95e6f6c474018cb57f30934cb68296243730 (patch)
tree158f35b7325d9f4152adde890c4448cbf7b3776f /src/modules
parentcd87c3d447a1480e2f818b93c67f4dbed897eb74 (diff)
Patch to fix timedbans crash reported earlier today, thanks for the headsup wonderwal
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9563 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_timedbans.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 4be32ffc2..6247f32d6 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -158,17 +158,28 @@ 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();
-
- ServerInstance->PI->SendModeStr(i->channel, std::string("-b ") + setban[2]);
- ServerInstance->SendMode(setban,3, ServerInstance->FakeClient);
+ setban[2] = mask.c_str();
CUList empty;
cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str());
if (ServerInstance->Config->AllowHalfop)
cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str());
+
+ ServerInstance->PI->SendModeStr(i->channel, std::string("-b ") + setban[2]);
+ ServerInstance->SendMode(setban,3, ServerInstance->FakeClient);
+
+ 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
{