summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-04-07 14:39:25 -0400
committerAdam <Adam@anope.org>2017-04-07 14:39:25 -0400
commitc2c8f703b44f7712ea308d8f1f3a4e8c9bcb30c7 (patch)
tree6d5d9da63198b08a8a1bffecd74540192ede137c
parentaf48ee6c87ab10a7ffe25d93e2bca688a0c656b0 (diff)
parentdba19d839af717a697ed54ed5da9c27aef76052a (diff)
Merge commit 'dba19d839af717a697ed54ed5da9c27aef76052a'
-rw-r--r--include/accessgroup.h4
-rw-r--r--modules/chanserv/access.cpp13
-rw-r--r--src/accessgroup.cpp4
3 files changed, 17 insertions, 4 deletions
diff --git a/include/accessgroup.h b/include/accessgroup.h
index bc7e84089..ff4376da7 100644
--- a/include/accessgroup.h
+++ b/include/accessgroup.h
@@ -50,7 +50,7 @@ class CoreExport AccessGroup : public std::vector<ChanAccess *>
* with the highest rank (see Privilege::rank).
* @return The "highest" entry
*/
- ChanAccess *Highest();
+ ChanAccess *Highest() const;
/* Comparison operators to other AccessGroups */
bool operator>(AccessGroup &other);
@@ -59,4 +59,4 @@ class CoreExport AccessGroup : public std::vector<ChanAccess *>
bool operator<=(AccessGroup &other);
};
-} // namespace ChanServ \ No newline at end of file
+} // namespace ChanServ
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 8342e5973..70db18fad 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -899,6 +899,19 @@ class CSAccess : public Module
{
if (group->ci == NULL)
return EVENT_CONTINUE;
+
+ const ChanServ::ChanAccess *highest = group->Highest();
+ if (highest && highest->provider == &accesschanaccesstype)
+ {
+ /* Access is the only access provider with the concept of negative access,
+ * so check they don't have negative access
+ */
+ const AccessChanAccess *aca = anope_dynamic_static_cast<const AccessChanAccess *>(highest);
+
+ if (aca->GetLevel() < 0)
+ return EVENT_CONTINUE;
+ }
+
/* Special case. Allows a level of -1 to match anyone, and a level of 0 to match anyone identified. */
int16_t level = group->ci->GetLevel(priv);
if (level == -1)
diff --git a/src/accessgroup.cpp b/src/accessgroup.cpp
index a674f4723..a143bede1 100644
--- a/src/accessgroup.cpp
+++ b/src/accessgroup.cpp
@@ -53,7 +53,7 @@ bool AccessGroup::HasPriv(const Anope::string &priv)
return false;
}
-ChanAccess *AccessGroup::Highest()
+ChanAccess *AccessGroup::Highest() const
{
ChanAccess *highest = NULL;
for (unsigned i = 0; i < this->size(); ++i)
@@ -122,4 +122,4 @@ bool AccessGroup::operator>=(AccessGroup &other)
bool AccessGroup::operator<=(AccessGroup &other)
{
return !(*this > other);
-} \ No newline at end of file
+}