From 258a481bface1b98f93699d292805c11f0e6d898 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 6 Jun 2014 08:48:50 +0200 Subject: m_spanningtree Forward NICK messages when they cause a collision with the new nick param rewritten to the uuid Suppressing these messages meant that we relied on an appropriate NICK to come from the direction the SAVE was sent to; this left all servers behind us uninformed until the target server of the SAVE reacted with a nick change to uuid. This was problematic because someone can legitimately change nick to the past nick of the SAVEd user on a server that already has the SAVEd user with the uuid nick and that nick change message can reach servers that haven't yet seen the nick change to uuid of the SAVEd user. --- src/modules/m_spanningtree/treesocket2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 5007fe921..a2ae1aad0 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -445,6 +445,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, * On nick messages, check that the nick doesnt already exist here. * If it does, perform collision logic. */ + bool callfnc = true; User* x = ServerInstance->FindNickOnly(params[0]); if ((x) && (x != who)) { @@ -453,15 +454,14 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, collideret = this->DoCollision(x, who->age, who->ident, who->GetIPString(), who->uuid); if (collideret != 1) { - /* - * Remote client lost, or both lost, parsing or passing on this - * nickchange would be pointless, as the incoming client's server will - * soon recieve SVSNICK to change its nick to its UID. :) -- w00t - */ - return; + // Remote client lost, or both lost, rewrite this nick change as a change to uuid before + // forwarding and don't call ForceNickChange() because DoCollision() has done it already + params[0] = who->uuid; + callfnc = false; } } - who->ForceNickChange(params[0].c_str()); + if (callfnc) + who->ForceNickChange(params[0].c_str()); Utils->RouteCommand(route_back_again, command, params, who); } else -- cgit v1.2.3