diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 16:51:45 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 16:51:45 +0000 |
commit | d9b4390dbc7af872a143eacf35dde3b0db438119 (patch) | |
tree | b8f894b31545b3af5c9f4b195c46f133d9769555 /src/modules | |
parent | 935b0f4e0fd0f9ddc1f8d045f690b0864a47e82b (diff) |
Add <link:allowmask>
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4735 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index e98b7b460..91a917b8e 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -3050,13 +3050,20 @@ class TreeSocket : public InspSocket * IPs for which we don't have a link block. */ bool found = false; - vector<Link>::iterator i; + found = (std::find(ValidIPs.begin(), ValidIPs.end(), ip) != ValidIPs.end()); if (!found) { - WriteOpers("Server connection from %s denied (no link blocks with that IP address)", ip); - close(newsock); - return false; + for (vector<std::string>::iterator i = ValidIPs.begin(); i != ValidIPs.end(); i++) + if (MatchCIDR(ip, (*i).c_str())) + found = true; + + if (!found) + { + WriteOpers("Server connection from %s denied (no link blocks with that IP address)", ip); + close(newsock); + return false; + } } TreeSocket* s = new TreeSocket(newsock, ip); Srv->AddSocket(s); @@ -3345,6 +3352,7 @@ void ReadConfiguration(bool rebind) for (int j =0; j < Conf->Enumerate("link"); j++) { Link L; + std::string Allow = Conf->ReadValue("link","allowmask",j); L.Name = (Conf->ReadValue("link","name",j)).c_str(); L.IPAddr = Conf->ReadValue("link","ipaddr",j); L.Port = Conf->ReadInteger("link","port",j,true); @@ -3359,6 +3367,9 @@ void ReadConfiguration(bool rebind) { ValidIPs.push_back(L.IPAddr); + if (Allow.length()) + ValidIPs.push_back(Allow); + /* Needs resolving */ insp_inaddr binip; if (insp_aton(L.IPAddr.c_str(), &binip) < 1) |