Hello community,

here is the log from the commit of package torsocks for openSUSE:Factory 
checked in at 2020-02-15 22:25:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/torsocks (Old)
 and      /work/SRC/openSUSE:Factory/.torsocks.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "torsocks"

Sat Feb 15 22:25:41 2020 rev:5 rq:774429 version:2.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/torsocks/torsocks.changes        2017-01-04 
19:34:29.504915962 +0100
+++ /work/SRC/openSUSE:Factory/.torsocks.new.26092/torsocks.changes     
2020-02-15 22:25:55.071325866 +0100
@@ -1,0 +2,43 @@
+Sun Feb  9 02:45:45 UTC 2020 - wner...@member.fsf.org
+
+- Update to 2.3.0, announce message:
+
+ 2018-11-19 torsocks 2.3.0
+        * Fix a bunch of stuff in the wrapper script, #24967
+        * gethostbyaddr_r: always assign result
+        * log: Remove log line when logging is stopped
+        * gethostbyaddr_r: Don't put garbage in data->hostname
+        * gethostbyaddr_r: Populate h_addrtype field
+        * log: Avoid crash or file corruption when closing logs
+        * connect: Always pass .onion IP cookie to connection object
+        * Merge remote-tracking branch 'yawning/bug23715'
+        * Make torsocks always connect to the configured Tor port
+        * test: Make getpeername test connect to moria1
+        * socks5: Always use ATYP 0x03 for CONNECT command
+        * Merge remote-tracking branch 'upstream/master'
+        * doc: Clarify the libc limitation in README
+        * accept4: Initialize libc symbol early
+        * Bug 23715: Support memfd_create(2).
+        * test: Detect if tor is running in test_fd_passing
+        * No tab in the README
+        * Merge remote-tracking branch 'debian/bugfix/typo-subsytem'
+        * Merge remote-tracking branch 'debian/bugfix/typo-catched'
+               * Merge remote-tracking branch 'debian/bugfix/typo-conect'
+        * doc: Add autogen.sh step to README
+        * Add a -q/--quiet to torsocks
+        * tests: Add a check for a running Tor
+        * Make cpp conditional for definition of handle_mmap match use
+        * utils: Add useful function for later use
+        * man: Some words were missing
+        * Remove clang warnings
+        * Add missing quotes to variable in torsocks.in
+        * Fix check_addr() to return either 0 or 1
+        * Ignore stderr for getcap command
+        * syscall: Add seccomp, gettimeofday, clock_gettime, fork
+        * Fix typo: conect -> connect.
+        * Fix typo: subsytem -> subsystem.
+        * Fix typo: catched -> caught.
+
+- Remove dependency on tor
+
+-------------------------------------------------------------------

Old:
----
  torsocks-2.2.0.tar.gz

New:
----
  torsocks-2.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ torsocks.spec ++++++
--- /var/tmp/diff_new_pack.yDLnIZ/_old  2020-02-15 22:25:55.855326290 +0100
+++ /var/tmp/diff_new_pack.yDLnIZ/_new  2020-02-15 22:25:55.859326292 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package torsocks
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,26 +12,24 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %define _name  libtorsocks
 Name:           torsocks
-Version:        2.2.0
+Version:        2.3.0
 Release:        0
 Summary:        Use SOCKS-friendly applications with Tor
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          Productivity/Networking/Security
-Url:            https://github.com/dgoulet/torsocks
+URL:            https://github.com/dgoulet/torsocks
 Source0:        
https://github.com/dgoulet/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 Source1:        %{name}-rpmlintrc
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  libtool
 Recommends:     libcap-progs
-Requires:       tor
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
 Torsocks allows you to use most applications in a safe way with Tor.
@@ -79,7 +77,7 @@
 autoreconf -fi
 
 %configure --docdir=%{_defaultdocdir}/%{name}
-make %{?_smp_mflags}
+%make_build
 
 %install
 %make_install
@@ -88,16 +86,14 @@
 rm %{buildroot}/%{_libdir}/%{name}/lib%{name}.{a,la}
 
 %post   -n %{name} -p /sbin/ldconfig
-
 %postun -n %{name} -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root,-)
 %doc ChangeLog README.md gpl-2.0.txt doc/socks/SOCKS5 
doc/socks/socks-extensions.txt doc/notes/DEBUG extras/torsocks-bash_completion 
extras/torsocks-zsh_completion
 %{_bindir}/%{name}
-%{_mandir}/man1/%{name}.1%{ext_man}
-%{_mandir}/man5/%{name}.conf.5%{ext_man}
-%{_mandir}/man8/%{name}.8%{ext_man}
+%{_mandir}/man1/%{name}.1%{?ext_man}
+%{_mandir}/man5/%{name}.conf.5%{?ext_man}
+%{_mandir}/man8/%{name}.8%{?ext_man}
 %dir %{_libdir}/%{name}
 %{_libdir}/%{name}/%{_name}.so*
 %config(noreplace) %{_sysconfdir}/tor/%{name}.conf

++++++ torsocks-2.2.0.tar.gz -> torsocks-2.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/ChangeLog new/torsocks-2.3.0/ChangeLog
--- old/torsocks-2.2.0/ChangeLog        2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/ChangeLog        2018-11-19 16:42:40.000000000 +0100
@@ -1,3 +1,39 @@
+2018-11-19 torsocks 2.3.0
+       * Fix a bunch of stuff in the wrapper script, #24967
+       * gethostbyaddr_r: always assign result
+       * log: Remove log line when logging is stopped
+       * gethostbyaddr_r: Don't put garbage in data->hostname
+       * gethostbyaddr_r: Populate h_addrtype field
+       * log: Avoid crash or file corruption when closing logs
+       * connect: Always pass .onion IP cookie to connection object
+       * Merge remote-tracking branch 'yawning/bug23715'
+       * Make torsocks always connect to the configured Tor port
+       * test: Make getpeername test connect to moria1
+       * socks5: Always use ATYP 0x03 for CONNECT command
+       * Merge remote-tracking branch 'upstream/master'
+       * doc: Clarify the libc limitation in README
+       * accept4: Initialize libc symbol early
+       * Bug 23715: Support memfd_create(2).
+       * test: Detect if tor is running in test_fd_passing
+       * No tab in the README
+       * Merge remote-tracking branch 'debian/bugfix/typo-subsytem'
+       * Merge remote-tracking branch 'debian/bugfix/typo-catched'
+       * Merge remote-tracking branch 'debian/bugfix/typo-conect'
+       * doc: Add autogen.sh step to README
+       * Add a -q/--quiet to torsocks
+       * tests: Add a check for a running Tor
+       * Make cpp conditional for definition of handle_mmap match use
+       * utils: Add useful function for later use
+       * man: Some words were missing
+       * Remove clang warnings
+       * Add missing quotes to variable in torsocks.in
+       * Fix check_addr() to return either 0 or 1
+       * Ignore stderr for getcap command
+       * syscall: Add seccomp, gettimeofday, clock_gettime, fork
+       * Fix typo: conect → connect.
+       * Fix typo: subsytem → subsystem.
+       * Fix typo: catched → caught.
+
 2016-10-18 torsocks 2.2.0
        * Use xz for dist tarball now
        * Remove TODO as we use the bugtracker for those
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/README.md new/torsocks-2.3.0/README.md
--- old/torsocks-2.2.0/README.md        2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/README.md        2018-11-19 16:42:40.000000000 +0100
@@ -7,9 +7,13 @@
 that DNS requests are handled safely and explicitly rejects any traffic other
 than TCP from the application you're using.
 
-Torsocks is an ELF shared library that is loaded before all others. The library
-overrides every needed Internet communication libc function calls such as
-connect(2) or gethostbyname(3).
+Torsocks is an ELF shared library that is loaded before all others. The
+library overrides every needed Internet communication libc function calls such
+as connect(2) or gethostbyname(3).
+
+BE ADVISE: It uses the LD\_PRELOAD mechanism (man ld.so.8) which means that if
+the application is not using the libc or for instance uses raw syscalls,
+torsocks will be useless and the traffic will not go through Tor.
 
 This process is transparent to the user and if torsocks detects any
 communication that can't go through the Tor network such as UDP traffic, for
@@ -20,7 +24,7 @@
 Requirements
 -----------------
 
-    - autoconf
+       - autoconf
        - automake
        - libtool
        - gcc
@@ -28,6 +32,7 @@
 Installation
 -----------------
 
+    $ ./autogen.sh
     $ ./configure
     $ make
     $ sudo make install
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/configure.ac 
new/torsocks-2.3.0/configure.ac
--- old/torsocks-2.2.0/configure.ac     2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/configure.ac     2018-11-19 16:42:40.000000000 +0100
@@ -3,7 +3,7 @@
 ##############################################################################
 
 # Process this file with autoconf to produce a configure script.
-AC_INIT([torsocks], 
[2.2.0],[dgou...@torproject.org],[],[https://torproject.org])
+AC_INIT([torsocks], 
[2.3.0],[dgou...@torproject.org],[],[https://torproject.org])
 AC_CONFIG_AUX_DIR([config])
 AC_CANONICAL_TARGET
 # Get hostname and other information.
@@ -252,9 +252,6 @@
 AX_CHECK_COMPILE_FLAG([-fstack-protector-all],
        [CFLAGS="$CFLAGS -fstack-protector-all"],[],[]
 )
-AX_CHECK_COMPILE_FLAG([-fno-strict-overflow],
-       [CFLAGS="$CFLAGS -fno-strict-overflow"],[],[]
-)
 
 dnl Add hardening linker flags
 AX_CHECK_LINK_FLAG([-pie],[LDFLAGS="$LDFLAGS -pie"],[],[])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/doc/torsocks.1 
new/torsocks-2.3.0/doc/torsocks.1
--- old/torsocks-2.2.0/doc/torsocks.1   2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/doc/torsocks.1   2018-11-19 16:42:40.000000000 +0100
@@ -61,6 +61,9 @@
 .BR "\-d, \-\-debug"
 Activate the debug mode. Output will be written on stderr.
 .TP
+.BR "\-q, \-\-quiet"
+Suppress every log messages (even errors).
+.TP
 .BR "on | off"
 This option adds or removes \fBtorsocks(8)\fP from the LD_PRELOAD environment
 variable for the current shell. If you want to use this option, you HAVE to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/doc/torsocks.8 
new/torsocks-2.3.0/doc/torsocks.8
--- old/torsocks-2.2.0/doc/torsocks.8   2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/doc/torsocks.8   2018-11-19 16:42:40.000000000 +0100
@@ -137,7 +137,7 @@
 Torsocks uses ELF dynamic loader features to intercept dynamic function calls
 from programs in which it is embedded. As a result, non-ELF executables, or
 executables that make system calls directly with the system call trap (int
-0x80).
+0x80) are not supported.
 
 .SH FILES
 /etc/tor/torsocks.conf - default torsocks configuration file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/bin/torsocks.in 
new/torsocks-2.3.0/src/bin/torsocks.in
--- old/torsocks-2.2.0/src/bin/torsocks.in      2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/bin/torsocks.in      2018-11-19 16:42:40.000000000 
+0100
@@ -58,6 +58,7 @@
 # Tamas Szerb <t...@rulez.org>
 # Modified by Robert Hogan <rob...@roberthogan.net> April 16th 2006
 # Modified by David Goulet <dgou...@ev0ke.net> 2013
+# Modified by Alex Xu (Hello71) <alex_y...@yahoo.ca> 2018
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
@@ -67,15 +68,108 @@
 SHLIB_EXT="@SHLIB_EXT@"
 SHLIB="${LIBDIR}/${LIB_NAME}.${SHLIB_EXT}"
 
+# https://github.com/mkropat/sh-realpath
+#
+# Copyright (c) 2014 Michael Kropat
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+realpath() {
+    canonicalize_path "$(resolve_symlinks "$1")"
+}
+
+resolve_symlinks() {
+    _resolve_symlinks "$1"
+}
+
+_resolve_symlinks() {
+    _assert_no_path_cycles "$@" || return
+
+    local dir_context path
+    path=$(readlink -- "$1")
+    if [ $? -eq 0 ]; then
+        dir_context=$(dirname -- "$1")
+        _resolve_symlinks "$(_prepend_dir_context_if_necessary "$dir_context" 
"$path")" "$@"
+    else
+        printf '%s\n' "$1"
+    fi
+}
+
+_prepend_dir_context_if_necessary() {
+    if [ "$1" = . ]; then
+        printf '%s\n' "$2"
+    else
+        _prepend_path_if_relative "$1" "$2"
+    fi
+}
+
+_prepend_path_if_relative() {
+    case "$2" in
+        /* ) printf '%s\n' "$2" ;;
+         * ) printf '%s\n' "$1/$2" ;;
+    esac
+}
+
+_assert_no_path_cycles() {
+    local target path
+
+    target=$1
+    shift
+
+    for path in "$@"; do
+        if [ "$path" = "$target" ]; then
+            return 1
+        fi
+    done
+}
+
+canonicalize_path() {
+    if [ -d "$1" ]; then
+        _canonicalize_dir_path "$1"
+    else
+        _canonicalize_file_path "$1"
+    fi
+}
+
+_canonicalize_dir_path() {
+    (cd "$1" 2>/dev/null && pwd -P)
+}
+
+_canonicalize_file_path() {
+    local dir file
+    dir=$(dirname -- "$1")
+    file=$(basename -- "$1")
+    (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file")
+}
+
 # Set @LDPRELOAD@ variable with torsocks library path.
 set_ld_preload ()
 {
-       if [ -z "$@LDPRELOAD@" ]; then
-               export @LDPRELOAD@="${SHLIB}"
-       else
-               echo $@LDPRELOAD@ | grep -q "${SHLIB}" || \
-                       export @LDPRELOAD@="${SHLIB} $@LDPRELOAD@"
-       fi
+       case "$@LDPRELOAD@" in
+               *"${SHLIB}"*) ;;
+               '')
+                       export @LDPRELOAD@="${SHLIB}"
+                       ;;
+               *)
+                       export @LDPRELOAD@="${SHLIB}:$@LDPRELOAD@"
+                       ;;
+       esac
 
        # OS X specific env variable
        case "$OSTYPE" in
@@ -88,7 +182,7 @@
 # Report error due to Apple's System Integrity Protection.
 macos_sip_error ()
 {
-       echo "ERROR: $1 is located in a directory protected by Apple's System 
Integrity Protection." >&2
+       printf "ERROR: %s is located in a directory protected by Apple's System 
Integrity Protection.\n" "$1" >&2
        exit 1
 }
 
@@ -101,21 +195,20 @@
                darwin*)
                        # We need to figure out if Apple's System Integrity 
Protection is
                        # enabled on the users' system.
-                       if /usr/bin/csrutil status | grep -q enabled; then
-                               local abs_app_dir=`cd "$(dirname "$app_path")" 
&& pwd -P`
-
-                               # It seems like /usr/** (with an exception of 
/usr/local/**),
-                               # /System/**, /sbin/**, and /bin/** are 
currently protected
-                               # using SIP.
-                               case "$abs_app_dir/`basename $app_path`" in
-                                       /usr/local/*)
-                                               # Must be listed before the 
match on /usr/*
-                                               ;;
-                                       /usr/*|/System/*|/sbin/*|/bin/*)
-                                               macos_sip_error $app_path
-                                               ;;
-                               esac
-                       fi
+                       case "$(/usr/bin/csrutil status)" in
+                               *enabled*)
+                                       # It seems like /usr/** (with an 
exception of /usr/local/**),
+                                       # /System/**, /sbin/**, and /bin/** are 
currently protected
+                                       # using SIP.
+                                       case "$(realpath "$app_path")" in
+                                               /usr/local/*)
+                                                       # Must be listed before 
the match on /usr/*
+                                                       ;;
+                                               /usr/*|/System/*|/sbin/*|/bin/*)
+                                                       macos_sip_error 
"$app_path"
+                                                       ;;
+                                       esac
+                       esac
                        ;;
        esac
 }
@@ -124,19 +217,19 @@
 tor_shell ()
 {
        set_ld_preload
-       echo "$0: New torified shell coming right up..."
+       echo "New torified shell coming right up..."
        ${SHELL:-/bin/sh}
 }
 
 torify_app ()
 {
-       local app_path=`which $1`
-       local getcap=`PATH="$PATH:/usr/sbin:/sbin" which getcap`
+       local app_path="$(command -v "$1")"
+       local getcap="$(PATH="$PATH:/usr/sbin:/sbin" command -v 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,26 +237,24 @@
        # 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
-               echo "ERROR: $1 gains the following elevated capabilities. 
torsocks will \
-not work with privledged executables.
-$caps" >&2
+               printf "ERROR: %s gains the following elevated capabilities. 
torsocks will not work with privileged executables.\n%s" "$app_path" "$caps" >&2
                exit 1
        fi
 
@@ -218,24 +309,23 @@
        exit 1
 fi
 
-# Ensure libtorsocks exists,
-if [ ! -f $SHLIB ]; then
-   echo "$0: $SHLIB does not exist! Try re-installing torsocks."
-   exit
+if [ ! -e "$SHLIB" ]; then
+   echo "ERROR: $SHLIB does not exist! Try re-installing torsocks." >&2
+   exit 1
 fi
 
 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@="$(printf '%s' "$@LDPRELOAD@" | sed 
"s#$SHLIB *##")"
                        if [ -z "$@LDPRELOAD@" ]; then
                                unset @LDPRELOAD@
                                case "$OSTYPE" in
@@ -248,7 +338,7 @@
                        break
                        ;;
                show|sh)
-                       echo "@LDPRELOAD@=\"$@LDPRELOAD@\""
+                       printf '%s="%s"\n' "@LDPRELOAD@" "$@LDPRELOAD@"
                        break
                        ;;
                -h|--help)
@@ -256,35 +346,35 @@
                        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)
@@ -294,6 +384,10 @@
                        # Set full DEBUG with 5 being the highest possible 
level.
                        export TORSOCKS_LOG_LEVEL=5
                        ;;
+               -q|--quiet)
+                       # Silence logging.
+                       export TORSOCKS_LOG_LEVEL=1
+                       ;;
                --shell)
                        tor_shell
                        break
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/compat.h 
new/torsocks-2.3.0/src/common/compat.h
--- old/torsocks-2.2.0/src/common/compat.h      2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/common/compat.h      2018-11-19 16:42:40.000000000 
+0100
@@ -114,6 +114,21 @@
 #ifndef __NR_sched_getaffinity
 #define __NR_sched_getaffinity -14
 #endif
+#ifndef __NR_seccomp
+#define __NR_seccomp -15
+#endif
+#ifndef __NR_gettimeofday
+#define __NR_gettimeofday -16
+#endif
+#ifndef __NR_clock_gettime
+#define __NR_clock_gettime -17
+#endif
+#ifndef __NR_fork
+#define __NR_fork -18
+#endif
+#ifndef __NR_memfd_create
+#define __NR_memfd_create -19
+#endif
 
 #define TSOCKS_NR_SOCKET    __NR_socket
 #define TSOCKS_NR_CONNECT   __NR_connect
@@ -129,6 +144,11 @@
 #define TSOCKS_NR_FUTEX     __NR_futex
 #define TSOCKS_NR_ACCEPT4   __NR_accept4
 #define TSOCKS_NR_SCHED_GETAFFINITY __NR_sched_getaffinity
+#define TSOCKS_NR_SECCOMP   __NR_seccomp
+#define TSOCKS_NR_GETTIMEOFDAY __NR_gettimeofday
+#define TSOCKS_NR_CLOCK_GETTIME __NR_clock_gettime
+#define TSOCKS_NR_FORK      __NR_fork
+#define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create
 
 /*
  * Despite glibc providing wrappers for these calls for a long time
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/ht.h 
new/torsocks-2.3.0/src/common/ht.h
--- old/torsocks-2.2.0/src/common/ht.h  2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/src/common/ht.h  2018-11-19 16:42:40.000000000 +0100
@@ -133,7 +133,7 @@
   int name##_HT_GROW(struct name *ht, unsigned min_capacity);           \
   void name##_HT_CLEAR(struct name *ht);                                \
   int name##_HT_REP_IS_BAD_(const struct name *ht);                     \
-  static inline void                                                    \
+  ATTR_UNUSED static inline void                                        \
   name##_HT_INIT(struct name *head) {                                   \
     head->hth_table_length = 0;                                         \
     head->hth_table = NULL;                                             \
@@ -143,7 +143,7 @@
   }                                                                     \
   /* Helper: returns a pointer to the right location in the table       \
    * 'head' to find or insert the element 'elm'. */                     \
-  static inline struct type **                                          \
+  ATTR_UNUSED static inline struct type **                              \
   name##_HT_FIND_P_(struct name *head, struct type *elm)                \
   {                                                                     \
     struct type **p;                                                    \
@@ -157,9 +157,9 @@
     }                                                                   \
     return p;                                                           \
   }                                                                     \
-  /* Return a pointer to the element in the table 'head' matching 'elm', \
-   * or NULL if no such element exists */                               \
-  static inline struct type *                                           \
+  /* Return a pointer to the element in the table 'head' matching       \
+   * 'elm', or NULL if no such element exists */                        \
+  ATTR_UNUSED static inline struct type *                               \
   name##_HT_FIND(const struct name *head, struct type *elm)             \
   {                                                                     \
     struct type **p;                                                    \
@@ -170,11 +170,12 @@
   }                                                                     \
   /* Insert the element 'elm' into the table 'head'.  Do not call this  \
    * function if the table might already contain a matching element. */ \
-  static inline void                                                    \
+  ATTR_UNUSED static inline void                                        \
   name##_HT_INSERT(struct name *head, struct type *elm)                 \
   {                                                                     \
     struct type **p;                                                    \
-    if (!head->hth_table || head->hth_n_entries >= head->hth_load_limit) \
+    if (!head->hth_table ||                                             \
+        head->hth_n_entries >= head->hth_load_limit)                    \
       name##_HT_GROW(head, head->hth_n_entries+1);                      \
     ++head->hth_n_entries;                                              \
     HT_SET_HASH_(elm, field, hashfn);                                   \
@@ -185,7 +186,7 @@
   /* Insert the element 'elm' into the table 'head'. If there already   \
    * a matching element in the table, replace that element and return   \
    * it. */                                                             \
-  static inline struct type *                                           \
+  ATTR_UNUSED static inline struct type *                               \
   name##_HT_REPLACE(struct name *head, struct type *elm)                \
   {                                                                     \
     struct type **p, *r;                                                \
@@ -206,7 +207,7 @@
   }                                                                     \
   /* Remove any element matching 'elm' from the table 'head'.  If such  \
    * an element is found, return it; otherwise return NULL. */          \
-  static inline struct type *                                           \
+  ATTR_UNUSED static inline struct type *                               \
   name##_HT_REMOVE(struct name *head, struct type *elm)                 \
   {                                                                     \
     struct type **p, *r;                                                \
@@ -224,7 +225,7 @@
    * using 'data' as its second argument.  If the function returns      \
    * nonzero, remove the most recently examined element before invoking \
    * the function again. */                                             \
-  static inline void                                                    \
+  ATTR_UNUSED static inline void                                        \
   name##_HT_FOREACH_FN(struct name *head,                               \
                        int (*fn)(struct type *, void *),                \
                        void *data)                                      \
@@ -250,7 +251,7 @@
   /* Return a pointer to the first element in the table 'head', under   \
    * an arbitrary order.  This order is stable under remove operations, \
    * but not under others. If the table is empty, return NULL. */       \
-  static inline struct type **                                          \
+  ATTR_UNUSED static inline struct type **                              \
   name##_HT_START(struct name *head)                                    \
   {                                                                     \
     unsigned b = 0;                                                     \
@@ -266,7 +267,7 @@
    * NULL.  If 'elm' is to be removed from the table, you must call     \
    * this function for the next value before you remove it.             \
    */                                                                   \
-  static inline struct type **                                          \
+  ATTR_UNUSED static inline struct type **                              \
   name##_HT_NEXT(struct name *head, struct type **elm)                  \
   {                                                                     \
     if ((*elm)->field.hte_next) {                                       \
@@ -282,7 +283,7 @@
       return NULL;                                                      \
     }                                                                   \
   }                                                                     \
-  static inline struct type **                                          \
+  ATTR_UNUSED static inline struct type **                              \
   name##_HT_NEXT_RMV(struct name *head, struct type **elm)              \
   {                                                                     \
     unsigned h = HT_ELT_HASH_(*elm, field, hashfn);                     \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/log.c 
new/torsocks-2.3.0/src/common/log.c
--- old/torsocks-2.2.0/src/common/log.c 2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/src/common/log.c 2018-11-19 16:42:40.000000000 +0100
@@ -145,20 +145,22 @@
        }
 
        if (filepath) {
-               logconfig.fp = fopen(filepath, "a");
-               if (!logconfig.fp) {
-                       fprintf(stderr, "[tsocks] Unable to open log file 
%s\n", filepath);
+               logconfig.filepath = strdup(filepath);
+               if (!logconfig.filepath) {
+                       perror("[tsocks] log init strdup");
                        ret = -errno;
                        goto error;
                }
 
-               logconfig.filepath = strdup(filepath);
-               if (!logconfig.filepath) {
-                       perror("[tsocks] log init strdup");
+               logconfig.fp = fopen(filepath, "a");
+               if (!logconfig.fp) {
+                       fprintf(stderr, "[tsocks] Unable to open log file 
%s\n", filepath);
+                       free(logconfig.filepath);
+                       logconfig.filepath = NULL;
                        ret = -errno;
-                       fclose(logconfig.fp);
                        goto error;
                }
+               setbuf(logconfig.fp, NULL);
        } else {
                /* The default output is stderr if no filepath is given. */
                ret = fileno(stderr);
@@ -182,12 +184,21 @@
 void log_destroy(void)
 {
        free(logconfig.filepath);
-       if (logconfig.fp) {
-               int ret;
+       logconfig.filepath = NULL;
 
-               ret = fclose(logconfig.fp);
-               if (ret) {
-                       perror("[tsocks] fclose log destroy");
-               }
+       /* Don't call fclose() because torsocks fclose() generates log messages 
and
+        * so calling it here could cause a loop. Just zero out the fp so it 
won't
+        * be used again. */
+       logconfig.fp = NULL;
+}
+
+/*
+ * Clean up if the fd for the log file gets closed.
+ */
+ATTR_HIDDEN
+void log_fd_close_notify(int fd)
+{
+       if (fd >= 0 && logconfig.fp && (fd == fileno(logconfig.fp))) {
+               log_destroy();
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/log.h 
new/torsocks-2.3.0/src/common/log.h
--- old/torsocks-2.2.0/src/common/log.h 2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/src/common/log.h 2018-11-19 16:42:40.000000000 +0100
@@ -51,6 +51,7 @@
 void log_print(const char *fmt, ...);
 int log_init(int level, const char *filepath, enum log_time_status t_status);
 void log_destroy(void);
+void log_fd_close_notify(int fd);
 
 #define __tsocks_print(level, fmt, args...) \
        do { \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/macros.h 
new/torsocks-2.3.0/src/common/macros.h
--- old/torsocks-2.2.0/src/common/macros.h      2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/common/macros.h      2018-11-19 16:42:40.000000000 
+0100
@@ -41,6 +41,10 @@
 #define ATTR_HIDDEN __attribute__((visibility("hidden")))
 #endif
 
+#ifndef ATTR_UNUSED
+#define ATTR_UNUSED __attribute__ ((unused))
+#endif
+
 #ifndef min
 #define min(a, b) ((a) < (b) ? (a) : (b))
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/socks5.c 
new/torsocks-2.3.0/src/common/socks5.c
--- old/torsocks-2.2.0/src/common/socks5.c      2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/common/socks5.c      2018-11-19 16:42:40.000000000 
+0100
@@ -165,7 +165,7 @@
         * the right socket family. Thus, trying to establish a connection to a
         * remote IPv6, we have to connect to the Tor daemon in v6.
         */
-       switch (conn->dest_addr.domain) {
+       switch (tsocks_config.socks5_addr.domain) {
        case CONNECTION_DOMAIN_NAME:
                /*
                 * For a domain name such as an onion address, use the default 
IPv4 to
@@ -385,75 +385,60 @@
        unsigned char buffer[1500];
        ssize_t buf_len, ret_send;
        struct socks5_request msg;
+       struct socks5_request_domain req_name;
+       const char *retp;
 
        assert(conn);
        assert(conn->fd >= 0);
 
+       memset(&req_name, 0, sizeof(req_name));
        memset(buffer, 0, sizeof(buffer));
        buf_len = sizeof(msg);
 
+       /* Set up the header part. It is always the same, even the address type 
as
+        * Tor handles IPv4/IPv6 as a Domain Name so SafeSocks doesn't 
complain. For
+        * this reason, we always send ATYP 0x03 (domain name) to Tor. */
        msg.ver = SOCKS5_VERSION;
        msg.cmd = SOCKS5_CMD_CONNECT;
        /* Always zeroed. */
        msg.rsv = 0;
+       msg.atyp = SOCKS5_ATYP_DOMAIN;
+       memcpy(buffer, &msg, buf_len);
 
+       /* Depending on the domain of the connection, we'll set the hostname
+        * accordingly that is transforming the address into a text format. */
        switch (conn->dest_addr.domain) {
        case CONNECTION_DOMAIN_INET:
        {
-               struct socks5_request_ipv4 req_ipv4;
-
-               msg.atyp = SOCKS5_ATYP_IPV4;
-               /* Copy the first part of the request. */
-               memcpy(buffer, &msg, buf_len);
-
-               /* Prepare the ipv4 payload to be copied in the send buffer. */
-               memcpy(req_ipv4.addr, &conn->dest_addr.u.sin.sin_addr,
-                               sizeof(req_ipv4.addr));
-               req_ipv4.port = conn->dest_addr.u.sin.sin_port;
-
-               /* Copy ipv4 request portion in the buffer. */
-               memcpy(buffer + buf_len, &req_ipv4, sizeof(req_ipv4));
-               buf_len += sizeof(req_ipv4);
+               retp = inet_ntop(AF_INET, &conn->dest_addr.u.sin.sin_addr,
+                               (char *) req_name.name, sizeof(req_name.name));
+               if (retp == NULL) {
+                       ERR("Socks5 connection malformed IPv4");
+                       ret = -EINVAL;
+                       goto error;
+               }
+               req_name.port = conn->dest_addr.u.sin.sin_port;
                break;
        }
        case CONNECTION_DOMAIN_INET6:
        {
-               struct socks5_request_ipv6 req_ipv6;
-
-               msg.atyp = SOCKS5_ATYP_IPV6;
-               /* Copy the first part of the request. */
-               memcpy(buffer, &msg, buf_len);
-
-               /* Prepare the ipv6 payload to be copied in the send buffer. */
-               memcpy(req_ipv6.addr, &conn->dest_addr.u.sin6.sin6_addr,
-                               sizeof(req_ipv6.addr));
-               req_ipv6.port = conn->dest_addr.u.sin6.sin6_port;
-
-               /* Copy ipv6 request portion in the buffer. */
-               memcpy(buffer + buf_len, &req_ipv6, sizeof(req_ipv6));
-               buf_len += sizeof(req_ipv6);
+               retp = inet_ntop(AF_INET6, &conn->dest_addr.u.sin6.sin6_addr,
+                               (char *) req_name.name, sizeof(req_name.name));
+               if (retp == NULL) {
+                       ERR("Socks5 connection malformed IPv4");
+                       ret = -EINVAL;
+                       goto error;
+               }
+               req_name.port = conn->dest_addr.u.sin6.sin6_port;
                break;
        }
        case CONNECTION_DOMAIN_NAME:
        {
-               struct socks5_request_domain req_name;
-
-               msg.atyp = SOCKS5_ATYP_DOMAIN;
-               /* Copy the first part of the request. */
-               memcpy(buffer, &msg, buf_len);
-
                /* Setup domain name request buffer. */
                req_name.len = strlen(conn->dest_addr.hostname.addr);
-               memcpy(req_name.name, conn->dest_addr.hostname.addr, 
req_name.len);
+               memcpy(req_name.name, conn->dest_addr.hostname.addr,
+                                               
strlen(conn->dest_addr.hostname.addr));
                req_name.port = conn->dest_addr.hostname.port;
-
-               /* Copy ipv6 request portion in the buffer. */
-               memcpy(buffer + buf_len, &req_name.len, sizeof(req_name.len));
-               buf_len += sizeof(req_name.len);
-               memcpy(buffer + buf_len, req_name.name, req_name.len);
-               buf_len += req_name.len;
-               memcpy(buffer + buf_len, &req_name.port, sizeof(req_name.port));
-               buf_len += sizeof(req_name.port);
                break;
        }
        default:
@@ -462,6 +447,15 @@
                goto error;
        }
 
+       /* Common for everyone, copy the filled up request buffer. */
+       req_name.len = strlen((char *) req_name.name);
+       memcpy(buffer + buf_len, &req_name.len, sizeof(req_name.len));
+       buf_len += sizeof(req_name.len);
+       memcpy(buffer + buf_len, req_name.name, req_name.len);
+       buf_len += req_name.len;
+       memcpy(buffer + buf_len, &req_name.port, sizeof(req_name.port));
+       buf_len += sizeof(req_name.port);
+
        DBG("Socks5 sending connect request to fd %d", conn->fd);
 
        ret_send = send_data(conn->fd, &buffer, buf_len);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/utils.c 
new/torsocks-2.3.0/src/common/utils.c
--- old/torsocks-2.2.0/src/common/utils.c       2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/common/utils.c       2018-11-19 16:42:40.000000000 
+0100
@@ -45,8 +45,8 @@
 };
 
 /*
- * Return 1 if the given IP belongs in the af domain else return a negative
- * value.
+ * Return 1 if the given IP belongs in the af domain else return 0 if the
+ * given ip is not a valid address or the af value is unknown.
  */
 static int check_addr(const char *ip, int af)
 {
@@ -56,9 +56,10 @@
        assert(ip);
 
        ret = inet_pton(af, ip, buf);
-       if (ret != 1) {
-               ret = -1;
-       }
+  if (ret == -1) {
+    /* Possible if the af value is unknown to inet_pton. */
+    ret = 0;
+  }
 
        return ret;
 }
@@ -365,3 +366,31 @@
 
        return port;
 }
+
+/*
+ * For a given sockaddr, return a const pointer to the address data structure.
+ * Return NULL if family is not IPv4 or IPv6.
+ */
+ATTR_HIDDEN
+const char *utils_get_addr_from_sockaddr(const struct sockaddr *sa)
+{
+  static char buf[256];
+  const void *addrp;
+
+  assert(sa);
+
+  memset(buf, 0, sizeof(buf));
+
+  if (sa->sa_family == AF_INET) {
+    addrp = &((const struct sockaddr_in *) sa)->sin_addr;
+  } else if (sa->sa_family == AF_INET6) {
+    addrp = &((const struct sockaddr_in6 *) sa)->sin6_addr;
+  } else {
+    goto end;
+  }
+
+  inet_ntop(sa->sa_family, addrp, buf, sizeof(buf));
+
+end:
+  return buf;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/common/utils.h 
new/torsocks-2.3.0/src/common/utils.h
--- old/torsocks-2.2.0/src/common/utils.h       2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/common/utils.h       2018-11-19 16:42:40.000000000 
+0100
@@ -1,7 +1,7 @@
 /*
- * Copyright (C) 2000-2008 - Shaun Clowes <del...@progsoc.org> 
- *                              2008-2011 - Robert Hogan 
<rob...@roberthogan.net>
- *                                       2013 - David Goulet 
<dgou...@ev0ke.net>
+ * Copyright (C) 2000-2008 - Shaun Clowes <del...@progsoc.org>
+ *               2008-2011 - Robert Hogan <rob...@roberthogan.net>
+ *               2013 - David Goulet <dgou...@ev0ke.net>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License, version 2 only, as
@@ -34,5 +34,6 @@
 int utils_localhost_resolve(const char *name, int af, void *buf, size_t len);
 int utils_is_addr_any(const struct sockaddr *sa);
 int utils_get_port_from_addr(const struct sockaddr *sa);
+const char *utils_get_addr_from_sockaddr(const struct sockaddr *sa);
 
 #endif /* TORSOCKS_UTILS_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/lib/close.c 
new/torsocks-2.3.0/src/lib/close.c
--- old/torsocks-2.2.0/src/lib/close.c  2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/src/lib/close.c  2018-11-19 16:42:40.000000000 +0100
@@ -52,6 +52,12 @@
                connection_put_ref(conn);
        }
 
+       /*
+        * Let the log system detect when the log file fd is about to be
+        * closed and clean up.
+        */
+       log_fd_close_notify(fd);
+
        /* Return the original libc close. */
        return tsocks_libc_close(fd);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/lib/connect.c 
new/torsocks-2.3.0/src/lib/connect.c
--- old/torsocks-2.2.0/src/lib/connect.c        2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/lib/connect.c        2018-11-19 16:42:40.000000000 
+0100
@@ -60,7 +60,7 @@
         * to allow AF_UNIX/_LOCAL socket to work with torsocks.
         */
        if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6) {
-               DBG("[conect] Connection is not IPv4/v6. Ignoring.");
+               DBG("[connect] Connection is not IPv4/v6. Ignoring.");
                /* Ask the call to use the libc connect. */
                goto libc_call;
        }
@@ -156,10 +156,11 @@
        onion_pool_unlock(&tsocks_onion_pool);
        if (on_entry) {
                /*
-                * Create a connection without a destination address since we 
will set
+                * Create a connection with the onion IP cookie since 
getpeername()
+                * might need it, and set connection domain and hostname to use
                 * the onion address name found before.
                 */
-               new_conn = connection_create(sockfd, NULL);
+               new_conn = connection_create(sockfd, addr);
                if (!new_conn) {
                        errno = ENOMEM;
                        goto error;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/lib/gethostbyname.c 
new/torsocks-2.3.0/src/lib/gethostbyname.c
--- old/torsocks-2.2.0/src/lib/gethostbyname.c  2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/lib/gethostbyname.c  2018-11-19 16:42:40.000000000 
+0100
@@ -263,9 +263,12 @@
        /* This call allocates hostname. On error, it's untouched. */
        ret = tsocks_tor_resolve_ptr(addr, &data->hostname, type);
        if (ret < 0) {
+               /* We can represent any IPv4 address in dotted quad notation in 
fewer than
+                * 32 bytes (max should be 16 if we count a nul terminator). */
+               char addrbuf[32];
                const char *ret_str;
 
-               ret_str = inet_ntop(type, addr, buf, buflen);
+               ret_str = inet_ntop(type, addr, &addrbuf[0], sizeof(addrbuf));
                if (!ret_str) {
                        ret = HOST_NOT_FOUND;
                        if (errno == ENOSPC) {
@@ -301,6 +304,7 @@
 
        he->h_aliases = NULL;
        he->h_length = strlen(he->h_name);
+       he->h_addrtype = type;
        /* Assign the address list within the data of the given buffer. */
        data->addr_list[0] = (char *) addr;
        data->addr_list[1] = NULL;
@@ -345,6 +349,9 @@
                char padding[];
        } *data;
 
+       /* result must be NULL if no entry is found or if an error occurs */
+       *result = NULL;
+
        DBG("[gethostbyname_r] Requesting %s hostname", name);
 
        if (!name) {
@@ -386,6 +393,9 @@
        he->h_length = sizeof(in_addr_t);
        he->h_addrtype = AF_INET;
 
+       /* Assign result as specified by the documentation */
+       *result = he;
+
        DBG("[gethostbyname_r] Hostname %s resolved to %u.%u.%u.%u", name,
                        ip & 0XFF, (ip >> 8) & 0XFF, (ip >> 16) & 0XFF, (ip >> 
24) & 0xFF);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/lib/syscall.c 
new/torsocks-2.3.0/src/lib/syscall.c
--- old/torsocks-2.2.0/src/lib/syscall.c        2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/lib/syscall.c        2018-11-19 16:42:40.000000000 
+0100
@@ -84,7 +84,7 @@
        return tsocks_accept(sockfd, addr, &addrlen);
 }
 
-#if (defined(__linux__) || defined(__darwin__) || (defined(__FreeBSD_kernel__) 
&& defined(__i386__)) || defined(__NetBSD__))
+#if !((defined(__NetBSD__) || defined(__FreeBSD__) || 
defined(__FreeBSD_kernel__)) && defined(__x86_64))
 /*
  * Handle mmap(2) syscall.
  */
@@ -104,7 +104,7 @@
 
        return (LIBC_SYSCALL_RET_TYPE) mmap(addr, len, prot, flags, fd, offset);
 }
-#endif /* __linux__, __darwin__, __FreeBSD_kernel__, __i386__, __NetBSD__ */
+#endif /* __NetBSD__, __FreeBSD__, __FreeBSD_kernel__, __x86_64 */
 
 /*
  * Handle munmap(2) syscall.
@@ -372,6 +372,71 @@
 
        return inotify_rm_watch(fd, wd);
 }
+
+/*
+ * Handle seccomp(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_seccomp(va_list args)
+{
+       unsigned int operation, flags;
+       void *sargs;
+
+       operation = va_arg(args, __typeof__(operation));
+       flags = va_arg(args, __typeof__(flags));
+       sargs = va_arg(args, __typeof__(sargs));
+
+       return tsocks_libc_syscall(TSOCKS_NR_SECCOMP, operation, flags, sargs);
+}
+
+/*
+ * Handle gettimeofday(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_gettimeofday(va_list args)
+{
+       struct timeval *tv;
+       struct timezone *tz;
+
+       tv = va_arg(args, __typeof__(tv));
+       tz = va_arg(args, __typeof__(tz));
+
+       return tsocks_libc_syscall(TSOCKS_NR_GETTIMEOFDAY, tv, tz);
+}
+
+/*
+ * Handle clock_gettime(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_clock_gettime(va_list args)
+{
+       clockid_t clk_id;
+       struct timespec *tp;
+
+       clk_id = va_arg(args, __typeof__(clk_id));
+       tp = va_arg(args, __typeof__(tp));
+
+       return tsocks_libc_syscall(TSOCKS_NR_CLOCK_GETTIME, clk_id, tp);
+}
+
+/*
+ * Handle fork(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_fork(void)
+{
+       return tsocks_libc_syscall(TSOCKS_NR_FORK);
+}
+
+/*
+ * Handle memfd_create(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_memfd_create(va_list args)
+{
+       const char *name;
+       unsigned int flags;
+
+       name = va_arg(args, __typeof__(name));
+       flags = va_arg(args, __typeof__(flags));
+
+       return tsocks_libc_syscall(TSOCKS_NR_MEMFD_CREATE, name, flags);
+}
 #endif /* __linux__ */
 
 /*
@@ -478,6 +543,21 @@
        case TSOCKS_NR_SCHED_GETAFFINITY:
                ret = handle_sched_getaffinity(args);
                break;
+       case TSOCKS_NR_SECCOMP:
+               ret = handle_seccomp(args);
+               break;
+       case TSOCKS_NR_GETTIMEOFDAY:
+               ret = handle_gettimeofday(args);
+               break;
+       case TSOCKS_NR_CLOCK_GETTIME:
+               ret = handle_clock_gettime(args);
+               break;
+       case TSOCKS_NR_FORK:
+               ret = handle_fork();
+               break;
+       case TSOCKS_NR_MEMFD_CREATE:
+               ret = handle_memfd_create(args);
+               break;
 #endif /* __linux__ */
        default:
                /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/src/lib/torsocks.c 
new/torsocks-2.3.0/src/lib/torsocks.c
--- old/torsocks-2.2.0/src/lib/torsocks.c       2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/src/lib/torsocks.c       2018-11-19 16:42:40.000000000 
+0100
@@ -234,8 +234,9 @@
        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);
-       if (!tsocks_libc_connect || !tsocks_libc_close || !tsocks_libc_socket
-                       || !tsocks_libc_syscall || !tsocks_libc_execve) {
+       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) {
                ERR("Unable to lookup symbols in " LIBC_NAME "(%s)", dlerror());
                goto error;
        }
@@ -256,7 +257,7 @@
 }
 
 /*
- * Initialize logging subsytem using either the default values or the one given
+ * Initialize logging subsystem using either the default values or the one 
given
  * by the environment variables.
  */
 static void init_logging(void)
@@ -299,7 +300,7 @@
 
        /* After this, it is safe to call any logging macros. */
 
-       DBG("Logging subsytem initialized. Level %d, file %s, time %d",
+       DBG("Logging subsystem initialized. Level %d, file %s, time %d",
                        level, filepath, t_status);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/Makefile.am 
new/torsocks-2.3.0/tests/Makefile.am
--- old/torsocks-2.2.0/tests/Makefile.am        2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/tests/Makefile.am        2018-11-19 16:42:40.000000000 
+0100
@@ -17,9 +17,11 @@
 
 LIBTORSOCKS=$(top_builddir)/src/lib/libtorsocks.la
 
+HELPER_SOURCES = helpers.c helpers.h
+
 noinst_PROGRAMS = test_dns test_socket test_connect test_fd_passing 
test_getpeername
 
-test_dns_SOURCES = test_dns.c
+test_dns_SOURCES = test_dns.c $(HELPER_SOURCES)
 test_dns_LDADD = $(LIBTAP) $(LIBTORSOCKS)
 
 test_socket_SOURCES = test_socket.c
@@ -28,8 +30,8 @@
 test_connect_SOURCES = test_connect.c
 test_connect_LDADD = $(LIBTAP) $(LIBTORSOCKS)
 
-test_fd_passing_SOURCES = test_fd_passing.c
+test_fd_passing_SOURCES = test_fd_passing.c $(HELPER_SOURCES)
 test_fd_passing_LDADD = $(LIBTAP) $(LIBTORSOCKS) -lpthread
 
-test_getpeername_SOURCES = test_getpeername.c
+test_getpeername_SOURCES = test_getpeername.c $(HELPER_SOURCES)
 test_getpeername_LDADD = $(LIBTAP) $(LIBTORSOCKS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/helpers.c 
new/torsocks-2.3.0/tests/helpers.c
--- old/torsocks-2.2.0/tests/helpers.c  1970-01-01 01:00:00.000000000 +0100
+++ new/torsocks-2.3.0/tests/helpers.c  2018-11-19 16:42:40.000000000 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 - David Goulet <dgou...@ev0ke.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <arpa/inet.h>
+
+#include "lib/torsocks.h"
+
+#include "helpers.h"
+
+/* Try to connect to SocksPort localhost:9050 and if we can't skip. This is
+ * to avoid to have failing test if no tor daemon is available. Return 1 if
+ * true else 0. */
+int
+helper_is_default_tor_running(void)
+{
+  int ret, fd;
+  struct sockaddr_in sa;
+
+  fd = tsocks_libc_socket(AF_INET, SOCK_STREAM, 0);
+  if (fd < 0) {
+    goto end;
+  }
+  sa.sin_family = AF_INET;
+  sa.sin_port = htons(9050);
+  sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+  ret = tsocks_libc_connect(fd, (const struct sockaddr *) &sa, sizeof(sa));
+  close(fd);
+  if (ret < 0) {
+    goto end;
+  }
+  return 1;
+end:
+  return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/helpers.h 
new/torsocks-2.3.0/tests/helpers.h
--- old/torsocks-2.2.0/tests/helpers.h  1970-01-01 01:00:00.000000000 +0100
+++ new/torsocks-2.3.0/tests/helpers.h  2018-11-19 16:42:40.000000000 +0100
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2017 - David Goulet <dgou...@ev0ke.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef TORSOCKS_HELPERS_H
+#define TORSOCKS_HELPERS_H
+
+int helper_is_default_tor_running(void);
+
+#endif /* TORSOCKS_HELPERS_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/test_dns.c 
new/torsocks-2.3.0/tests/test_dns.c
--- old/torsocks-2.2.0/tests/test_dns.c 2016-10-18 18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/tests/test_dns.c 2018-11-19 16:42:40.000000000 +0100
@@ -24,8 +24,9 @@
 #include <lib/torsocks.h>
 
 #include <tap/tap.h>
+#include "helpers.h"
 
-#define NUM_TESTS 4
+#define NUM_TESTS 6
 
 struct test_host {
        const char *name;
@@ -46,7 +47,7 @@
 
 /* maatuska directory authority. */
 static const struct test_host tor_dir_auth2 = {
-       .name = "ehlo.4711.se",
+       .name = "maatuska.4711.se",
        .ip = "171.25.193.9",
 };
 
@@ -75,26 +76,77 @@
        return;
 }
 
+static void test_gethostbyaddr_r_failed(void)
+{
+       int result;
+       in_addr_t addr;
+       struct hostent ret;
+       char buf[1024];
+       int buflen = sizeof buf;
+       struct hostent *result_entp;
+       int h_errno;
+
+       diag("gethostbyaddr_r test");
+
+       /* RFC 6890 - An address from TEST-NET-1.  Selected in hopes that it 
will
+                +   * _not_ reverse resolve to anything.
+                +   */
+       addr = inet_addr("192.0.2.1");
+       result = gethostbyaddr_r((const void *)&addr,
+                               INET_ADDRSTRLEN, AF_INET, &ret, buf, buflen, 
&result_entp, &h_errno);
+       ok(0 != result, "Impossible reverse resolve failed as desired.");
+}
+
+static void test_gethostbyaddr_r(const struct test_host *host)
+{
+  int result;
+  in_addr_t addr;
+  struct hostent ret;
+  char buf[1024];
+  int buflen = sizeof buf;
+  struct hostent *result_entp;
+  int h_errno;
+
+  assert(host);
+  diag("gethostbyaddr_r test");
+
+  addr = inet_addr(host->ip);
+       result = gethostbyaddr_r((const void *)&addr,
+                               INET_ADDRSTRLEN, AF_INET, &ret, buf, buflen, 
&result_entp, &h_errno);
+
+  if (result) {
+    fail("Resolving address %s: %d", host->ip, result);
+  }
+
+  if (strcmp(host->name, result_entp->h_name) != 0) {
+    fail("Wrong resolved name: %s", result_entp->h_name);
+  }
+
+  if (result_entp->h_addrtype != AF_INET) {
+    fail("Wrong resolved address family: %d", result_entp->h_addrtype);
+  }
+
+  ok(1, "Resolved address");
+}
+
 static void test_gethostbyaddr(const struct test_host *host)
 {
        struct hostent *he;
-    in_addr_t addr;
+  in_addr_t addr;
 
        assert(host);
 
        diag("gethostbyaddr test");
 
-    addr = inet_addr(host->ip);
-
-    he = gethostbyaddr((const void *)&addr, INET_ADDRSTRLEN, AF_INET);
-    if (he) {
-               ok(strcmp(host->name, he->h_name) == 0,
-                               "Resolving address %s", host->ip);
-    } else {
+       addr = inet_addr(host->ip);
+       he = gethostbyaddr((const void *)&addr, INET_ADDRSTRLEN, AF_INET);
+       if (he) {
+               ok(strcmp(host->name, he->h_name) == 0, "Resolving address %s", 
host->ip);
+       } else {
                fail("Resolving address %s", host->ip);
        }
 
-    return;
+       return;
 }
 
 static void test_getaddrinfo(const struct test_host *host)
@@ -135,13 +187,22 @@
 
 int main(int argc, char **argv)
 {
+       /* Try to connect to SocksPort localhost:9050 and if we can't skip. 
This is
+        * to avoid to have failing test if no tor daemon is available. */
+       if (!helper_is_default_tor_running()) {
+               goto end;
+       }
+
        /* Libtap call for the number of tests planned. */
        plan_tests(NUM_TESTS);
 
        test_getaddrinfo(&tor_check);
-    test_gethostbyname(&tor_dir_auth1);
+       test_gethostbyname(&tor_dir_auth1);
        test_gethostbyaddr(&tor_dir_auth2);
+       test_gethostbyaddr_r(&tor_dir_auth2);
+       test_gethostbyaddr_r_failed();
        test_getaddrinfo(&tor_localhost);
 
-    return 0;
+end:
+       return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/test_fd_passing.c 
new/torsocks-2.3.0/tests/test_fd_passing.c
--- old/torsocks-2.2.0/tests/test_fd_passing.c  2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/tests/test_fd_passing.c  2018-11-19 16:42:40.000000000 
+0100
@@ -28,6 +28,7 @@
 #include <lib/torsocks.h>
 
 #include <tap/tap.h>
+#include "helpers.h"
 
 #define NUM_TESTS 5
 
@@ -514,10 +515,17 @@
 
 int main(int argc, char **argv)
 {
+       /* Try to connect to SocksPort localhost:9050 and if we can't skip. 
This is
+        * to avoid to have failing test if no tor daemon is available. */
+       if (!helper_is_default_tor_running()) {
+               goto end;
+       }
+
        /* Libtap call for the number of tests planned. */
        plan_tests(NUM_TESTS);
 
        test_inet_socket();
 
-    return 0;
+end:
+       return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/test_getpeername.c 
new/torsocks-2.3.0/tests/test_getpeername.c
--- old/torsocks-2.2.0/tests/test_getpeername.c 2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/tests/test_getpeername.c 2018-11-19 16:42:40.000000000 
+0100
@@ -23,6 +23,7 @@
 #include <lib/torsocks.h>
 
 #include <tap/tap.h>
+#include "helpers.h"
 
 #define NUM_TESTS 7
 
@@ -34,7 +35,7 @@
        struct sockaddr_in addrv4;
        struct sockaddr_storage ss;
        socklen_t addrlen;
-       const char *ip = "93.95.227.222";
+       const char *ip = "128.31.0.39";
 
        ret = pipe(pipe_fds);
        if (ret < 0) {
@@ -59,7 +60,7 @@
 
        /* Connect socket through Tor so we can test the wrapper. */
        addrv4.sin_family = AF_INET;
-       addrv4.sin_port = htons(443);
+       addrv4.sin_port = htons(9131);
        inet_pton(addrv4.sin_family, ip, &addrv4.sin_addr);
        memset(addrv4.sin_zero, 0, sizeof(addrv4.sin_zero));
 
@@ -102,10 +103,17 @@
 
 int main(int argc, char **argv)
 {
+       /* Try to connect to SocksPort localhost:9050 and if we can't skip. 
This is
+        * to avoid to have failing test if no tor daemon is available. */
+       if (!helper_is_default_tor_running()) {
+               goto end;
+       }
+
        /* Libtap call for the number of tests planned. */
        plan_tests(NUM_TESTS);
 
        test_getpeername();
 
+end:
     return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/unit/test_config-file.c 
new/torsocks-2.3.0/tests/unit/test_config-file.c
--- old/torsocks-2.2.0/tests/unit/test_config-file.c    2016-10-18 
18:44:01.000000000 +0200
+++ new/torsocks-2.3.0/tests/unit/test_config-file.c    2018-11-19 
16:42:40.000000000 +0100
@@ -104,13 +104,13 @@
 
        memset(&config, 0x0, sizeof(config));
        ret = config_file_read(fixture("config4"), &config);
-       ok(ret == -1 &&
+       ok(ret == 0 &&
                config.conf_file.tor_address == NULL,
                "TorAddress invalid IPv4 returns -1");
 
        memset(&config, 0x0, sizeof(config));
        ret = config_file_read(fixture("config5"), &config);
-       ok(ret == -1 &&
+       ok(ret == 0 &&
                config.conf_file.tor_address == NULL,
                "TorAddress invalid IPv6 returns -1");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/unit/test_socks5.c 
new/torsocks-2.3.0/tests/unit/test_socks5.c
--- old/torsocks-2.2.0/tests/unit/test_socks5.c 2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/tests/unit/test_socks5.c 2018-11-19 16:42:40.000000000 
+0100
@@ -30,8 +30,6 @@
 
 static struct socks5_method_req method_req;
 static struct socks5_request req;
-static struct socks5_request_ipv4 req_ipv4;
-static struct socks5_request_ipv6 req_ipv6;
 static struct socks5_request_domain req_name;
 static struct socks5_request_resolve req_resolve;
 static struct socks5_request_resolve_ptr req_resolve_ptr;
@@ -138,37 +136,12 @@
  * send_connect_request test doubles
  */
 
-static ssize_t socks5_send_connect_request_ipv4_spy(int fd, const void *buf,
-               size_t len)
-{
-       ssize_t buf_len = 0;
-
-       set_socks5_request(buf);
-       buf_len += sizeof(struct socks5_request);
-
-       req_ipv4 = (*(struct socks5_request_ipv4 *) (buf + buf_len));
-
-       return 1;
-}
-
-static ssize_t socks5_send_connect_request_ipv6_spy(int fd, const void *buf,
-               size_t len)
-{
-       ssize_t buf_len = 0;
-
-       set_socks5_request(buf);
-       buf_len += sizeof(struct socks5_request);
-
-       req_ipv6 = (*(struct socks5_request_ipv6 *) (buf + buf_len));
-
-       return 1;
-}
-
 static ssize_t socks5_send_connect_request_domain_spy(int fd, const void *buf,
                size_t len)
 {
        ssize_t buf_len = 0;
 
+       memset(&req_name, 0, sizeof(req_name));
        set_socks5_request(buf);
        buf_len += sizeof(struct socks5_request);
 
@@ -597,24 +570,19 @@
 {
        int ret;
        struct connection *conn_stub;
-       char ip[INET6_ADDRSTRLEN];
 
        conn_stub = get_connection_stub();
-       socks5_init(socks5_send_connect_request_ipv4_spy, NULL);
+       socks5_init(socks5_send_connect_request_domain_spy, NULL);
 
        ret = socks5_send_connect_request(conn_stub);
 
-       inet_ntop(AF_INET,
-               (struct sockaddr_in *)&req_ipv4.addr,
-               ip, INET6_ADDRSTRLEN);
-
        ok(ret == 0 &&
                req.ver == SOCKS5_VERSION &&
                req.cmd == SOCKS5_CMD_CONNECT &&
                req.rsv == 0 &&
-               req.atyp == SOCKS5_ATYP_IPV4 &&
-               strncmp(ip, "127.0.0.1", INET6_ADDRSTRLEN) == 0 &&
-               req_ipv4.port == htons(9050),
+               req.atyp == SOCKS5_ATYP_DOMAIN &&
+               strncmp((char *) req_name.name, "127.0.0.1", INET6_ADDRSTRLEN) 
== 0 &&
+               req_name.port == htons(9050),
                "socks5 send connect request IPv4");
 
        connection_destroy(conn_stub);
@@ -623,21 +591,17 @@
        /* IPv6 */
 
        conn_stub = get_connection_ipv6_stub();
-       socks5_init(socks5_send_connect_request_ipv6_spy, NULL);
+       socks5_init(socks5_send_connect_request_domain_spy, NULL);
 
        ret = socks5_send_connect_request(conn_stub);
 
-       inet_ntop(AF_INET6,
-               (struct sockaddr_in *)&req_ipv6.addr,
-               ip, INET6_ADDRSTRLEN);
-
        ok(ret == 0 &&
                req.ver == SOCKS5_VERSION &&
                req.cmd == SOCKS5_CMD_CONNECT &&
                req.rsv == 0 &&
-               req.atyp == SOCKS5_ATYP_IPV6 &&
-               strncmp(ip, "::1", INET6_ADDRSTRLEN) == 0 &&
-               req_ipv6.port == htons(9050),
+               req.atyp == SOCKS5_ATYP_DOMAIN &&
+               strncmp((char *) req_name.name, "::1", INET6_ADDRSTRLEN) == 0 &&
+               req_name.port == htons(9050),
                "socks5 send connect request IPv6");
 
        /* Domain name */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/torsocks-2.2.0/tests/unit/test_utils.c 
new/torsocks-2.3.0/tests/unit/test_utils.c
--- old/torsocks-2.2.0/tests/unit/test_utils.c  2016-10-18 18:44:01.000000000 
+0200
+++ new/torsocks-2.3.0/tests/unit/test_utils.c  2018-11-19 16:42:40.000000000 
+0100
@@ -36,10 +36,10 @@
        ok(ret == 1, "Valid IPv4 address");
 
        ret = utils_is_address_ipv4("127.0.0.256");
-       ok(ret == -1, "Invalid IPv4 address");
+       ok(ret == 0, "Invalid IPv4 address");
 
        ret = utils_is_address_ipv4("::1");
-       ok(ret == -1, "Invalid IPv4 address when IPv6");
+       ok(ret == 0, "Invalid IPv4 address when IPv6");
 }
 
 static void test_is_address_ipv6(void)
@@ -55,10 +55,10 @@
        ok(ret == 1, "Valid IPv6 address");
 
        ret = utils_is_address_ipv6("2001:DB8:0:0:8:800:200C:G");
-       ok(ret == -1, "Invalid IPv6 address");
+       ok(ret == 0, "Invalid IPv6 address");
 
        ret = utils_is_address_ipv6("192.168.0.1");
-       ok(ret == -1, "Invalid IPv6 address when IPv4");
+       ok(ret == 0, "Invalid IPv6 address when IPv4");
 }
 
 static void test_localhost_resolve(void)


Reply via email to