From c41c82857464c34c61e6f2cf1939cea866f7d49a Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 30 Nov 2010 14:00:15 -0500 Subject: [PATCH] Do not use wildcard matching when looking up hosts on access add/del --- include/regchannel.h | 3 ++- modules/core/cs_access.cpp | 6 +++--- modules/core/cs_xop.cpp | 4 ++-- src/regchannel.cpp | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/regchannel.h b/include/regchannel.h index 71deb1ce7..b051af81a 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -175,11 +175,12 @@ class CoreExport ChannelInfo : public Extensible, public FlagsGetAccess(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) diff --git a/modules/core/cs_xop.cpp b/modules/core/cs_xop.cpp index f883d1baa..1d1ec7c84 100644 --- a/modules/core/cs_xop.cpp +++ b/modules/core/cs_xop.cpp @@ -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) diff --git a/src/regchannel.cpp b/src/regchannel.cpp index d5afbfbcf..e89bbee5c 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -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; }