]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket2.cpp
m_connectban Switch to OnSetUserIP hook to handle cgiirc users properly, ignore e...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
index e93dece5f6c12b0de74b6072bdd0ae47feb4c37b..04ca9edb145f072e036dc74b7eadefb5e510672e 100644 (file)
@@ -244,9 +244,25 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                         * 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 '%s' from unknown prefix '%s'! Dropping entire command.",
-                               command.c_str(), prefix.c_str());
-                       return;
+
+                       if ((prefix.length() == UUID_LENGTH-1) && (isdigit(prefix[0])) &&
+                               ((command == "FMODE") || (command == "MODE") || (command == "KICK") || (command == "TOPIC") || (command == "KILL") || (command == "ADDLINE") || (command == "DELLINE")))
+                       {
+                               /* Special case, we cannot drop these commands as they've been committed already on a
+                                * part of the network by the time we receive them, so in this scenario pretend the
+                                * command came from a server to avoid desync.
+                                */
+
+                               who = ServerInstance->FindUUID(prefix.substr(0, 3));
+                               if (!who)
+                                       who = this->MyRoot->ServerUser;
+                       }
+                       else
+                       {
+                               ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.",
+                                       command.c_str(), prefix.c_str());
+                               return;
+                       }
                }
        }
 
@@ -458,6 +474,14 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                        return;
                }
 
+               if ((!params.empty()) && (params.back().empty()) && (!cmd->allow_empty_last_param))
+               {
+                       // the last param is empty and the command handler doesn't allow that, check if there will be enough params if we drop the last
+                       if (params.size()-1 < cmd->min_params)
+                               return;
+                       params.pop_back();
+               }
+
                CmdResult res = cmd->Handle(params, who);
 
                if (res == CMD_INVALID)