From 2a88309abe3f5757b7638e32d44bc89b7d4f5b0e Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 30 Sep 2008 22:21:34 +0000 Subject: Some suggestions from jilles about handling unknown prefix errors, and some ideas of my own about handling unknown modes in client introduction to prevent leaving a desynched user on the source server git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10613 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket2.cpp | 12 ++++++++---- src/modules/m_spanningtree/uid.cpp | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 7e5c7fad5..e27c1d879 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -534,13 +534,17 @@ bool TreeSocket::ProcessLine(std::string &line) * Not a special s2s command. Emulate the user doing it. * This saves us having a huge ugly command parser again. */ - User *who = this->ServerInstance->FindUUID(prefix); + User* who = this->ServerInstance->FindUUID(prefix); if (!who) { - // this looks ugly because command is an irc::string - this->SendError("Command (" + std::string(command.c_str()) + ") from unknown prefix (" + prefix + ")! Dropping link."); - return false; + /* this looks ugly because command is an irc::string + * It is important that we dont close the link here, unknown prefix can occur + * due to various race conditions such as the KILL message for a user somehow + * crossing the users QUIT further upstream from the server. Thanks jilles! + */ + ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Command " + std::string(command.c_str()) + " from unknown prefix " + prefix + "! Dropping entire command."); + return true; } if (command == "NICK") diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 3cc4c9618..682b4d29a 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -120,7 +120,12 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque &pa if (paramptr < params.size() - 1) mh->OnModeChange(_new, _new, NULL, params[paramptr++], true); else - ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, expected a parameter for user mode '%c' but there aren't enough parameters in the command!", *v); + { + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" KILL "+params[0]+" :Broken UID command, expected a parameter for user mode '"+(*v)+"' but there aren't enough parameters in the command!"); + this->ServerInstance->Users->clientlist->erase(params[0]); + delete _new; + return true; + } } else mh->OnModeChange(_new, _new, NULL, empty, true); @@ -128,7 +133,12 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque &pa mh->ChangeCount(1); } else - ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, unknown user mode '%c' in the mode string!", *v); + { + this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" KILL "+params[0]+" :Warning: Broken UID command, unknown user mode '"+(*v)+"' in the mode string!"); + this->ServerInstance->Users->clientlist->erase(params[0]); + delete _new; + return true; + } } //_new->ProcessNoticeMasks(params[7].c_str()); -- cgit v1.2.3