summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-05-07 23:59:11 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-05-07 23:59:11 +0000
commitfeab2cb85494c62131b936705f0eaad9f4c43b14 (patch)
tree3f66f32ea274d47b42fa4510a972ef8ab08031fc /src
parent2d050edb4efef96443b8a5f788096477366141b7 (diff)
Move where command permission checking is done, patch by Adam.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2296 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/commands.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/commands.c b/src/commands.c
index a95a9f7b2..344805f9a 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -88,17 +88,6 @@ 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;
@@ -158,10 +147,15 @@ 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)))
+ if (!c->permission.empty())
{
- notice_lang(service, u, ACCESS_DENIED);
- return;
+ 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;
+ }
+
}
retVal = c->Execute(u, params);