diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-03-06 12:24:36 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-03-06 12:24:36 +0100 |
commit | 9b5a2903faf5cfa9474d53f30da054f9c4a1eb8e (patch) | |
tree | 8ba447b7bd57bed5fb9e7ca1570006302c635d3a | |
parent | 1abb1488b7a81f7bc6f8dfcbdc6108915dd5b142 (diff) |
Update detection in module loading commands that relied on old command module names
-rw-r--r-- | src/coremods/core_loadmodule.cpp | 6 | ||||
-rw-r--r-- | src/coremods/core_reloadmodule.cpp | 6 | ||||
-rw-r--r-- | 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<std::string>& 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<void, bool> CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& 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<std::string> ¶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; |