summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-02 21:02:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-02 21:02:40 +0000
commita0defce6dc8a2d69d99fa05d33cdb6a6a5a4a4d9 (patch)
tree312e0dbb5c9d33e3923d81d5100c6ca69cdb7b80 /src/xline.cpp
parentdccee96be21199ab2fe2a6d53dce025d016ced52 (diff)
We cant return NULL if the first hit we get expires in MatchLine, there may be another *after* it which matches, meaning that user may escape retribution ;)
(thanks for pointing that out, aquanight) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8471 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index ba1ed2249..c292cc170 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -218,19 +218,30 @@ XLine* XLineManager::MatchesLine(const std::string &type, User* user)
const time_t current = ServerInstance->Time();
- for (LookupIter i = x->second.begin(); i != x->second.end(); i++)
+ LookupIter safei;
+
+ for (LookupIter i = x->second.begin(); i != x->second.end(); )
{
+ safei = i;
+ safei++;
+
if (i->second->Matches(user))
{
if (i->second->duration && current > i->second->expiry)
{
/* Expire the line, return nothing */
ExpireLine(x, i);
- return NULL;
+ /* Continue, there may be another that matches
+ * (thanks aquanight)
+ */
+ i = safei;
+ continue;
}
else
return i->second;
}
+
+ i = safei;
}
return NULL;
}
@@ -244,19 +255,28 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat
const time_t current = ServerInstance->Time();
- for (LookupIter i = x->second.begin(); i != x->second.end(); i++)
+ LookupIter safei;
+
+ for (LookupIter i = x->second.begin(); i != x->second.end(); )
{
+ safei = i;
+ safei++;
+
if (i->second->Matches(pattern))
{
if (i->second->duration && current > i->second->expiry)
{
/* Expire the line, return nothing */
ExpireLine(x, i);
- return NULL;
+ /* See above */
+ i = safei;
+ continue;
}
else
return i->second;
}
+
+ i = safei;
}
return NULL;
}