On 2022/06/01 03:08, Yifei Zhan wrote:
> - upstream moved from github to selfhosted git server
> - otherwise this is an update for bugfixes, no major changes
> - 'make lib-depends-check' and 'make test' are happy

Changelog at https://gitweb.torproject.org/torsocks.git/tree/ChangeLog
looks sane amd works for me. This is OK sthen@

> Tested only on amd64 because I don't have access to other boxes, you 
> can test it by running tor and invoke:
> 
> torsocks curl ifconfig.me
> 
> ...which will give you a Tor Exit IP.
> 
> diff --git a/net/torsocks/Makefile b/net/torsocks/Makefile
> index 525a1ae6d38..c224e7e6390 100644
> --- a/net/torsocks/Makefile
> +++ b/net/torsocks/Makefile
> @@ -1,11 +1,6 @@
>  COMMENT =            socks proxy for use with tor
>  
> -DISTNAME =           torsocks-2.2.0
> -REVISION =           0
> -
> -GH_PROJECT =         torsocks
> -GH_ACCOUNT =         dgoulet
> -GH_TAGNAME =         v2.2.0
> +DISTNAME =           torsocks-2.3.0
>  
>  SHARED_LIBS =                torsocks        1.0 # 0.0
>  
> @@ -20,6 +15,9 @@ PERMIT_PACKAGE =    Yes
>  
>  WANTLIB += pthread
>  
> +MASTER_SITES=        https://gitweb.torproject.org/torsocks.git/snapshot/
> +EXTRACT_SUFX=        .tar.gz
> +
>  AUTOCONF_VERSION=    2.69
>  AUTOMAKE_VERSION=    1.15
>  
> diff --git a/net/torsocks/distinfo b/net/torsocks/distinfo
> index f0acdd86eb1..fb8e630a10d 100644
> --- a/net/torsocks/distinfo
> +++ b/net/torsocks/distinfo
> @@ -1,2 +1,2 @@
> -SHA256 (torsocks-2.2.0.tar.gz) = NiFqHjD0f6DlvoR2Hg1yEzGWyKBCcWAX2lbpQ5M4yH0=
> -SIZE (torsocks-2.2.0.tar.gz) = 115269
> +SHA256 (torsocks-2.3.0.tar.gz) = gXwUPoqdIX9BoiOoUTnGyijhuZVWxUf820xy28Fwtsk=
> +SIZE (torsocks-2.3.0.tar.gz) = 118033
> diff --git a/net/torsocks/patches/patch-Makefile_in 
> b/net/torsocks/patches/patch-Makefile_in
> deleted file mode 100644
> index ab8734064f3..00000000000
> --- a/net/torsocks/patches/patch-Makefile_in
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -Index: Makefile.in
> ---- Makefile.in.orig
> -+++ Makefile.in
> -@@ -370,7 +370,7 @@ top_builddir = @top_builddir@
> - top_srcdir = @top_srcdir@
> - ACLOCAL_AMFLAGS = -I config
> - SUBDIRS = src doc tests extras
> --dist_doc_DATA = ChangeLog
> -+dist_doc_DATA =
> - EXTRA_DIST = gpl-2.0.txt extras/torsocks-bash_completion
> - all: all-recursive
> - 
> diff --git a/net/torsocks/patches/patch-doc_Makefile_in 
> b/net/torsocks/patches/patch-doc_Makefile_in
> deleted file mode 100644
> index fcf32e50454..00000000000
> --- a/net/torsocks/patches/patch-doc_Makefile_in
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -Index: doc/Makefile.in
> ---- doc/Makefile.in.orig
> -+++ doc/Makefile.in
> -@@ -595,7 +595,7 @@ info: info-am
> - 
> - info-am:
> - 
> --install-data-am: install-dist_confDATA install-dist_docDATA \
> -+install-data-am: install-dist_confDATA \
> -     install-man
> - 
> - install-dvi: install-dvi-am
> diff --git a/net/torsocks/patches/patch-src_bin_torsocks_in 
> b/net/torsocks/patches/patch-src_bin_torsocks_in
> index 9fe5fb9a67b..45dbf7de3ba 100644
> --- a/net/torsocks/patches/patch-src_bin_torsocks_in
> +++ b/net/torsocks/patches/patch-src_bin_torsocks_in
> @@ -1,139 +1,12 @@
> -Add missing quotes to variable in torsocks.in
> -Fixes #19376
> -https://github.com/dgoulet/torsocks/commit/5a5b72fa0aef2315c369cedc5f448ee473be5e4f
> -
>  Index: src/bin/torsocks.in
>  --- src/bin/torsocks.in.orig
>  +++ src/bin/torsocks.in
> -@@ -65,7 +65,7 @@ libdir=@libdir@
> +@@ -66,7 +66,7 @@ libdir=@libdir@
>   LIBDIR="${libdir}/torsocks"
>   LIB_NAME="libtorsocks"
>   SHLIB_EXT="@SHLIB_EXT@"
>  -SHLIB="${LIBDIR}/${LIB_NAME}.${SHLIB_EXT}"
>  +SHLIB="${LIBDIR}/${LIB_NAME}.${SHLIB_EXT}.${LIBtorsocks_VERSION}"
>   
> - # Set @LDPRELOAD@ variable with torsocks library path.
> - set_ld_preload ()
> -@@ -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`
> -+            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)
> + # https://github.com/mkropat/sh-realpath
> + #
> diff --git a/net/torsocks/patches/patch-src_common_compat_h 
> b/net/torsocks/patches/patch-src_common_compat_h
> index cad5bbd4714..f9077926bd5 100644
> --- a/net/torsocks/patches/patch-src_common_compat_h
> +++ b/net/torsocks/patches/patch-src_common_compat_h
> @@ -20,7 +20,7 @@ Index: src/common/compat.h
>   
>   #if defined(__linux__)
>   #include <unistd.h>
> -@@ -176,7 +177,8 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine
> +@@ -196,7 +197,8 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine
>   
>   #endif /* __linux__ */
>   
> @@ -30,7 +30,7 @@ Index: src/common/compat.h
>   
>   #include <sys/syscall.h>
>   #include <unistd.h>
> -@@ -195,7 +197,7 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine
> +@@ -215,7 +217,7 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine
>   #define TSOCKS_NR_LISTEN    SYS_listen
>   #define TSOCKS_NR_RECVMSG   SYS_recvmsg
>   
> diff --git a/net/torsocks/patches/patch-src_lib_syscall_c 
> b/net/torsocks/patches/patch-src_lib_syscall_c
> index 8cf989d4ebb..bcecc29364a 100644
> --- a/net/torsocks/patches/patch-src_lib_syscall_c
> +++ b/net/torsocks/patches/patch-src_lib_syscall_c
> @@ -1,26 +1,7 @@
>  Index: src/lib/syscall.c
>  --- src/lib/syscall.c.orig
>  +++ src/lib/syscall.c
> -@@ -84,7 +84,8 @@ static LIBC_ACCEPT_RET_TYPE handle_accept(va_list args
> -     return tsocks_accept(sockfd, addr, &addrlen);
> - }
> - 
> --#if (defined(__linux__) || defined(__darwin__) || 
> (defined(__FreeBSD_kernel__) && defined(__i386__)) || defined(__NetBSD__))
> -+#if (defined(__linux__) || defined(__darwin__) || 
> (defined(__FreeBSD_kernel__) && \
> -+                    defined(__i386__)) || defined(__NetBSD__) || 
> defined(__OpenBSD__))
> - /*
> -  * Handle mmap(2) syscall.
> -  */
> -@@ -104,7 +105,7 @@ static LIBC_SYSCALL_RET_TYPE handle_mmap(va_list args)
> - 
> -     return (LIBC_SYSCALL_RET_TYPE) mmap(addr, len, prot, flags, fd, offset);
> - }
> --#endif /* __linux__, __darwin__, __FreeBSD_kernel__, __i386__, __NetBSD__ */
> -+#endif /* __linux__, __darwin__, __FreeBSD_kernel__, __i386__, __NetBSD__, 
> __OpenBSD__ */
> - 
> - /*
> -  * Handle munmap(2) syscall.
> -@@ -392,7 +393,8 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, 
> +@@ -457,7 +457,8 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, 
>               ret = handle_close(args);
>               break;
>       case TSOCKS_NR_MMAP:
> @@ -30,7 +11,7 @@ Index: src/lib/syscall.c
>               /*
>                * On an 64 bit *BSD system, __syscall(2) should be used for 
> mmap().
>                * This is NOT suppose to happen but for protection we deny 
> that call.
> -@@ -421,7 +423,7 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, 
> +@@ -486,7 +487,7 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, 
>                * own memory using mmap() called by syscall(). Same for 
> munmap().
>                */
>               ret = handle_mmap(args);
> @@ -39,7 +20,7 @@ Index: src/lib/syscall.c
>               break;
>       case TSOCKS_NR_MUNMAP:
>               ret = handle_munmap(args);
> -@@ -516,7 +518,7 @@ LIBC_SYSCALL_DECL
> +@@ -596,7 +597,7 @@ LIBC_SYSCALL_DECL
>   }
>   
>   /* Only used for *BSD systems. */
> @@ -48,7 +29,7 @@ Index: src/lib/syscall.c
>   
>   /* __syscall(2) */
>   TSOCKS_LIBC_DECL(__syscall, LIBC___SYSCALL_RET_TYPE, LIBC___SYSCALL_SIG)
> -@@ -580,4 +582,4 @@ LIBC___SYSCALL_DECL
> +@@ -660,4 +661,4 @@ LIBC___SYSCALL_DECL
>       return ret;
>   }
>   
> diff --git a/net/torsocks/patches/patch-src_lib_torsocks_c 
> b/net/torsocks/patches/patch-src_lib_torsocks_c
> new file mode 100644
> index 00000000000..984a5ee41c9
> --- /dev/null
> +++ b/net/torsocks/patches/patch-src_lib_torsocks_c
> @@ -0,0 +1,15 @@
> +Index: src/lib/torsocks.c
> +--- src/lib/torsocks.c.orig
> ++++ src/lib/torsocks.c
> +@@ -234,9 +234,8 @@ static void init_libc_symbols(void)
> +     tsocks_libc_socket = dlsym(libc_ptr, LIBC_SOCKET_NAME_STR);
> +     tsocks_libc_syscall = dlsym(libc_ptr, LIBC_SYSCALL_NAME_STR);
> +     tsocks_libc_execve = dlsym(libc_ptr, LIBC_EXECVE_NAME_STR);
> +-    tsocks_libc_accept4 = dlsym(libc_ptr, LIBC_ACCEPT4_NAME_STR);
> +-    if (!tsocks_libc_connect || !tsocks_libc_close || !tsocks_libc_socket ||
> +-                    !tsocks_libc_syscall || !tsocks_libc_execve || ! 
> tsocks_libc_accept4) {
> ++    if (!tsocks_libc_connect || !tsocks_libc_close || !tsocks_libc_socket
> ++                            || !tsocks_libc_syscall || !tsocks_libc_execve) 
> {
> +             ERR("Unable to lookup symbols in " LIBC_NAME "(%s)", dlerror());
> +             goto error;
> +     }
> diff --git a/net/torsocks/pkg/PLIST b/net/torsocks/pkg/PLIST
> index de285cadc04..6975f86f6c6 100644
> --- a/net/torsocks/pkg/PLIST
> +++ b/net/torsocks/pkg/PLIST
> @@ -1,11 +1,15 @@
>  bin/torsocks
>  lib/torsocks/
> -lib/torsocks/libtorsocks.a
> +@static-lib lib/torsocks/libtorsocks.a
>  lib/torsocks/libtorsocks.la
>  @lib lib/torsocks/libtorsocks.so.${LIBtorsocks_VERSION}
>  @man man/man1/torsocks.1
>  @man man/man5/torsocks.conf.5
>  @man man/man8/torsocks.8
> +share/doc/torsocks/
> +share/doc/torsocks/DEBUG
> +share/doc/torsocks/SOCKS5
> +share/doc/torsocks/socks-extensions.txt
>  share/examples/torsocks/
>  share/examples/torsocks/tor/
>  share/examples/torsocks/tor/torsocks.conf
> 

Reply via email to