From 589ef7e89e7439feeb5f0abdbed3deaef2acb298 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 5 Apr 2008 01:05:32 +0000 Subject: Fix crash in MODE when sent for a user, with only one parameter (which is wrong, anyway) - Also fix bad output in protocol interface when sending MODE for a user from a server origin git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9346 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/protocolinterface.cpp | 12 +++++++++++- src/modules/m_spanningtree/treesocket2.cpp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index f204c15ed..a31675ad6 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -49,14 +49,24 @@ void SpanningTreeProtocolInterface::SendMode(const std::string &target, paramete if (modedata.empty()) return; + std::string outdata; + /* Warning: in-place translation is only safe for type TR_NICK */ for (size_t n = 0; n < modedata.size(); n++) - ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], modedata[n]); + { + ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], outdata); + modedata[n] = outdata; + } std::string uidtarget; ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget); modedata.insert(modedata.begin(), uidtarget); + for (size_t n = 0; n < modedata.size(); n++) + { + ServerInstance->Logs->Log("m_spanningtree", DEBUG, "modedata[%d]=\"%s\"", n, modedata[n].c_str()); + } + User* a = ServerInstance->FindNick(uidtarget); if (a) { diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4b4ba65f0..0483fa8e2 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -540,7 +540,7 @@ bool TreeSocket::ProcessLine(std::string &line) /* We don't support this for channel mode changes any more! */ if (params.size() >= 1) { - if (Instance->FindChan(params[1])) + if (Instance->FindChan(params[0])) { this->SendError("Protocol violation by '"+prefix+"'! MODE for channel mode changes is not supported by the InspIRCd 1.2 protocol. You must use FMODE to preserve channel timestamps."); return false; -- cgit v1.2.3