summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-04-16 22:44:08 +0000
committerRoger Dingledine <arma@torproject.org>2006-04-16 22:44:08 +0000
commitbc36505a3a5e220efd1330b949ae5c91c875fed2 (patch)
tree851b9871f31ca339e35a6adb86aa30d0c91b9399 /contrib
parent07ff40987650bc845a4e8513378393f6ecd33a10 (diff)
downloadtor-bc36505a3a5e220efd1330b949ae5c91c875fed2.tar.gz
tor-bc36505a3a5e220efd1330b949ae5c91c875fed2.zip
better error checking for torify, contributed by jacob appelbaum.
svn:r6390
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/torify.in30
1 files changed, 28 insertions, 2 deletions
diff --git a/contrib/torify.in b/contrib/torify.in
index f9162a19fe..86e94062e9 100755
--- a/contrib/torify.in
+++ b/contrib/torify.in
@@ -1,7 +1,33 @@
-#! /bin/sh
+#! /bin/sh -x
# Wrapper script for use of the tsocks(8) transparent socksification library
# See the tsocks(1) and torify(1) manpages.
+# Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
+# Define and ensure we have tsocks
+TSOCKS=`which tsocks`;
+if [ ! -x $TSOCKS ];
+then
+ echo "Can't find tsocks in PATH. Perhaps you haven't installed it?";
+ exit 1;
+fi
+
+# Check for any argument list
+if [ -z $1 ];
+then
+ echo "Usage: $0 <application> <arguments>";
+ exit 1;
+fi
+
+# Define our tsocks config file
TSOCKS_CONF_FILE=@CONFDIR@/tor-tsocks.conf
export TSOCKS_CONF_FILE
-exec tsocks "$@"
+
+# Check that we've got a tsocks config file
+if [ -r $TSOCKS_CONF_FILE ];
+then
+ exec tsocks "$@"
+else
+ echo "Error: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\".";
+ exit 1;
+fi
+