diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 22:32:40 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-27 22:32:40 +0000 |
commit | 1211f840f16bacb21425eedba6794dfc8b39da40 (patch) | |
tree | 7b85b3ad18d152747c9c1de8425036e5cf6a3818 /src/modules | |
parent | f8e460b127b3d8f57e42276016dc94dd5d4ecf82 (diff) |
Fix potential for duplicate SID if the SID is auto generated.
Auto generated SIDs are initialized too late after modules are loaded rather than before. Fixed.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7924 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4d62c3b83..34cf318e3 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -799,6 +799,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> this->Instance->SNO->WriteToSnoMask('l',"Server \2"+servername+"\2 being introduced from \2" + prefix + "\2 denied, already exists. Closing link with " + prefix); return false; } + Link* lnk = Utils->FindLink(servername); TreeServer *Node = new TreeServer(this->Utils, this->Instance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); @@ -950,7 +951,17 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) CheckDupeSocket->Close(); return false; } - /* Now check for fully initialized instances of the server */ + /* Check for fully initialized instances of the server by id */ + Instance->Log(DEBUG,"Looking for dupe SID %s", sid.c_str()); + TreeServer* CheckDupeSID = Utils->FindServerID(sid); + if (CheckDupeSID) + { + this->SendError("Server ID "+CheckDupeSID->GetID()+" already exists on server "+CheckDupeSID->GetName()+"!"); + this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server ID '"+CheckDupeSID->GetID()+ + "' already exists on server "+CheckDupeSID->GetName()); + return false; + } + /* Now check for fully initialized instances of the server by name */ TreeServer* CheckDupe = Utils->FindServer(sname); if (CheckDupe) { diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 8610a1666..e38a959b7 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -151,6 +151,7 @@ TreeServer* SpanningTreeUtilities::FindServerMask(const std::string &ServerName) TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) { + ServerInstance->Log(DEBUG,"Looking for id: %s", id.c_str()); server_hash::iterator iter = sidlist.find(id); if (iter != sidlist.end()) return iter->second; @@ -176,6 +177,8 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT lines_to_apply = 0; + ServerInstance->Log(DEBUG, "SpanningTreeUtilities: SID: %s", OurSID.c_str()); + this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, OurSID); modulelist* ml = ServerInstance->FindInterface("InspSocketHook"); |