Ticket #19376: quote2.patch

File quote2.patch, 1.8 KB (added by cypherpunks, 2 years ago)
  • src/bin/torsocks

    diff --git a/src/bin/torsocks b/src/bin/torsocks
    index 38fd7de..017da78 100755
    a b set_ld_preload () 
    7373        if [ -z "$LD_PRELOAD" ]; then
    7474                export LD_PRELOAD="${SHLIB}"
    7575        else
    76                 echo $LD_PRELOAD | grep -q "${SHLIB}" || \
     76                echo "$LD_PRELOAD" | grep -q "${SHLIB}" || \
    7777                        export LD_PRELOAD="${SHLIB} $LD_PRELOAD"
    7878        fi
    7979
    tor_shell () 
    130130
    131131torify_app ()
    132132{
    133         local app_path=`which $1`
    134         local getcap=`PATH="$PATH:/usr/sbin:/sbin" which getcap`
     133        local app_path="`which $1`"
     134        local getcap="`PATH="$PATH:/usr/sbin:/sbin" which getcap`"
    135135        local caps=
    136136
    137137        if [ -z $1 ]; then
    138138                echo "Please provide an application to torify." >&2
    139         elif [ -z $app_path ]; then
     139        elif [ -z "$app_path" ]; then
    140140                echo "ERROR: $1 cannot be found." >&2
    141141                exit 1
    142142        fi
    torify_app () 
    144144        # This must be before torifying because getcap uses cap_get_file(3)
    145145        # via syscall(2) which breaks torsocks.
    146146        if [ -n "$getcap" ]; then
    147                 caps=`$getcap $app_path`
     147                caps="`$getcap $app_path`"
    148148        fi
    149149
    150150        # Check if Apple's System Integrity Protection is enabled if the user is
    151151        # running on macOS.
    152         macos_sip_check $app_path
     152        macos_sip_check "$app_path"
    153153
    154154        # NEVER remove that line or else nothing it torified.
    155155        set_ld_preload
    156156
    157         if [ -u $app_path ]; then
     157        if [ -u "$app_path" ]; then
    158158                echo "ERROR: $1 is setuid. torsocks will not work on a setuid executable." >&2
    159159                exit 1
    160         elif [ -g $app_path ]; then
     160        elif [ -g "$app_path" ]; then
    161161                echo "ERROR: $1 is setgid. torsocks will not work on a setgid executable." >&2
    162162                exit 1
    163163        elif [ -n "$caps" ]; then
    if [ $# -eq 0 ] ; then 
    219219fi
    220220
    221221# Ensure libtorsocks exists,
    222 if [ ! -f $SHLIB ]; then
     222if [ ! -f "$SHLIB" ]; then
    223223   echo "$0: $SHLIB does not exist! Try re-installing torsocks."
    224224   exit
    225225fi