From 506636ff1a1fcf7a2b6dbb2e2e8ae90845e778ce Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 8 Jun 2011 12:48:30 +0000 Subject: [PATCH] [packages] tinyproxy: import fix for upstream bug #95 - fix url filters in transparent mode SVN-Revision: 27135 --- net/tinyproxy/Makefile | 2 +- ...0-fix_url_filter_in_transparent_mode.patch | 110 ++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 net/tinyproxy/patches/040-fix_url_filter_in_transparent_mode.patch diff --git a/net/tinyproxy/Makefile b/net/tinyproxy/Makefile index e3dae22049..e6daa1e0b7 100644 --- a/net/tinyproxy/Makefile +++ b/net/tinyproxy/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tinyproxy PKG_VERSION:=1.8.2 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.banu.com/pub/tinyproxy/1.8/ diff --git a/net/tinyproxy/patches/040-fix_url_filter_in_transparent_mode.patch b/net/tinyproxy/patches/040-fix_url_filter_in_transparent_mode.patch new file mode 100644 index 0000000000..ab3118b828 --- /dev/null +++ b/net/tinyproxy/patches/040-fix_url_filter_in_transparent_mode.patch @@ -0,0 +1,110 @@ +From e0cf6d4b0c84da6273c127a8c87076aac3b51588 Mon Sep 17 00:00:00 2001 +From: Daniel Egger +Date: Mon, 16 Aug 2010 22:36:20 +0200 +Subject: [PATCH 3/3] Pass a pointer to a char pointer to do_transparent_proxy so the reassembled URL + will actually end up back in the caller where it is needed for filtering + decisions. This fixes the problem that a tinyproxy configured with the + transparent proxy functionality and "FilterURLs Yes" would filter on everything + but the domain. + +Signed-off-by: daniel.egger@sphairon.com +--- + src/reqs.c | 2 +- + src/transparent-proxy.c | 20 ++++++++++---------- + src/transparent-proxy.h | 2 +- + 3 files changed, 12 insertions(+), 12 deletions(-) + +--- a/src/reqs.c ++++ b/src/reqs.c +@@ -418,7 +418,7 @@ BAD_REQUEST_ERROR: + } else { + #ifdef TRANSPARENT_PROXY + if (!do_transparent_proxy +- (connptr, hashofheaders, request, &config, url)) { ++ (connptr, hashofheaders, request, &config, &url)) { + goto fail; + } + #else +--- a/src/transparent-proxy.c ++++ b/src/transparent-proxy.c +@@ -55,11 +55,11 @@ static int build_url (char **url, const + int + do_transparent_proxy (struct conn_s *connptr, hashmap_t hashofheaders, + struct request_s *request, struct config_s *conf, +- char *url) ++ char **url) + { + socklen_t length; + char *data; +- size_t ulen = strlen (url); ++ size_t ulen = strlen (*url); + + length = hashmap_entry_by_key (hashofheaders, "host", (void **) &data); + if (length <= 0) { +@@ -73,7 +73,7 @@ do_transparent_proxy (struct conn_s *con + connptr->client_fd); + indicate_http_error (connptr, 400, "Bad Request", + "detail", "Unknown destination", +- "url", url, NULL); ++ "url", *url, NULL); + return 0; + } + +@@ -83,15 +83,15 @@ do_transparent_proxy (struct conn_s *con + request->port = ntohs (dest_addr.sin_port); + + request->path = (char *) safemalloc (ulen + 1); +- strlcpy (request->path, url, ulen + 1); ++ strlcpy (request->path, *url, ulen + 1); + + /* url overwritten by the call below is the url passed + * to this function, and is not the url variable in the + * caller. */ +- build_url (&url, request->host, request->port, request->path); ++ build_url (url, request->host, request->port, request->path); + log_message (LOG_INFO, + "process_request: trans IP %s %s for %d", +- request->method, url, connptr->client_fd); ++ request->method, *url, connptr->client_fd); + } else { + request->host = (char *) safemalloc (length + 1); + if (sscanf (data, "%[^:]:%hu", request->host, &request->port) != +@@ -101,15 +101,15 @@ do_transparent_proxy (struct conn_s *con + } + + request->path = (char *) safemalloc (ulen + 1); +- strlcpy (request->path, url, ulen + 1); ++ strlcpy (request->path, *url, ulen + 1); + + /* url overwritten by the call below is the url passed + * to this function, and is not the url variable in the + * caller. */ +- build_url (&url, request->host, request->port, request->path); ++ build_url (url, request->host, request->port, request->path); + log_message (LOG_INFO, + "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, +@@ -118,7 +118,7 @@ do_transparent_proxy (struct conn_s *con + indicate_http_error (connptr, 400, "Bad Request", + "detail", + "You tried to connect to the machine " +- "the proxy is running on", "url", url, ++ "the proxy is running on", "url", *url, + NULL); + return 0; + } +--- a/src/transparent-proxy.h ++++ b/src/transparent-proxy.h +@@ -32,7 +32,7 @@ + extern int do_transparent_proxy (struct conn_s *connptr, + hashmap_t hashofheaders, + struct request_s *request, +- struct config_s *config, char *url); ++ struct config_s *config, char **url); + + #endif + -- 2.30.2