diff options
author | Peter Powell <petpow@saberuk.com> | 2013-04-07 17:02:37 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-04-13 16:01:42 +0100 |
commit | b331d0549be435d77ceb52aee4a58ee4aa40ec7d (patch) | |
tree | c7c7c4cdf38d1c69828a8ed9c022851f75b44936 /src/commands/cmd_unloadmodule.cpp | |
parent | 1626437cbf963b16ce44ef6cc829957fd3a7e2ff (diff) |
Add <security:allowcoreunload>.
When enabled (the default) this setting prevents the unloading of
core modules such as cmd_privmsg.
Diffstat (limited to 'src/commands/cmd_unloadmodule.cpp')
-rw-r--r-- | src/commands/cmd_unloadmodule.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp index 6d0f5f41c..29f454987 100644 --- a/src/commands/cmd_unloadmodule.cpp +++ b/src/commands/cmd_unloadmodule.cpp @@ -42,12 +42,19 @@ class CommandUnloadmodule : public Command CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user) { + if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") && + InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map)) + { + user->WriteNumeric(972, "%s %s :You cannot unload core commands!", user->nick.c_str(), parameters[0].c_str()); + return CMD_FAILURE; + } + if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so") { user->WriteNumeric(972, "%s %s :You cannot unload module loading commands!", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } - + Module* m = ServerInstance->Modules->Find(parameters[0]); if (m && ServerInstance->Modules->Unload(m)) { |