From 5b138fa099e1c1557362fe72a4b146a0750dde9c Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 7 Dec 2015 10:07:03 +0100 Subject: m_spanningtree Try FindServerID() first if the prefix looks like a sid in TreeSocket::FindSource() --- src/modules/m_spanningtree/treesocket2.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 1f98f7819..2e6961524 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -220,10 +220,20 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma if (prefix.empty()) return MyRoot->ServerUser; - // If the prefix string is a uuid or a sid FindUUID() returns the appropriate User object - User* who = ServerInstance->FindUUID(prefix); - if (who) - return who; + if (prefix.size() == 3) + { + // Prefix looks like a sid + TreeServer* server = Utils->FindServerID(prefix); + if (server) + return server->ServerUser; + } + else + { + // If the prefix string is a uuid FindUUID() returns the appropriate User object + User* user = ServerInstance->FindUUID(prefix); + if (user) + return user; + } // Some implementations wrongly send a server name as prefix occasionally, handle that too for now TreeServer* const server = Utils->FindServer(prefix); @@ -243,9 +253,9 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma * command came from a server to avoid desync. */ - who = ServerInstance->FindUUID(prefix.substr(0, 3)); - if (who) - return who; + TreeServer* const usersserver = Utils->FindServerID(prefix.substr(0, 3)); + if (usersserver) + return usersserver->ServerUser; return this->MyRoot->ServerUser; } -- cgit v1.2.3