From 3e9bd7583c555a23cb4d5b8f91966d0048953e58 Mon Sep 17 00:00:00 2001 From: rburchell Date: Thu, 16 Apr 2009 20:29:21 +0000 Subject: Check Command::permission in command handler. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2283 5417fbe8-f217-4b02-8779-1006273d7864 --- src/commands.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/commands.c b/src/commands.c index f6c2594af..5f9c682ab 100644 --- a/src/commands.c +++ b/src/commands.c @@ -146,6 +146,13 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * } } + // If the command requires a permission, and they aren't registered or don't have the required perm, DENIED + if (!c->permission.empty() && (!u->nc || !u->nc->HasCommand(c->permission))) + { + notice_lang(service, u, ACCESS_DENIED); + return; + } + retVal = c->Execute(u, params); FOREACH_MOD(I_OnPostCommand, OnPostCommand(u, c->service, c->name, params)); -- cgit