diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-31 16:43:35 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-31 16:43:35 +0000 |
commit | 134e29c6b7a20c0501a53a9caf2f68e605e7d2b7 (patch) | |
tree | 24a18bcf90a2b032122ca71cfaba3305eabd09a1 /src/modules/m_spanningtree.cpp | |
parent | f33f516fefebae7bc0d15159f2ad32ce2d6149c8 (diff) |
Forwardport fix from stable (bug#133 reported by insurgent): configuring a link block with the same name as the local server (?!) then linking to it causes segfault
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5090 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 162d43590..9610aa07e 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -3577,53 +3577,60 @@ void ReadConfiguration(bool rebind) L.HiddenFromStats = Conf->ReadFlag("link","hidden",j); L.NextConnectTime = time(NULL) + L.AutoConnect; /* Bugfix by brain, do not allow people to enter bad configurations */ - if ((L.IPAddr != "") && (L.RecvPass != "") && (L.SendPass != "") && (L.Name != "") && (L.Port)) + if (L.Name != ServerInstance->Config->ServerName) { - ValidIPs.push_back(L.IPAddr); + if ((L.IPAddr != "") && (L.RecvPass != "") && (L.SendPass != "") && (L.Name != "") && (L.Port)) + { + ValidIPs.push_back(L.IPAddr); + + if (Allow.length()) + ValidIPs.push_back(Allow); - if (Allow.length()) - ValidIPs.push_back(Allow); + /* Needs resolving */ + insp_inaddr binip; + if (insp_aton(L.IPAddr.c_str(), &binip) < 1) + { + try + { + SecurityIPResolver* sr = new SecurityIPResolver(ServerInstance, L.IPAddr, L); + ServerInstance->AddResolver(sr); + } + catch (ModuleException& e) + { + ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason()); + } + } - /* Needs resolving */ - insp_inaddr binip; - if (insp_aton(L.IPAddr.c_str(), &binip) < 1) + LinkBlocks.push_back(L); + ServerInstance->Log(DEBUG,"m_spanningtree: Read server %s with host %s:%d",L.Name.c_str(),L.IPAddr.c_str(),L.Port); + } + else { - try + if (L.IPAddr == "") + { + ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', IP address not defined!",L.Name.c_str()); + } + else if (L.RecvPass == "") + { + ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', recvpass not defined!",L.Name.c_str()); + } + else if (L.SendPass == "") { - SecurityIPResolver* sr = new SecurityIPResolver(ServerInstance, L.IPAddr, L); - ServerInstance->AddResolver(sr); + ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', sendpass not defined!",L.Name.c_str()); } - catch (ModuleException& e) + else if (L.Name == "") { - ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason()); + ServerInstance->Log(DEFAULT,"Invalid configuration, link tag without a name!"); + } + else if (!L.Port) + { + ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', no port specified!",L.Name.c_str()); } } - - LinkBlocks.push_back(L); - ServerInstance->Log(DEBUG,"m_spanningtree: Read server %s with host %s:%d",L.Name.c_str(),L.IPAddr.c_str(),L.Port); } else { - if (L.IPAddr == "") - { - ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', IP address not defined!",L.Name.c_str()); - } - else if (L.RecvPass == "") - { - ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', recvpass not defined!",L.Name.c_str()); - } - else if (L.SendPass == "") - { - ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', sendpass not defined!",L.Name.c_str()); - } - else if (L.Name == "") - { - ServerInstance->Log(DEFAULT,"Invalid configuration, link tag without a name!"); - } - else if (!L.Port) - { - ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', no port specified!",L.Name.c_str()); - } + ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', link tag has the same server name as the local server!",L.Name.c_str()); } } DELETE(Conf); |