From 9b5a2903faf5cfa9474d53f30da054f9c4a1eb8e Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 6 Mar 2014 12:24:36 +0100 Subject: Update detection in module loading commands that relied on old command module names --- src/coremods/core_loadmodule.cpp | 6 +++--- src/coremods/core_reloadmodule.cpp | 6 +++--- src/modules/m_globalload.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coremods/core_loadmodule.cpp b/src/coremods/core_loadmodule.cpp index 4ee5da1ec..1d49d89d0 100644 --- a/src/coremods/core_loadmodule.cpp +++ b/src/coremods/core_loadmodule.cpp @@ -78,19 +78,19 @@ class CommandUnloadmodule : public Command CmdResult CommandUnloadmodule::Handle(const std::vector& parameters, User* user) { if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") && - InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map)) + InspIRCd::Match(parameters[0], "core_*.so", ascii_case_insensitive_map)) { user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload core commands!", parameters[0].c_str()); return CMD_FAILURE; } - if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so") + Module* m = ServerInstance->Modules->Find(parameters[0]); + if (m == creator) { user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload module loading commands!", parameters[0].c_str()); return CMD_FAILURE; } - Module* m = ServerInstance->Modules->Find(parameters[0]); if (m && ServerInstance->Modules->Unload(m)) { ServerInstance->SNO->WriteGlobalSno('a', "MODULE UNLOADED: %s unloaded %s", user->nick.c_str(), parameters[0].c_str()); diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index 765c465fd..1561131dc 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -55,14 +55,14 @@ class ReloadModuleWorker : public HandlerBase1 CmdResult CommandReloadmodule::Handle (const std::vector& parameters, User *user) { - if (parameters[0] == "cmd_reloadmodule.so") + Module* m = ServerInstance->Modules->Find(parameters[0]); + if (m == creator) { - user->WriteNumeric(RPL_LOADEDMODULE, "%s :You cannot reload cmd_reloadmodule.so (unload and load it)", + user->WriteNumeric(RPL_LOADEDMODULE, "%s :You cannot reload core_reloadmodule.so (unload and load it)", parameters[0].c_str()); return CMD_FAILURE; } - Module* m = ServerInstance->Modules->Find(parameters[0]); if (m) { ServerInstance->Modules->Reload(m, new ReloadModuleWorker(user->uuid, parameters[0])); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index eda654423..b3c664cf1 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -77,7 +77,7 @@ class CommandGunloadmodule : public Command CmdResult Handle (const std::vector ¶meters, User *user) { if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") && - InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map)) + InspIRCd::Match(parameters[0], "core_*.so", ascii_case_insensitive_map)) { user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload core commands!", parameters[0].c_str()); return CMD_FAILURE; -- cgit v1.2.3