diff options
author | Daniel Vassdal <shutter@canternet.org> | 2013-11-12 11:02:28 -0800 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-11-21 20:33:16 +0100 |
commit | d96b9715d1637f42a5b397e65471cd062b98c88c (patch) | |
tree | 2ec0452a2ddf729feb7f355a43e56655092a619b /src/commands/cmd_modules.cpp | |
parent | 2eed59bea6f6e42c77ffd7e6061570c13f172e21 (diff) |
Disallow remote /MODULES for non-opers.
Diffstat (limited to 'src/commands/cmd_modules.cpp')
-rw-r--r-- | src/commands/cmd_modules.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index c37008563..fe199e7a4 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -49,8 +49,24 @@ class CommandModules : public Command /** Handle /MODULES */ -CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user) +CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, User *user) { + // Don't ask remote servers about their modules unless the local user asking is an oper + // 2.0 asks anyway, so let's handle that the same way + bool for_us = (parameters.empty() || parameters[0] == ServerInstance->Config->ServerName); + if ((!for_us) || (!IS_LOCAL(user))) + { + if (!user->IsOper()) + { + user->WriteNotice("*** You cannot check what modules other servers have loaded."); + return CMD_FAILURE; + } + + // From an oper and not for us, forward + if (!for_us) + return CMD_SUCCESS; + } + const ModuleManager::ModuleMap& mods = ServerInstance->Modules->GetModules(); for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i) |