diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 22:08:34 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 22:08:34 +0000 |
commit | f8e460b127b3d8f57e42276016dc94dd5d4ecf82 (patch) | |
tree | 5cc59b0b1d59a4f2efec731844ee07e2e864c863 /src/modules/m_spanningtree | |
parent | 81007f78935f9c39930c94acec00afb4271b0dfe (diff) |
Fix to use DuplicateID. This stops things segfaulting on duplicate SID introduction, which is, of course, bad.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7923 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index fefd25b2a..4d62c3b83 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -801,13 +801,9 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> } Link* lnk = Utils->FindLink(servername); - TreeServer *Node; + TreeServer *Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); - try - { - Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); - } - catch (CoreException &e) + if (Node->DuplicateID()) { 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); @@ -886,18 +882,15 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms) // to the servers tree, as a child of the root // node. - TreeServer *Node; + TreeServer *Node = new TreeServer(this->Utils, this->Instance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); - try - { - Node = new TreeServer(this->Utils, this->Instance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); - } - catch (CoreException &e) + if (Node->DuplicateID()) { 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); @@ -1099,11 +1092,10 @@ bool TreeSocket::ProcessLine(std::string &line) } this->LinkState = CONNECTED; Link* lnk = Utils->FindLink(InboundServerName); - try - { - Node = new TreeServer(this->Utils,this->Instance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); - } - catch (CoreException &e) + + Node = new TreeServer(this->Utils,this->Instance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + + if (Node->DuplicateID()) { 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."); |