[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torsocks/master] Add missing quotes to variable in torsocks.in



commit 5a5b72fa0aef2315c369cedc5f448ee473be5e4f
Author: David Goulet <dgoulet@xxxxxxxxx>
Date:   Fri Feb 24 11:26:27 2017 -0500

    Add missing quotes to variable in torsocks.in
    
    Fixes #19376
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
 src/bin/torsocks.in | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/bin/torsocks.in b/src/bin/torsocks.in
index 552a516..15ffbfc 100644
--- a/src/bin/torsocks.in
+++ b/src/bin/torsocks.in
@@ -73,7 +73,7 @@ set_ld_preload ()
 	if [ -z "$@LDPRELOAD@" ]; then
 		export @LDPRELOAD@="${SHLIB}"
 	else
-		echo $@LDPRELOAD@ | grep -q "${SHLIB}" || \
+		echo "$@LDPRELOAD@" | grep -q "${SHLIB}" || \
 			export @LDPRELOAD@="${SHLIB} $@LDPRELOAD@"
 	fi
 
@@ -130,13 +130,13 @@ tor_shell ()
 
 torify_app ()
 {
-	local app_path=`which $1`
-	local getcap=`PATH="$PATH:/usr/sbin:/sbin" which getcap`
+	local app_path="`which $1`"
+	local getcap="`PATH="$PATH:/usr/sbin:/sbin" which getcap`"
 	local caps=
 
-	if [ -z $1 ]; then
+	if [ -z "$1" ]; then
 		echo "Please provide an application to torify." >&2
-	elif [ -z $app_path ]; then
+	elif [ -z "$app_path" ]; then
 		echo "ERROR: $1 cannot be found." >&2
 		exit 1
 	fi
@@ -144,20 +144,20 @@ torify_app ()
 	# This must be before torifying because getcap uses cap_get_file(3)
 	# via syscall(2) which breaks torsocks.
 	if [ -n "$getcap" ]; then
-		caps=`$getcap $app_path 2>/dev/null`
+		caps="`$getcap $app_path 2>/dev/null`"
 	fi
 
 	# Check if Apple's System Integrity Protection is enabled if the user is
 	# running on macOS.
-	macos_sip_check $app_path
+	macos_sip_check "$app_path"
 
 	# NEVER remove that line or else nothing it torified.
 	set_ld_preload
 
-	if [ -u $app_path ]; then
+	if [ -u "$app_path" ]; then
 		echo "ERROR: $1 is setuid. torsocks will not work on a setuid executable." >&2
 		exit 1
-	elif [ -g $app_path ]; then
+	elif [ -g "$app_path" ]; then
 		echo "ERROR: $1 is setgid. torsocks will not work on a setgid executable." >&2
 		exit 1
 	elif [ -n "$caps" ]; then
@@ -219,7 +219,7 @@ if [ $# -eq 0 ] ; then
 fi
 
 # Ensure libtorsocks exists,
-if [ ! -f $SHLIB ]; then
+if [ ! -f "$SHLIB" ]; then
    echo "$0: $SHLIB does not exist! Try re-installing torsocks."
    exit
 fi
@@ -228,14 +228,14 @@ while true;
 do
 	case "$1" in
 		on)
-			check_script_sourced $1
+			check_script_sourced "$1"
 			set_ld_preload
 			echo "Tor mode activated. Every command will be torified for this shell."
 			break
 			;;
 		off)
-			check_script_sourced $1
-			export @LDPRELOAD@=`echo -n $@LDPRELOAD@ | sed "s#$SHLIB *##"`
+			check_script_sourced "$1"
+			export @LDPRELOAD@="`echo -n $@LDPRELOAD@ | sed "s#$SHLIB *##"`"
 			if [ -z "$@LDPRELOAD@" ]; then
 				unset @LDPRELOAD@
 				case "$OSTYPE" in
@@ -256,35 +256,35 @@ do
 			break
 			;;
 		-u|--user)
-			if [ -z $2 ]; then
+			if [ -z "$2" ]; then
 				echo "Missing username to -u" >&2
 				exit 1
 			fi
-			export TORSOCKS_USERNAME=$2
+			export TORSOCKS_USERNAME="$2"
 			shift
 			;;
 		-p|--pass)
-			if [ -z $2 ]; then
+			if [ -z "$2" ]; then
 				echo "Missing password to -p" >&2
 				exit 1
 			fi
-			export TORSOCKS_PASSWORD=$2
+			export TORSOCKS_PASSWORD="$2"
 			shift
 			;;
 		-a|--address)
-			if [ -z $2 ]; then
+			if [ -z "$2" ]; then
 				echo "Missing address to -a" >&2
 				exit 1
 			fi
-			export TORSOCKS_TOR_ADDRESS=$2
+			export TORSOCKS_TOR_ADDRESS="$2"
 			shift
 			;;
 		-P|--port)
-			if [ -z $2 ]; then
+			if [ -z "$2" ]; then
 				echo "Missing port to -P" >&2
 				exit 1
 			fi
-			export TORSOCKS_TOR_PORT=$2
+			export TORSOCKS_TOR_PORT="$2"
 			shift
 			;;
 		-i|--isolate)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits