diff options
| author | 2021-11-20 20:53:51 +0000 | |
|---|---|---|
| committer | 2021-11-20 20:57:09 +0000 | |
| commit | fcd1e3a9d6ac00ff8740253a2f1e5bbab538efee (patch) | |
| tree | 4110d6f91a500ecd0f7533c8537a772cef65cf93 /src | |
| parent | Move the websocket protocol name instead of copying it. (diff) | |
| download | inspircd++-fcd1e3a9d6ac00ff8740253a2f1e5bbab538efee.tar.gz inspircd++-fcd1e3a9d6ac00ff8740253a2f1e5bbab538efee.tar.bz2 inspircd++-fcd1e3a9d6ac00ff8740253a2f1e5bbab538efee.zip | |
Don't allow routing INFO to remote servers.
There's no reason to request this for a remote server. It rarely
differs between InspIRCd versions and neither Anope nor Atheme
implement handlers for it.
We don't need to implement anything to the protocol compat layer
for this as if v3 servers send an INFO request to a v4 server they
they will just be ignored as the command has no HandleRemote impl.
Closes #1943.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coremods/core_info/cmd_info.cpp | 18 | ||||
| -rw-r--r-- | src/coremods/core_info/core_info.h | 4 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/coremods/core_info/cmd_info.cpp b/src/coremods/core_info/cmd_info.cpp index 11a71c26f..1e2ca6ce0 100644 --- a/src/coremods/core_info/cmd_info.cpp +++ b/src/coremods/core_info/cmd_info.cpp @@ -27,10 +27,9 @@ #include "core_info.h" CommandInfo::CommandInfo(Module* parent) - : ServerTargetCommand(parent, "INFO") + : SplitCommand(parent, "INFO") { - Penalty = 4; - syntax = { "[<servername>]" }; + Penalty = 3; } static const char* const lines[] = { @@ -77,18 +76,13 @@ static const char* const lines[] = { " jwheare prawnsalad", " ", " Best experienced with \002an IRC client\002", - NULL + nullptr }; -CmdResult CommandInfo::Handle(User* user, const Params& parameters) +CmdResult CommandInfo::HandleLocal(LocalUser* user, const Params& parameters) { - if (parameters.size() > 0 && !irc::equals(parameters[0], ServerInstance->Config->ServerName)) - return CmdResult::SUCCESS; - - int i=0; - while (lines[i]) - user->WriteRemoteNumeric(RPL_INFO, lines[i++]); - + for (size_t idx = 0; lines[idx]; ++idx) + user->WriteRemoteNumeric(RPL_INFO, lines[idx]); user->WriteRemoteNumeric(RPL_ENDOFINFO, "End of /INFO list"); return CmdResult::SUCCESS; } diff --git a/src/coremods/core_info/core_info.h b/src/coremods/core_info/core_info.h index 8bc19b16d..dddc55f62 100644 --- a/src/coremods/core_info/core_info.h +++ b/src/coremods/core_info/core_info.h @@ -97,11 +97,11 @@ class CommandCommands final }; class CommandInfo final - : public ServerTargetCommand + : public SplitCommand { public: CommandInfo(Module* parent); - CmdResult Handle(User* user, const Params& parameters) override; + CmdResult HandleLocal(LocalUser* user, const Params& parameters) override; }; class CommandModules final |
