1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 08:23:13 +02:00

Add opertype access checks to OS QUIT, OS RESTART, and OS SHUTDOWN, patch from Adam.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2191 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2009-03-23 00:55:22 +00:00
parent 5b988a5e17
commit a9ced70eed
3 changed files with 18 additions and 3 deletions
+6 -1
View File
@@ -26,6 +26,11 @@ class CommandOSQuit : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
if (!u->nc->HasCommand("operserv/quit")) {
notice_lang(s_OperServ, u, PERMISSION_DENIED);
return MOD_STOP;
}
quitmsg = new char[28 + strlen(u->nick)];
if (!quitmsg)
quitmsg = "QUIT command received, but out of memory!";
@@ -40,7 +45,7 @@ class CommandOSQuit : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
if (!is_services_root(u))
if (!u->nc->HasCommand("operserv/quit"))
return false;
notice_help(s_OperServ, u, OPER_HELP_QUIT);
+6 -1
View File
@@ -26,6 +26,11 @@ class CommandOSRestart : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
if (!u->nc->HasCommand("operserv/restart")) {
notice_lang(s_OperServ, u, PERMISSION_DENIED);
return MOD_STOP;
}
#ifdef SERVICES_BIN
quitmsg = new char[31 + strlen(u->nick)];
if (!quitmsg)
@@ -45,7 +50,7 @@ class CommandOSRestart : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
if (!is_services_root(u))
if (!u->nc->HasCommand("operserv/restart"))
return false;
notice_help(s_OperServ, u, OPER_HELP_RESTART);
+6 -1
View File
@@ -26,6 +26,11 @@ class CommandOSShutdown : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
if (!u->nc->HasCommand("operserv/shutdown")) {
notice_lang(s_OperServ, u, PERMISSION_DENIED);
return MOD_STOP;
}
quitmsg = new char[32 + strlen(u->nick)];
if (!quitmsg)
quitmsg = "SHUTDOWN command received, but out of memory!";
@@ -41,7 +46,7 @@ class CommandOSShutdown : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
if (!is_services_root(u))
if (!u->nc->HasCommand("operserv/shutdown"))
return false;
notice_help(s_OperServ, u, OPER_HELP_SHUTDOWN);