mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 19:49:02 -04:00
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
This commit is contained in:
parent
dccee96be2
commit
a0defce6dc
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user