1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 05:16:38 +02:00

Fix access dup check to account for accounts

This commit is contained in:
Adam
2014-11-15 02:13:10 -05:00
parent 8a7793da0c
commit c9008cdafa
3 changed files with 10 additions and 6 deletions
+4 -2
View File
@@ -122,6 +122,7 @@ class CommandCSAccess : public Command
tmp_access.level = level;
bool override = false;
const NickAlias *na = NULL;
if ((!highest || *highest <= tmp_access) && !u_access.founder)
{
@@ -158,7 +159,8 @@ class CommandCSAccess : public Command
}
else
{
const NickAlias *na = NickAlias::Find(mask);
na = NickAlias::Find(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -183,7 +185,7 @@ class CommandCSAccess : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
const ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->Mask()))
if ((na && na->nc == access->GetAccount()) || mask.equals_ci(access->Mask()))
{
/* Don't allow lowering from a level >= u_level */
if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify"))
+3 -2
View File
@@ -88,6 +88,7 @@ class CommandCSFlags : public Command
AccessGroup u_access = source.AccessFor(ci);
const ChanAccess *highest = u_access.Highest();
const NickAlias *na = NULL;
if (IRCD->IsChannelValid(mask))
{
@@ -113,7 +114,7 @@ class CommandCSFlags : public Command
}
else
{
const NickAlias *na = NickAlias::Find(mask);
na = NickAlias::Find(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -142,7 +143,7 @@ class CommandCSFlags : public Command
for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx)
{
ChanAccess *access = ci->GetAccess(current_idx - 1);
if (mask.equals_ci(access->Mask()))
if ((na && na->nc == access->GetAccount()) || mask.equals_ci(access->Mask()))
{
// Flags allows removing others that have the same access as you,
// but no other access system does.
+3 -2
View File
@@ -120,6 +120,7 @@ class CommandCSXOP : public Command
AccessGroup access = source.AccessFor(ci);
const ChanAccess *highest = access.Highest();
bool override = false;
const NickAlias *na = NULL;
std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccess::DetermineLevel(highest)) : order.end();
@@ -159,7 +160,7 @@ class CommandCSXOP : public Command
}
else
{
const NickAlias *na = NickAlias::Find(mask);
na = NickAlias::Find(mask);
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
@@ -185,7 +186,7 @@ class CommandCSXOP : public Command
{
const ChanAccess *a = ci->GetAccess(i);
if (a->Mask().equals_ci(mask))
if ((na && na->nc == a->GetAccount()) || mask.equals_ci(a->Mask()))
{
if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify"))
{