diff options
| author | 2010-02-15 03:02:39 +0000 | |
|---|---|---|
| committer | 2010-02-15 03:02:39 +0000 | |
| commit | ace6e82aa9ad64fb77c01272c553667360ffda4e (patch) | |
| tree | 5e238cd92761c40e33fda02fe8418923e7a4d921 | |
| parent | Call OnClose() before changing link state to DYING to clean up introduced ser... (diff) | |
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
| -rw-r--r-- | src/modules/m_spanningtree/server.cpp | 7 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index fcf3bbfa0..c75298bad 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -264,6 +264,13 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) this->SendCapabilities(); this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); // move to the next state, we are now waiting for THEM. + + Link* lnk = Utils->FindLink(InboundServerName); + + TreeServer* Node = new TreeServer(this->Utils, this->ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + + Utils->TreeRoot->AddChild(Node); + Node->bursting = true; this->LinkState = WAIT_AUTH_2; return true; } 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. |
