diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 21:31:24 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 21:31:24 +0000 |
commit | 87f6079b5ca4038201319ad0a6241dc2f2cb310e (patch) | |
tree | 590c9a8cde45989b335a8de7b43d6222a02f7f3d /src | |
parent | 41026088e7c894bdbdd8cd6bdcb16bd0f8cb5e7f (diff) |
Well, this probably works. But it might not. :D.
- If a server is introduced with an already-existing SID, kill it off the network.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7921 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 3418dd837..fefd25b2a 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -800,7 +800,20 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> return false; } Link* lnk = Utils->FindLink(servername); - TreeServer* Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); + + TreeServer *Node; + + try + { + Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); + } + catch (CoreException &e) + { + this->SendError("Server ID "+sid+" already exists on the network!"); + this->Instance->SNO->WriteToSnoMask('l',"Server \2"+servername+"\2 being introduced from \2" + prefix + "\2 denied, server ID already exists on the network. Closing link with " + prefix); + return false; + } + ParentOfThis->AddChild(Node); params[4] = ":" + params[4]; Utils->SetRemoteBursting(Node, true); @@ -872,7 +885,19 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) // we should add the details of this server now // to the servers tree, as a child of the root // node. - TreeServer* Node = new TreeServer(this->Utils, this->Instance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); + + TreeServer *Node; + + try + { + Node = new TreeServer(this->Utils, this->Instance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); + } + catch (CoreException &e) + { + this->SendError("Server ID "+sid+" already exists on the network!"); + this->Instance->SNO->WriteToSnoMask('l',"Server \2"+assign(servername)+"\2 being introduced denied, server ID already exists on the network. Closing link."); + return false; + } Utils->TreeRoot->AddChild(Node); params[4] = ":" + params[4]; Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,sname); @@ -1074,7 +1099,16 @@ bool TreeSocket::ProcessLine(std::string &line) } this->LinkState = CONNECTED; Link* lnk = Utils->FindLink(InboundServerName); - Node = new TreeServer(this->Utils,this->Instance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + try + { + Node = new TreeServer(this->Utils,this->Instance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + } + catch (CoreException &e) + { + this->SendError("Server ID "+InboundSID+" already exists on the network!"); + this->Instance->SNO->WriteToSnoMask('l',"Server \2"+InboundServerName+"\2 being introduced from \2" + prefix + "\2 denied, server ID already exists on the network. Closing link."); + return false; + } Utils->DelBurstingServer(this); Utils->TreeRoot->AddChild(Node); params.clear(); |