current default.filter, 1.92, 1.93 filters.c, 1.201, 1.202 jbsockets.c, 1.135, 1.136 jcc.c, 1.443, 1.444 loaders.c, 1.104, 1.105 project.h, 1.215, 1.216 user.filter, 1.3, 1.4
Fabian Keil <[email protected]> Wed, 25 May 2016 10:50:57 +0000
| Newsgroups | gmane.comp.web.privoxy.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4811
Modified Files:
default.filter filters.c jbsockets.c jcc.c loaders.c project.h
user.filter
Log Message:
Let dynamic filters and taggers support a $listen-address variable
... which contains the address the request came in on.
For external filters the variable is called $PRIVOXY_LISTEN_ADDRESS.
Original patch contributed by pursievro.
Index: user.filter
===================================================================
RCS file: /cvsroot/ijbswa/current/user.filter,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** user.filter 21 May 2008 20:17:03 -0000 1.3
--- user.filter 25 May 2016 10:50:55 -0000 1.4
***************
*** 64,68 ****
#
# 'D' (Dynamic) allows the use of variables. Supported variables are:
! # $host, $origin (the IP address the request came from), $path and $url.
#
# Note that '$' is a bad choice as delimiter for dynamic filters as you
--- 64,69 ----
#
# 'D' (Dynamic) allows the use of variables. Supported variables are:
! # $host, $listen-address, $origin (the IP address the request came
! # from), $path and $url.
#
# Note that '$' is a bad choice as delimiter for dynamic filters as you
Index: project.h
===================================================================
RCS file: /cvsroot/ijbswa/current/project.h,v
retrieving revision 1.215
retrieving revision 1.216
diff -C2 -d -r1.215 -r1.216
*** project.h 22 May 2016 12:43:07 -0000 1.215
--- project.h 25 May 2016 10:50:55 -0000 1.216
***************
*** 928,931 ****
--- 928,935 ----
#endif /* def HAVE_RFC2553 */
+ /** The host name and port (as a string of the form '<hostname>:<port>')
+ of the server socket to which the client connected. */
+ char *listen_addr_str;
+
/** The URL that was requested */
struct http_request http[1];
Index: loaders.c
===================================================================
RCS file: /cvsroot/ijbswa/current/loaders.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** loaders.c 22 May 2016 12:43:07 -0000 1.104
--- loaders.c 25 May 2016 10:50:55 -0000 1.105
***************
*** 186,189 ****
--- 186,190 ----
freez(csp->client_address);
#endif
+ freez(csp->listen_addr_str);
freez(csp->client_iob->buf);
freez(csp->iob->buf);
Index: jbsockets.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jbsockets.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -C2 -d -r1.135 -r1.136
*** jbsockets.c 16 Jan 2016 12:33:35 -0000 1.135
--- jbsockets.c 25 May 2016 10:50:55 -0000 1.136
***************
*** 1222,1225 ****
--- 1222,1226 ----
fd_set selected_fds;
jb_socket fd;
+ size_t listen_addr_size;
c_length = sizeof(client);
***************
*** 1349,1352 ****
--- 1350,1372 ----
#endif /* def HAVE_RFC2553 */
+ /*
+ * Save the name and port of the accepting socket for later lookup.
+ *
+ * The string needs space for strlen(...) + 7 characters:
+ * strlen(haddr[i]) + 1 (':') + 5 (port digits) + 1 ('\0')
+ */
+ listen_addr_size = strlen(csp->config->haddr[i]) + 7;
+ csp->listen_addr_str = malloc_or_die(listen_addr_size);
+ retval = snprintf(csp->listen_addr_str, listen_addr_size,
+ "%s:%d", csp->config->haddr[i], csp->config->hport[i]);
+ if ((-1 == retval) || listen_addr_size <= retval)
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Server name (%s) and port number (%d) ASCII decimal representation"
+ "don't fit into %d bytes",
+ csp->config->haddr[i], csp->config->hport[i], listen_addr_size);
+ return 0;
+ }
+
return 1;
Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.443
retrieving revision 1.444
diff -C2 -d -r1.443 -r1.444
*** jcc.c 22 May 2016 12:43:07 -0000 1.443
--- jcc.c 25 May 2016 10:50:55 -0000 1.444
***************
*** 3993,3996 ****
--- 3993,4002 ----
active_threads);
+ /*
+ * This config may be outdated, but for accept_connection()
+ * it's fresh enough.
+ */
+ csp->config = config;
+
if (!accept_connection(csp, bfds))
{
***************
*** 4052,4055 ****
--- 4058,4062 ----
close_socket(csp->cfd);
freez(csp->ip_addr_str);
+ freez(csp->listen_addr_str);
freez(csp_list);
continue;
***************
*** 4067,4070 ****
--- 4074,4078 ----
close_socket(csp->cfd);
freez(csp->ip_addr_str);
+ freez(csp->listen_addr_str);
freez(csp_list);
continue;
Index: default.filter
===================================================================
RCS file: /cvsroot/ijbswa/current/default.filter,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** default.filter 17 Oct 2014 14:45:10 -0000 1.92
--- default.filter 25 May 2016 10:50:55 -0000 1.93
***************
*** 58,62 ****
#
# 'D' (Dynamic) allows the use of variables. Supported variables are:
! # $host, $origin (the IP address the request came from), $path and $url.
#
# Note that '$' is a bad choice as delimiter for dynamic filters as you
--- 58,63 ----
#
# 'D' (Dynamic) allows the use of variables. Supported variables are:
! # $host, $listen-address, $origin (the IP address the request came
! # from), $path and $url.
#
# Note that '$' is a bad choice as delimiter for dynamic filters as you
Index: filters.c
===================================================================
RCS file: /cvsroot/ijbswa/current/filters.c,v
retrieving revision 1.201
retrieving revision 1.202
diff -C2 -d -r1.201 -r1.202
*** filters.c 17 Mar 2016 10:40:53 -0000 1.201
--- filters.c 25 May 2016 10:50:55 -0000 1.202
***************
*** 936,939 ****
--- 936,940 ----
{"host", csp->http->host, 1},
{"origin", csp->ip_addr_str, 1},
+ {"listen-address", csp->listen_addr_str, 1},
{NULL, NULL, 1}
};
***************
*** 1772,1775 ****
--- 1773,1777 ----
{ "PRIVOXY_HOST", csp->http->host },
{ "PRIVOXY_ORIGIN", csp->ip_addr_str },
+ { "PRIVOXY_LISTEN_ADDRESS", csp->listen_addr_str },
};
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j