summaryrefslogtreecommitdiff
path: root/contrib/torify.in
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-04-17 02:46:14 +0000
committerPeter Palfrader <peter@palfrader.org>2006-04-17 02:46:14 +0000
commit275bacb6a99f37c72f79f4bda76fdf71cad86d89 (patch)
tree6da10c851c25e49a1557cc734ebabb9a1ecc0a10 /contrib/torify.in
parentbc40ba680a829b4311025f6beaf40c94da60a50d (diff)
downloadtor-275bacb6a99f37c72f79f4bda76fdf71cad86d89.tar.gz
tor-275bacb6a99f37c72f79f4bda76fdf71cad86d89.zip
Add an XXX to torify.in - "which" is evil,
quote a few variables do -h and --help add (c) and license ("Same as tor") print an error message if exec falls through svn:r6392
Diffstat (limited to 'contrib/torify.in')
-rwxr-xr-xcontrib/torify.in36
1 files changed, 24 insertions, 12 deletions
diff --git a/contrib/torify.in b/contrib/torify.in
index 474ae0f1fc..05645fd07c 100755
--- a/contrib/torify.in
+++ b/contrib/torify.in
@@ -1,33 +1,45 @@
#! /bin/sh
+
# 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
+# May be distributed under the same terms as Tor itself
+
# Define and ensure we have tsocks
-TSOCKS=`which tsocks`;
-if [ ! -x $TSOCKS ];
+# XXX: what if we don't have which?
+TSOCKS="`which tsocks`"
+if [ ! -x "$TSOCKS" ]
then
- echo "Can't find tsocks in PATH. Perhaps you haven't installed it?";
- exit 1;
+ echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2
+ exit 1
fi
# Check for any argument list
-if [ -z $1 ];
+if [ "$#" = 0 ]
then
- echo "Usage: $0 <application> <arguments>";
- exit 1;
+ echo "Usage: $0 <command> [<options>...]" >&2
+ exit 1
+fi
+if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] )
+then
+ echo "Usage: $0 <command> [<options>...]"
+ exit 0
fi
# Define our tsocks config file
-TSOCKS_CONF_FILE=@CONFDIR@/tor-tsocks.conf
+TSOCKS_CONF_FILE="@CONFDIR@/tor-tsocks.conf"
export TSOCKS_CONF_FILE
# Check that we've got a tsocks config file
-if [ -r $TSOCKS_CONF_FILE ];
+if [ -r "$TSOCKS_CONF_FILE" ]
then
exec tsocks "$@"
+ echo "$0: Failed to exec tsocks $@" >&2
+ exit 1
else
- echo "Error: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\".";
- exit 1;
+ echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2
+ exit 1
fi
-