diff options
Diffstat (limited to 'src/modules')
-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(); |