summaryrefslogtreecommitdiff
path: root/modules/metadata/mod_remoteip.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2016-04-09 13:46:36 +0200
committerStefan Fritsch <sf@sfritsch.de>2016-04-09 13:46:36 +0200
commit48eddd3d39fa2668ee29198ebfb33c41d4738c21 (patch)
tree247d4f813b86ea354d18d337b09bb137caab8e15 /modules/metadata/mod_remoteip.c
parentd5325781b38052fbdf4cc28a6c6d3052b9424b51 (diff)
downloadapache2-48eddd3d39fa2668ee29198ebfb33c41d4738c21.tar.gz
Imported Upstream version 2.4.20
Diffstat (limited to 'modules/metadata/mod_remoteip.c')
-rw-r--r--modules/metadata/mod_remoteip.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/metadata/mod_remoteip.c b/modules/metadata/mod_remoteip.c
index 61087590..0a1dfac4 100644
--- a/modules/metadata/mod_remoteip.c
+++ b/modules/metadata/mod_remoteip.c
@@ -230,11 +230,24 @@ static int remoteip_modify_request(request_rec *r)
char *parse_remote;
char *eos;
unsigned char *addrbyte;
+
+ /* If no RemoteIPInternalProxy, RemoteIPInternalProxyList, RemoteIPTrustedProxy
+ or RemoteIPTrustedProxyList directive is configured,
+ all proxies will be considered as external trusted proxies.
+ */
void *internal = NULL;
if (!config->header_name) {
return DECLINED;
}
+
+ if (config->proxymatch_ip) {
+ /* This indicates that a RemoteIPInternalProxy, RemoteIPInternalProxyList, RemoteIPTrustedProxy
+ or RemoteIPTrustedProxyList directive is configured.
+ In this case, default to internal proxy.
+ */
+ internal = (void *) 1;
+ }
remote = (char *) apr_table_get(r->headers_in, config->header_name);
if (!remote) {
@@ -254,7 +267,13 @@ static int remoteip_modify_request(request_rec *r)
match = (remoteip_proxymatch_t *)config->proxymatch_ip->elts;
for (i = 0; i < config->proxymatch_ip->nelts; ++i) {
if (apr_ipsubnet_test(match[i].ip, temp_sa)) {
- internal = match[i].internal;
+ if (internal) {
+ /* Allow an internal proxy to present an external proxy,
+ but do not allow an external proxy to present an internal proxy.
+ In this case, the presented internal proxy will be considered external.
+ */
+ internal = match[i].internal;
+ }
break;
}
}