diff options
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 23 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 8846b2fbc..7b4fa06bd 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -134,11 +134,13 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src while ((*unparsedmodes) && (*unparsedmodes != ',')) { ModeHandler *mh = ServerInstance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL); - if (mh) - modes += *unparsedmodes; - else + if (!mh) + { + ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Unrecognised mode %c, dropping link", *unparsedmodes); return CMD_INVALID; + } + modes += *unparsedmodes; usr++; unparsedmodes++; } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 0628c900a..15a7898ed 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -415,18 +415,31 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, else { Command* cmd = ServerInstance->Parser->GetHandler(command); - CmdResult res = CMD_INVALID; - if (cmd && params.size() >= cmd->min_params) + + if (!cmd) { - res = cmd->Handle(params, who); + irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); + ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Unrecognised S2S command :%s %s %s", + who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); + SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules"); + } + + if (params.size() < cmd->min_params) + { + irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); + ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Insufficient parameters for S2S command :%s %s %s", + who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); + SendError("Insufficient parameters for command '" + command + "'"); } + CmdResult res = cmd->Handle(params, who); + if (res == CMD_INVALID) { irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); - ServerInstance->Logs->Log("spanningtree", SPARSE, "Invalid S2S command :%s %s %s", + ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Error handling S2S command :%s %s %s", who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); - SendError("Unrecognised or malformed command '" + command + "' -- possibly loaded mismatched modules"); + SendError("Error handling '" + command + "' -- possibly loaded mismatched modules"); } if (res == CMD_SUCCESS) Utils->RouteCommand(route_back_again, command, params, who); |