diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_cap.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 9e857ad28..bb5a506c9 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -32,6 +32,14 @@ class Cap::ManagerImpl : public Cap::Manager ExtItem capext; CapMap caps; + static bool CanRequest(LocalUser* user, Ext usercaps, Capability* cap, bool adding) + { + if ((usercaps & cap->GetMask()) == adding) + return true; + + return cap->OnRequest(user, adding); + } + Capability::Bit AllocateBit() const { Capability::Bit used = 0; @@ -118,7 +126,7 @@ class Cap::ManagerImpl : public Cap::Manager capname.erase(capname.begin()); Capability* cap = ManagerImpl::Find(capname); - if (!cap) + if ((!cap) || (!CanRequest(user, usercaps, cap, !remove))) return false; if (remove) |