diff options
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 39 |
2 files changed, 29 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 476b7900e..3d4f70c5e 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -691,8 +691,13 @@ int TreeSocket::OnIncomingConnection(int newsock, char* ip) if (!found) { for (std::vector<std::string>::iterator i = Utils->ValidIPs.begin(); i != Utils->ValidIPs.end(); i++) - if (irc::sockets::MatchCIDR(ip, (*i).c_str())) + { + if ((*i) == "*" || irc::sockets::MatchCIDR(ip, (*i).c_str())) + { found = true; + break; + } + } if (!found) { diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index bc295766f..e6827d524 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -484,19 +484,19 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) /* Bugfix by brain, do not allow people to enter bad configurations */ if (L.Name != ServerInstance->Config->ServerName) { - if ((!L.IPAddr.empty()) && (!L.RecvPass.empty()) && (!L.SendPass.empty()) && (!L.Name.empty()) && (L.Port)) - { - if (L.Name.find('.') == std::string::npos) - throw CoreException("The link name '"+assign(L.Name)+"' is invalid and must contain at least one '.' character"); + if (L.Name.find('.') == std::string::npos) + throw CoreException("The link name '"+assign(L.Name)+"' is invalid and must contain at least one '.' character"); - if (L.Name.length() > 64) - throw CoreException("The link name '"+assign(L.Name)+"' is longer than 64 characters!"); - - ValidIPs.push_back(L.IPAddr); + if (L.Name.length() > 64) + throw CoreException("The link name '"+assign(L.Name)+"' is longer than 64 characters!"); + if ((!L.IPAddr.empty()) && (!L.RecvPass.empty()) && (!L.SendPass.empty()) && (!L.Name.empty()) && (L.Port)) + { if (Allow.length()) ValidIPs.push_back(Allow); + ValidIPs.push_back(L.IPAddr); + /* Needs resolving */ bool ipvalid = true; QueryType start_type = DNS_QUERY_A; @@ -532,32 +532,39 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) { } } - - LinkBlocks.push_back(L); } else { if (L.IPAddr.empty()) { - throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', IP address not defined!"); + L.IPAddr = "*"; + ValidIPs.push_back("*"); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block " + assign(L.Name) + " has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); } - else if (L.RecvPass.empty()) + + if (L.RecvPass.empty()) { throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', recvpass not defined!"); } - else if (L.SendPass.empty()) + + if (L.SendPass.empty()) { throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', sendpass not defined!"); } - else if (L.Name.empty()) + + if (L.Name.empty()) { throw CoreException("Invalid configuration, link tag without a name! IP address: "+L.IPAddr); } - else if (!L.Port) + + if (!L.Port) { - throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', no port specified!"); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block " + assign(L.Name) + " has no port defined, you will not be able to /connect it."); } } + + + LinkBlocks.push_back(L); } else { |