summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-05-05 22:26:41 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-05-05 22:26:41 +0000
commitdc102049b0e91c5aa730f067c26e33f3e138386d (patch)
treeb8b4b04d3996becc48e67b6fc1f0a87fdb5ce6f7 /src/commands.c
parent845b15ddd99d5b6fde905045595e9d70f7a1c6f2 (diff)
Adds check for opertype permissions to mod_run_cmd() in commands.c, and adds optional parameter to Command class constructor that takes the opertype permissions for the command.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2292 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c
index 5f9c682ab..a95a9f7b2 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -88,6 +88,17 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
// Check whether or not access string is empty
}
+ if (!c->permission.empty())
+ {
+ if (!u->nc->HasPriv(c->permission) && !u->nc->HasCommand(c->permission))
+ {
+ notice_lang(service, u, ACCESS_DENIED);
+ alog("Access denied for user %s with service %s and command %s", u->nick, service, cmd);
+ return;
+ }
+
+ }
+
std::vector<std::string> params;
std::string curparam;
char *s = NULL;