1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 13:03:12 +02:00

Allow multiple IP addresses in extforward_ip separated by spaces

This commit is contained in:
linuxdaemon
2019-01-03 20:07:01 -06:00
committed by Adam
parent 6fbb7cffe9
commit cf44418e10
3 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -223,8 +223,9 @@ module { name = "help" }
* extforward_headers set below, set this to its IP.
* This allows services to obtain the real IP of users by
* reading the forwarded-for HTTP header.
* Multiple IP addresses can be specified separated by a space character.
*/
#extforward_ip = "192.168.0.255"
#extforward_ip = "192.168.0.255 192.168.1.255"
/* The header to look for. These probably work as is. */
extforward_header = "X-Forwarded-For Forwarded-For"
+1 -1
View File
@@ -141,7 +141,7 @@ class HTTPProvider : public ListenSocket, public Service
unsigned short port;
bool ssl;
public:
Anope::string ext_ip;
std::vector<Anope::string> ext_ips;
std::vector<Anope::string> ext_headers;
HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p), ssl(s) { }
+2 -2
View File
@@ -67,7 +67,7 @@ class MyHTTPClient : public HTTPClient
return;
}
if (this->ip == this->provider->ext_ip)
if (std::find(this->provider->ext_ips.begin(), this->provider->ext_ips.end(), this->ip) != this->provider->ext_ips.end())
{
for (unsigned i = 0; i < this->provider->ext_headers.size(); ++i)
{
@@ -435,7 +435,7 @@ class HTTPD : public Module
}
p->ext_ip = ext_ip;
spacesepstream(ext_ip).GetTokens(p->ext_ips);
spacesepstream(ext_header).GetTokens(p->ext_headers);
}