From ace6e82aa9ad64fb77c01272c553667360ffda4e Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 15 Feb 2010 03:02:39 +0000 Subject: Fix race where two servers with the same name can enter WAIT_AUTH_2 and cause a double-free crash git-svn-id: http://svn.inspircd.org/repository/branches/1_2_stable@12461 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket2.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/modules/m_spanningtree/treesocket2.cpp') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 713f5d108..4e7d4da47 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -96,8 +96,6 @@ bool TreeSocket::ProcessLine(std::string &line) switch (this->LinkState) { - TreeServer* Node; - case DYING: return false; case WAIT_AUTH_1: @@ -179,12 +177,8 @@ bool TreeSocket::ProcessLine(std::string &line) this->LinkState = CONNECTED; Utils->timeoutlist.erase(this); + TreeServer *Node = Utils->FindServer(InboundServerName); - Link* lnk = Utils->FindLink(InboundServerName); - - Node = new TreeServer(this->Utils, this->ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); - - Utils->TreeRoot->AddChild(Node); parameterlist sparams; sparams.push_back(InboundServerName); sparams.push_back("*"); @@ -193,7 +187,6 @@ bool TreeSocket::ProcessLine(std::string &line) sparams.push_back(":"+InboundDescription); Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",sparams,InboundServerName); Utils->DoOneToAllButSenderRaw(line, InboundServerName, prefix, command, params); - Node->bursting = true; this->DoBurst(Node); } else if (command == "ERROR") @@ -619,7 +612,7 @@ void TreeSocket::OnTimeout() void TreeSocket::OnClose() { // Test fix for big fuckup - if (this->LinkState != CONNECTED) + if (this->LinkState != CONNECTED && this->LinkState != WAIT_AUTH_2) return; // Connection closed. -- cgit v1.3.1-10-gc9f91