From 17cd4ada26f5a7545396531feec10ed490307dd6 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 11 Jun 2014 15:13:58 +0200 Subject: m_spanningtree Strip membership id from KICKs sent to 1202 protocol servers --- src/modules/m_spanningtree/compat.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index cb3af8a26..9d3c52bd2 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -226,6 +226,24 @@ void TreeSocket::WriteLine(const std::string& original_line) line.erase(colon); } } + else if (command == "KICK") + { + // Strip membership id if the KICK has one + if (b == std::string::npos) + return; + + std::string::size_type c = line.find(' ', b + 1); + if (c == std::string::npos) + return; + + std::string::size_type d = line.find(' ', c + 1); + if ((d < line.size()-1) && (original_line[d+1] != ':')) + { + // There is a third parameter which doesn't begin with a colon, erase it + std::string::size_type e = line.find(' ', d + 1); + line.erase(d, e-d); + } + } } ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); -- cgit v1.2.3