transparent: make transparent support compile after introduction of multi Listen
I seem to have forgotten to compile with transparent support enabled... This belongs to the fix for bug BB#63. Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
b92d70be07
commit
b3ac7d2c7b
@ -60,6 +60,7 @@ do_transparent_proxy (struct conn_s *connptr, hashmap_t hashofheaders,
|
|||||||
socklen_t length;
|
socklen_t length;
|
||||||
char *data;
|
char *data;
|
||||||
size_t ulen = strlen (*url);
|
size_t ulen = strlen (*url);
|
||||||
|
ssize_t i;
|
||||||
|
|
||||||
length = hashmap_entry_by_key (hashofheaders, "host", (void **) &data);
|
length = hashmap_entry_by_key (hashofheaders, "host", (void **) &data);
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
@ -105,16 +106,28 @@ do_transparent_proxy (struct conn_s *connptr, hashmap_t hashofheaders,
|
|||||||
"process_request: trans Host %s %s for %d",
|
"process_request: trans Host %s %s for %d",
|
||||||
request->method, *url, connptr->client_fd);
|
request->method, *url, connptr->client_fd);
|
||||||
}
|
}
|
||||||
if (conf->ipAddr && strcmp (request->host, conf->ipAddr) == 0) {
|
|
||||||
log_message (LOG_ERR,
|
if (conf->listen_addrs == NULL) {
|
||||||
"process_request: destination IP is localhost %d",
|
return 1;
|
||||||
connptr->client_fd);
|
}
|
||||||
indicate_http_error (connptr, 400, "Bad Request",
|
|
||||||
"detail",
|
for (i = 0; i < vector_length(conf->listen_addrs); i++) {
|
||||||
"You tried to connect to the machine "
|
const char *addr;
|
||||||
"the proxy is running on", "url", *url,
|
|
||||||
NULL);
|
addr = (char *)vector_getentry(conf->listen_addrs, i, NULL);
|
||||||
return 0;
|
|
||||||
|
if (addr && strcmp(request->host, addr) == 0) {
|
||||||
|
log_message(LOG_ERR,
|
||||||
|
"transparent: destination IP %s is local "
|
||||||
|
"on socket fd %d",
|
||||||
|
request->host, connptr->client_fd);
|
||||||
|
indicate_http_error(connptr, 400, "Bad Request",
|
||||||
|
"detail",
|
||||||
|
"You tried to connect to the "
|
||||||
|
"machine the proxy is running on",
|
||||||
|
"url", *url, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user