From d96b9715d1637f42a5b397e65471cd062b98c88c Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Tue, 12 Nov 2013 11:02:28 -0800 Subject: Disallow remote /MODULES for non-opers. --- src/commands/cmd_modules.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/commands/cmd_modules.cpp') 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&, User *user) +CmdResult CommandModules::Handle (const std::vector& 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) -- cgit v1.2.3