diff options
author | Beat Gaetzi <beat@FreeBSD.org> | 2009-09-08 16:31:32 +0000 |
---|---|---|
committer | Beat Gaetzi <beat@FreeBSD.org> | 2009-09-08 16:31:32 +0000 |
commit | aef01878dafd9ed96f0125379cab03df598da5b4 (patch) | |
tree | 4cbaa049e14e77aa3101f989737b8720049438f2 /net/torsocks/files | |
parent | 6f5e850a4f464e371f610bde4946c21bb3e93635 (diff) | |
download | ports-aef01878dafd9ed96f0125379cab03df598da5b4.tar.gz ports-aef01878dafd9ed96f0125379cab03df598da5b4.zip |
Notes
Diffstat (limited to 'net/torsocks/files')
-rw-r--r-- | net/torsocks/files/patch-configure.in | 48 | ||||
-rw-r--r-- | net/torsocks/files/patch-src-dead_pool.c | 11 | ||||
-rw-r--r-- | net/torsocks/files/patch-tsocks.c | 109 | ||||
-rw-r--r-- | net/torsocks/files/patch-usewithtor.in | 126 |
4 files changed, 275 insertions, 19 deletions
diff --git a/net/torsocks/files/patch-configure.in b/net/torsocks/files/patch-configure.in index 17953f5bc85a..e8186208da7d 100644 --- a/net/torsocks/files/patch-configure.in +++ b/net/torsocks/files/patch-configure.in @@ -1,5 +1,5 @@ ---- configure.in.orig 2009-02-12 15:59:50.000000000 +0200 -+++ configure.in 2009-02-12 17:27:16.000000000 +0200 +--- configure.in.orig 2009-09-07 18:59:08.000000000 +0200 ++++ configure.in 2009-09-07 18:58:52.000000000 +0200 @@ -123,11 +123,9 @@ dnl Checks for libraries. dnl Replace `main' with a function in -ldl: @@ -15,7 +15,7 @@ AC_CHECK_LIB(resolv, res_query, [ tempres="no" ],tempres="yes") if test "$tempres" = "no"; then -@@ -356,8 +354,8 @@ +@@ -356,11 +354,13 @@ dnl Find the correct res_querydomain prototype on this machine AC_MSG_CHECKING(for correct res_querydomain prototype) PROTO= @@ -26,7 +26,12 @@ do if test "${PROTO}" = ""; then AC_TRY_COMPILE([ -@@ -376,8 +374,8 @@ ++ #include <sys/types.h> ++ #include <netinet/in.h> + #include <resolv.h> + int res_querydomain($testproto); + ],,[PROTO="$testproto";],) +@@ -376,12 +376,14 @@ AC_MSG_CHECKING(for correct res_send prototype) PROTO= PROTO1='const char *msg, int msglen, char *answer, int anslen' @@ -37,7 +42,13 @@ "${PROTO2}" do if test "${PROTO}" = ""; then -@@ -397,8 +395,8 @@ + AC_TRY_COMPILE([ ++ #include <sys/types.h> ++ #include <netinet/in.h> + #include <resolv.h> + int res_send($testproto); + ],,[PROTO="$testproto";],) +@@ -397,11 +399,13 @@ dnl Find the correct res_search prototype on this machine AC_MSG_CHECKING(for correct res_search prototype) PROTO= @@ -48,7 +59,12 @@ do if test "${PROTO}" = ""; then AC_TRY_COMPILE([ -@@ -417,8 +415,8 @@ ++ #include <sys/types.h> ++ #include <netinet/in.h> + #include <resolv.h> + int res_search($testproto); + ],,[PROTO="$testproto";],) +@@ -417,11 +421,13 @@ dnl Find the correct res_query prototype on this machine AC_MSG_CHECKING(for correct res_query prototype) PROTO= @@ -59,12 +75,28 @@ do if test "${PROTO}" = ""; then AC_TRY_COMPILE([ -@@ -462,7 +460,7 @@ ++ #include <sys/types.h> ++ #include <netinet/in.h> + #include <resolv.h> + int res_query($testproto); + ],,[PROTO="$testproto";],) +@@ -447,6 +453,7 @@ + do + if test "${PROTO}" = ""; then + AC_TRY_COMPILE([ ++ #include <sys/types.h> + #include <sys/socket.h> + int getpeername($testproto); + ],,[PROTO="$testproto";],) +@@ -462,8 +469,9 @@ dnl Find the correct poll prototype on this machine AC_MSG_CHECKING(for correct poll prototype) PROTO= -for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' \ +- 'struct pollfd *ufds, nfds_t nfds, int timeout' +for testproto in 'struct pollfd *ufds, u_long nfds, int timeout' \ - 'struct pollfd *ufds, nfds_t nfds, int timeout' ++ 'struct pollfd *ufds, nfds_t nfds, int timeout' \ ++ 'struct pollfd *pfd, unsigned int nfds, int timeout' do if test "${PROTO}" = ""; then + AC_TRY_COMPILE([ diff --git a/net/torsocks/files/patch-src-dead_pool.c b/net/torsocks/files/patch-src-dead_pool.c new file mode 100644 index 000000000000..cd67aaf51b09 --- /dev/null +++ b/net/torsocks/files/patch-src-dead_pool.c @@ -0,0 +1,11 @@ +--- src/dead_pool.c 2009-02-07 12:00:03.000000000 +0100 ++++ src/dead_pool.c 2009-08-18 07:35:08.000000000 +0200 +@@ -725,7 +721,7 @@ + /* TODO: work out what to do with AF_INET6 requests */ + + #ifdef HAVE_INET_ATON +- if(inet_aton(node, &addr) == 0) { ++ if(node && inet_aton(node, &addr) == 0 && memcmp(node,"*",1)) { + #elif defined(HAVE_INET_ADDR) + /* If we're stuck with inet_addr, then getaddrinfo() won't work + properly with 255.255.255.255 (= -1). There's not much we can diff --git a/net/torsocks/files/patch-tsocks.c b/net/torsocks/files/patch-tsocks.c index 5cdbab984160..db78500f4274 100644 --- a/net/torsocks/files/patch-tsocks.c +++ b/net/torsocks/files/patch-tsocks.c @@ -1,5 +1,27 @@ ---- src/tsocks.c.orig 2009-02-12 15:59:50.000000000 +0200 -+++ src/tsocks.c 2009-02-12 23:18:14.870533468 +0200 +--- src/tsocks.c 2009-02-07 11:48:12.000000000 +0100 ++++ src/tsocks.c 2009-08-18 07:35:08.000000000 +0200 +@@ -54,6 +54,13 @@ + #define _GNU_SOURCE + #endif + ++/* Required by some BSDs */ ++#ifndef MAP_ANONYMOUS ++#ifdef MAP_ANON ++#define MAP_ANONYMOUS MAP_ANON ++#endif ++#endif ++ + /* Global configuration variables */ + const char *progname = "libtorsocks"; /* Name used in err msgs */ + +@@ -66,7 +73,6 @@ + #include <sys/socket.h> + #include <string.h> + #include <strings.h> +-#include <sys/types.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <sys/poll.h> @@ -164,7 +164,7 @@ void tsocks_init(void) { @@ -9,3 +31,86 @@ error = dlerror(); \ show_msg(l, "The symbol %s() was not found in any shared " \ "library. The error reported was: %s!\n", s, \ +@@ -278,9 +284,9 @@ + #ifndef ALLOW_MSG_OUTPUT + set_log_options(-1, (char *)stderr, 0); + #else +- if ((env = getenv("TSOCKS_DEBUG"))) ++ if ((env = getenv("TORSOCKS_DEBUG"))) + loglevel = atoi(env); +- if (((env = getenv("TSOCKS_DEBUG_FILE"))) && !suid) ++ if (((env = getenv("TORSOCKS_DEBUG_FILE"))) && !suid) + logfile = env; + set_log_options(loglevel, logfile, 1); + #endif +@@ -299,7 +305,7 @@ + /* Determine the location of the config file */ + #ifdef ALLOW_ENV_CONFIG + if (!suid) +- conffile = getenv("TSOCKS_CONF_FILE"); ++ conffile = getenv("TORSOCKS_CONF_FILE"); + #endif + + /* Read in the config file */ +@@ -367,8 +373,8 @@ + /* If this a UDP socket */ + /* then we refuse it, since it is probably a DNS request */ + if ((sock_type != SOCK_STREAM)) { +- show_msg(MSGERR, "Connection is a UDP stream, may be a " +- "DNS request: rejecting.\n"); ++ show_msg(MSGERR, "connect: Connection is a UDP or ICMP stream, may be a " ++ "DNS request or other form of leak: rejecting.\n"); + return -1; + } + #endif +@@ -1331,20 +1337,20 @@ + nixuser = getpwuid(getuid()); + + if (((uname = conn->path->defuser) == NULL) && +- ((uname = getenv("TSOCKS_USERNAME")) == NULL) && ++ ((uname = getenv("TORSOCKS_USERNAME")) == NULL) && + ((uname = (nixuser == NULL ? NULL : nixuser->pw_name)) == NULL)) { + show_msg(MSGERR, "Could not get SOCKS username from " + "local passwd file, torsocks.conf " +- "or $TSOCKS_USERNAME to authenticate " ++ "or $TORSOCKS_USERNAME to authenticate " + "with"); + conn->state = FAILED; + return(ECONNREFUSED); + } + +- if (((upass = getenv("TSOCKS_PASSWORD")) == NULL) && ++ if (((upass = getenv("TORSOCKS_PASSWORD")) == NULL) && + ((upass = conn->path->defpass) == NULL)) { + show_msg(MSGERR, "Need a password in torsocks.conf or " +- "$TSOCKS_PASSWORD to authenticate with"); ++ "$TORSOCKS_PASSWORD to authenticate with"); + conn->state = FAILED; + return(ECONNREFUSED); + } +@@ -1695,11 +1701,12 @@ + /* If this a UDP socket */ + /* then we refuse it, since it is probably a DNS request */ + if ((sock_type != SOCK_STREAM)) { +- show_msg(MSGERR, "Connection is a UDP stream, may be a " +- "DNS request: rejecting.\n"); ++ show_msg(MSGERR, "sendto: Connection is a UDP or ICMP stream, may be a " ++ "DNS request or other form of leak: rejecting.\n"); + return -1; + } + #endif ++ + return (ssize_t) realsendto(s, buf, len, flags, to, tolen); + + } +@@ -1748,8 +1755,8 @@ + /* If this a UDP socket */ + /* then we refuse it, since it is probably a DNS request */ + if ((sock_type != SOCK_STREAM)) { +- show_msg(MSGERR, "Connection is a UDP stream, may be a " +- "DNS request: rejecting.\n"); ++ show_msg(MSGERR, "sendmsg: Connection is a UDP or ICMP stream, may be a " ++ "DNS request or other form of leak: rejecting.\n"); + return -1; + } + #endif diff --git a/net/torsocks/files/patch-usewithtor.in b/net/torsocks/files/patch-usewithtor.in index 71da1270906f..dcd117c140ba 100644 --- a/net/torsocks/files/patch-usewithtor.in +++ b/net/torsocks/files/patch-usewithtor.in @@ -1,16 +1,124 @@ ---- src/usewithtor.in.orig 2009-02-12 15:59:50.000000000 +0200 -+++ src/usewithtor.in 2009-02-12 19:49:41.000000000 +0200 -@@ -1,3 +1,5 @@ -+#!/bin/sh -+# +--- src/usewithtor.in 2008-10-26 22:51:20.000000000 +0100 ++++ src/usewithtor.in 2009-08-18 07:35:08.000000000 +0200 +@@ -1,3 +1,4 @@ ++#! /bin/sh # *************************************************************************** # * * # * $Id: usewithtor.in,v 1.3 2008-07-06 15:17:35 hoganrobert Exp $* -@@ -26,7 +28,6 @@ +@@ -25,50 +26,84 @@ + # * Original copyright notice from tsocks source file follows: * # *************************************************************************** - +- -#! /bin/sh +- +-# Wrapper script for use of the torsocks(8) transparent socksification library +-# See the torsocks(1) and usewithtor(1) manpages. ++# Wrapper script for use of the tsocks(8) transparent socksification library ++# See the tsocks(1) and torify(1) manpages. + + # Copyright (c) 2004, 2006 Peter Palfrader + # Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006 +-# Modified by Robert Hogan <robert@roberthogan.net> March 2007 ++# Modified by Marcus Griep <marcus@griep.us> June 16 2009 + # May be distributed under the same terms as Tor itself + + +-# Define and ensure we have torsocks ++# Define and ensure we have tsocks + # XXX: what if we don't have which? +-TSOCKS="`which torsocks`" +-if [ ! -x "$TSOCKS" ] +-then +- echo "$0: Can't find torsocks in PATH. Perhaps you haven't installed it?" >&2 +- exit 1 +-fi ++TORSOCKS="`which torsocks`" ++PROG= ++VERBOSE= ++ ++usage () { ++ echo "Usage: $0 [-hv] <command> [<options>...]" ++} ++ ++set_id () { ++ echo "ERROR: $1 is set${2}id. usewithtor will not work on a set${2}id executable." >&2 ++ exit 1 ++} + + # Check for any argument list +-if [ "$#" = 0 ] +-then +- echo "Usage: $0 <command> [<options>...]" >&2 +- exit 1 ++if [ "$#" = 0 ]; then ++ usage >&2 ++ exit 1 + fi +-if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] ) +-then +- echo "Usage: $0 <command> [<options>...]" +- exit 0 ++ ++while [ "$1" ]; do ++ case "$1" in ++ -h|--h*) ++ usage ++ exit 0 ++ ;; ++ -v|--v*) ++ VERBOSE=YesPlease ++ shift ++ ;; ++ *) ++ break; ++ esac ++done ++ ++if [ -u `which "$1"` ]; then ++ set_id $1 u ++elif [ -g `which "$1"` ]; then ++ set_id $1 g + fi - # Wrapper script for use of the torsocks(8) transparent socksification library - # See the torsocks(1) and usewithtor(1) manpages. +-# Define our torsocks config file +-TSOCKS_CONF_FILE="@CONFDIR@/torsocks.conf" +-export TSOCKS_CONF_FILE +- +-# Check that we've got a torsocks config file +-if [ -r "$TSOCKS_CONF_FILE" ] +-then +- exec torsocks "$@" +- echo "$0: Failed to exec torsocks $@" >&2 +- exit 1 ++if [ -x "$TORSOCKS" ]; then ++ PROG=torsocks + else +- echo "$0: Missing torsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2 ++ echo "$0: Unable to find torsocks in PATH." >&2 ++ echo " Perhaps you haven't installed it?" >&2 + exit 1 + fi ++ ++if [ "$VERBOSE" ]; then ++ echo "We're armed with the following torsocks: $TORSOCKS" ++ echo "We're attempting to use $PROG for all tor action." ++fi ++ ++if [ "$PROG" = "torsocks" ]; then ++ # Define our torsocks config file ++ TSOCKS_CONF_FILE="@CONFDIR@/torsocks.conf" ++ export TSOCKS_CONF_FILE ++ ++ # Check that we've got a torsocks config file ++ if [ -r "$TSOCKS_CONF_FILE" ]; then ++ exec torsocks "$@" ++ else ++ echo "$0: Missing torsocks configuration file \"$TSOCKS_CONF_FILE\" - torsocks will use defaults sensible for Tor." >&2 ++ exec torsocks "$@" ++ fi ++fi ++ ++# We should have hit an exec. If we get here, we didn't exec ++echo "$0: failed to exec $PROG $@" >&2 ++exit 1 |