summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-04-01 01:13:24 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-01 01:13:24 +0200
commitd1a88f0957aeef918af4cea5dcf87892df755130 (patch)
treec08845273deff0f78a424b7867992cca5fbc815c
parent0115c77804a46984c858c61f05dc4228fecc04fc (diff)
m_samode Require an oper privilege to change the user modes of other users
Issue #417
-rw-r--r--docs/conf/opers.conf.example1
-rw-r--r--src/modules/m_samode.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example
index 1e5abefa5..c62de0e55 100644
--- a/docs/conf/opers.conf.example
+++ b/docs/conf/opers.conf.example
@@ -24,6 +24,7 @@
# - servers/auspex: allows opers with this priv to see more detail about server information than normal users.
# ACTIONS:
# - users/mass-message: allows opers with this priv to PRIVMSG and NOTICE to a server mask (e.g. NOTICE $*)
+ # - users/samode-usermodes: allows opers with this priv to change the user modes of any other user using /SAMODE
# - channels/high-join-limit: allows opers with this priv to join <channels:opers> total channels instead of <channels:users> total channels.
# PERMISSIONS:
# - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE)
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 9b71992a6..a7453c233 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -40,6 +40,12 @@ class CommandSamode : public Command
CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
this->active = true;
+ User* target = ServerInstance->FindNick(parameters[0]);
+ if ((target) && (target != user))
+ {
+ if (!user->HasPrivPermission("users/samode-usermodes", true))
+ return CMD_FAILURE;
+ }
ServerInstance->Parser->CallHandler("MODE", parameters, user);
if (ServerInstance->Modes->GetLastParse().length())
ServerInstance->SNO->WriteGlobalSno('a', user->nick + " used SAMODE: " +ServerInstance->Modes->GetLastParse());