diff options
author | Michele Calgaro <[email protected]> | 2014-09-30 14:22:40 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2014-09-30 14:22:40 +0900 |
commit | 97e3cf2ee89873b123b3b32d93141570417bbcf1 (patch) | |
tree | 4873af54fa6068d4e69d7dc2f19bae168a5eeb17 | |
parent | 894583b3114b9eec855c3d6c0c598071d4533d7a (diff) | |
download | tork-97e3cf2ee89873b123b3b32d93141570417bbcf1.tar.gz tork-97e3cf2ee89873b123b3b32d93141570417bbcf1.zip |
Added support for torsocks 2.0. This resolves bug 2126.
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | configure.in.in | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/scripts/Makefile.am | 3 | ||||
-rwxr-xr-x | src/scripts/usewithtor | 113 |
5 files changed, 119 insertions, 3 deletions
diff --git a/configure.in b/configure.in index 9f9b43c..200a805 100644 --- a/configure.in +++ b/configure.in @@ -606,7 +606,7 @@ esac # USE_GNU_SOURCE above is used instead and _GNU_SOURCE defined in shallot. dnl Check for presence of torsocks -AC_CHECK_PROG(TORSOCKS, usewithtor, usewithtor) +AC_CHECK_PROG(TORSOCKS, torsocks, torsocks) if test "${TORSOCKS}" = ""; then AC_MSG_ERROR('TorK requires torsocks: http://code.google.com/p/torsocks') fi diff --git a/configure.in.in b/configure.in.in index 1b38786..6317614 100644 --- a/configure.in.in +++ b/configure.in.in @@ -541,7 +541,7 @@ esac # USE_GNU_SOURCE above is used instead and _GNU_SOURCE defined in shallot. dnl Check for presence of torsocks -AC_CHECK_PROG(TORSOCKS, usewithtor, usewithtor) +AC_CHECK_PROG(TORSOCKS, torsocks, torsocks) if test "${TORSOCKS}" = ""; then AC_MSG_ERROR('TorK requires torsocks: http://code.google.com/p/torsocks') fi diff --git a/src/Makefile.am b/src/Makefile.am index da00fbf..16e644e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,7 +13,7 @@ geoipdir=GeoIP-1.4.0 endif SUBDIRS=icons arkollon $(geoipdir) privoxytemplates \ - menu upnp . + menu scripts upnp . # torkapplet konqplugin tor_ioslave - removed from build DISTCLEANFILES=dcoptork.kidl diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am new file mode 100644 index 0000000..27b22ea --- /dev/null +++ b/src/scripts/Makefile.am @@ -0,0 +1,3 @@ +scripts_SCRIPTS = usewithtor +scriptsdir = $(kde_bindir) + diff --git a/src/scripts/usewithtor b/src/scripts/usewithtor new file mode 100755 index 0000000..58fbbcf --- /dev/null +++ b/src/scripts/usewithtor @@ -0,0 +1,113 @@ +#! /bin/sh +# *************************************************************************** +# * * +# * Copyright (C) 2008-2011 Robert Hogan <[email protected]> * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation; either version 2 of the License, or * +# * (at your option) any later version. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU General Public License for more details. * +# * * +# * You should have received a copy of the GNU General Public License * +# * along with this program; if not, write to the * +# * Free Software Foundation, Inc., * +#* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +# *************************************************************************** +# * * +# * This is a modified version of a source file from the Tor project. * +# * Original copyright notice from tsocks source file follows: * +# *************************************************************************** + +# 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 <[email protected]> April 16th 2006 +# Modified by Marcus Griep <[email protected]> June 16 2009 +# May be distributed under the same terms as Tor itself + + +# Define and ensure we have tsocks +# XXX: what if we don't have which? +TORSOCKS="`which torsocks`" +PROG= +VERBOSE= + +usage () { + echo "Usage: $0 [-hv] <command> [<options>...]" +} + +not_found () { + echo "ERROR: $1 cannot be found in PATH." >&2 + exit 1 +} + +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 + usage >&2 + exit 1 +fi + +while [ "$1" ]; do + case "$1" in + -h|--h*) + usage + exit 0 + ;; + -v|--v*) + VERBOSE=YesPlease + shift + ;; + *) + break; + esac +done + +if ! which "$1" >/dev/null 2>&1; then + not_found $1 +elif [ -u `which "$1"` ]; then + set_id $1 u +elif [ -g `which "$1"` ]; then + set_id $1 g +fi + +if [ -x "$TORSOCKS" ]; then + PROG=torsocks +else + 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 + TORSOCKS_CONF_FILE="/etc/torsocks.conf" + export TORSOCKS_CONF_FILE + + # Check that we've got a torsocks config file + if [ -r "$TORSOCKS_CONF_FILE" ]; then + exec torsocks "$@" + else + echo "$0: Missing torsocks configuration file \"$TORSOCKS_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 |