diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-03-27 18:43:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-03-27 18:44:00 -0400 |
commit | 5cd707dcd31201b0ec86769a22605a647bd8a6a8 (patch) | |
tree | 645005048358e0d4889b8b6f531cff10f8baec60 | |
parent | 80b2756b537204ba070f1e3df4e5ed3f4e6815c0 (diff) | |
download | tor-5cd707dcd31201b0ec86769a22605a647bd8a6a8.tar tor-5cd707dcd31201b0ec86769a22605a647bd8a6a8.tar.gz |
Remove tsocks support from torify.
Fixes bug3530 and bug 5180. Patch by ugh.
-rwxr-xr-x | contrib/torify.in | 91 |
1 files changed, 31 insertions, 60 deletions
diff --git a/contrib/torify.in b/contrib/torify.in index d430da8ce..a5e1474e1 100755 --- a/contrib/torify.in +++ b/contrib/torify.in @@ -1,71 +1,42 @@ #! /bin/sh -# Wrapper script for use of the tsocks(8) transparent socksification library -# See the tsocks(1) and torify(1) manpages. - +# This script used to call (the now deprecated) tsocks as a fallback in case +# torsocks wasn't installed. +# Now, it's just a backwards compatible shim around torsocks with reasonable +# behavior if -v/--verbose or -h/--help arguments are passed. +# # Copyright (c) 2004, 2006, 2009 Peter Palfrader # Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006 +# Stripped of all the tsocks cruft by ugh on February 22nd 2012 # May be distributed under the same terms as Tor itself -# taken from Debian's Developer's Reference, 6.4 -pathfind() { - OLDIFS="$IFS" - IFS=: - for p in $PATH; do - if [ -x "$p/$*" ]; then - IFS="$OLDIFS" - return 0 - fi - done - IFS="$OLDIFS" - return 1 -} -# Check for any argument list -if [ "$#" = 0 ]; then - echo "Usage: $0 [-hv] <command> [<options>...]" >&2 - exit 1 -fi +compat() { + echo "torify is now just a wrapper around torsocks(1) for backwards compatibility." +} -if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] ); then +usage() { + compat echo "Usage: $0 [-hv] <command> [<options>...]" - exit 0 -fi - -if [ "$1" = "-v" ] || [ "$1" = "--verbose" ]; then - verbose=1 - shift 1 -else - verbose=0 -fi - -if pathfind torsocks; then - ! [ "$verbose" -ge 1 ] || echo "Using torsocks as socksifier." >&2 - - exec torsocks "$@" - echo "$0: Failed to exec torsocks $@" >&2 - exit 1 - -elif pathfind tsocks; then - ! [ "$verbose" -ge 1 ] || echo "Using tsocks as socksifier." >&2 - - # Define our tsocks config file - TSOCKS_CONF_FILE="/etc/tor/tor-tsocks.conf" - export TSOCKS_CONF_FILE - - # Check that we've got a tsocks config file - if [ -r "$TSOCKS_CONF_FILE" ] - then - echo "WARNING: tsocks is known to leak DNS and UDP data. If you had torsocks we would use that." >&2 - exec tsocks "$@" - echo "$0: Failed to exec tsocks $@" >&2 - exit 1 - else - echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2 - exit 1 - fi +} -else - echo "$0: Can't find either tsocks or torsocks in your PATH. Perhaps you haven't installed either?" >&2 +case $# in 0) + usage >&2 exit 1 -fi +esac + +case $# in 1) + case $1 in -h|--help) + usage + exit 0 + esac +esac + +case $1 in -v|--verbose) + compat >&2 + shift +esac + +exec torsocks "$@" +echo "$0: Failed to exec torsocks $@" >&2 +exit 1 |