]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/compat.cpp
Split servers if they try to send infinite garbage without a newline
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / compat.cpp
index 22155fd2ca3e829e0d8ec590d8f90e4336cd1f2b..73b7ccb621d972d325297697c224f48437012412 100644 (file)
@@ -153,7 +153,7 @@ void TreeSocket::WriteLine(std::string line)
                                if (c == std::string::npos)
                                        return;
                                std::string::size_type d = line.find(' ', c + 1);
-                               std::string subcmd = line.substr(c, d - c);
+                               std::string subcmd = line.substr(c + 1, d - c - 1);
                                Command* thiscmd = ServerInstance->Parser->GetHandler(subcmd);
                                if (thiscmd)
                                {
@@ -164,6 +164,16 @@ void TreeSocket::WriteLine(std::string line)
                                                        subcmd.c_str());
                                                line.erase(a, c-a);
                                        }
+                                       if (subcmd == "CHGIDENT" && d != std::string::npos)
+                                       {
+                                               std::string::size_type e = line.find(' ', d + 1);
+                                               if (e == std::string::npos)
+                                                       return; // not valid
+                                               std::string target = line.substr(d + 1, e - d - 1);
+
+                                               ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Forging acceptance of CHGIDENT from 1201-protocol server");
+                                               recvq.insert(0, ":" + target + " FIDENT " + line.substr(e) + "\n");
+                                       }
                                }
                        }
                }