1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 13:23:14 +02:00

Do not use wildcard matching when looking up hosts on access add/del

This commit is contained in:
Adam
2010-11-30 14:00:15 -05:00
parent 5fe41fb8a0
commit c41c828574
4 changed files with 10 additions and 8 deletions
+2 -1
View File
@@ -175,11 +175,12 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @param wildcard True to match using wildcards
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0);
ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0, bool wildcard = true);
/** Get the size of the accss vector for this channel
* @return The access vector size
+3 -3
View File
@@ -202,7 +202,7 @@ class CommandCSAccess : public Command
return MOD_CONT;
}
ChanAccess *access = ci->GetAccess(mask);
ChanAccess *access = ci->GetAccess(mask, 0, false);
if (access)
{
/* Don't allow lowering from a level >= u_level */
@@ -220,7 +220,7 @@ class CommandCSAccess : public Command
FOREACH_MOD(I_OnAccessChange, OnAccessChange(ci, u, access));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << na->nick << " (level: " << level << ") as level " << u_level;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask << " (level: " << level << ") as level " << u_level;
source.Reply(CHAN_ACCESS_LEVEL_CHANGED, access->mask.c_str(), ci->name.c_str(), level);
return MOD_CONT;
}
@@ -257,7 +257,7 @@ class CommandCSAccess : public Command
}
else
{
ChanAccess *access = ci->GetAccess(mask);
ChanAccess *access = ci->GetAccess(mask, 0, false);
ChanAccess *u_access = ci->GetAccess(u);
int16 u_level = u_access ? u_access->level : 0;
if (!access)
+2 -2
View File
@@ -227,7 +227,7 @@ class XOPBase : public Command
return MOD_CONT;
}
access = ci->GetAccess(mask);
access = ci->GetAccess(mask, 0, false);
if (access)
{
/**
@@ -307,7 +307,7 @@ class XOPBase : public Command
return MOD_CONT;
}
access = ci->GetAccess(mask);
access = ci->GetAccess(mask, 0, false);
/* Special case: is it a number/list? Only do search if it isn't. */
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
+3 -2
View File
@@ -278,14 +278,15 @@ ChanAccess *ChannelInfo::GetAccess(NickCore *nc, int16 level)
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @param wildcard True to match using wildcards
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
ChanAccess *ChannelInfo::GetAccess(const Anope::string &mask, int16 level)
ChanAccess *ChannelInfo::GetAccess(const Anope::string &mask, int16 level, bool wildcard)
{
for (unsigned i = 0, end = this->access.size(); i < end; ++i)
if (Anope::Match(this->access[i]->mask, mask))
if (wildcard ? Anope::Match(this->access[i]->mask, mask) : this->access[i]->mask.equals_ci(mask))
return this->access[i];
return NULL;
}