Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package torsocks for openSUSE:Factory checked in at 2022-10-03 13:44:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/torsocks (Old) and /work/SRC/openSUSE:Factory/.torsocks.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "torsocks" Mon Oct 3 13:44:49 2022 rev:6 rq:1006592 version:2.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/torsocks/torsocks.changes 2020-02-15 22:25:55.071325866 +0100 +++ /work/SRC/openSUSE:Factory/.torsocks.new.2275/torsocks.changes 2022-10-03 13:45:07.349397008 +0200 @@ -1,0 +2,14 @@ +Sun Sep 25 16:29:44 UTC 2022 - Andreas Stieger <andreas.stie...@gmx.de> + +- update to 2.4.0: + * Disable ipv6 socket creation by default (signal-cli) + * Delegate to libc fclose when fileno fails (mutt) + * Add debug-log for opaque syscall passthrough + * Pass through non-blacklisted syscalls, fixing "Unsupported + syscall number" errors + * Fixes an issue when calling recvmsg on a domain socket + non-blocking + * Fixed out-of-bounds write in onion pool. + * Add getdents / getdents64 support re ticket + +------------------------------------------------------------------- Old: ---- torsocks-2.3.0.tar.gz New: ---- torsocks-2.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ torsocks.spec ++++++ --- /var/tmp/diff_new_pack.gjtFZM/_old 2022-10-03 13:45:07.841398091 +0200 +++ /var/tmp/diff_new_pack.gjtFZM/_new 2022-10-03 13:45:07.849398108 +0200 @@ -1,7 +1,7 @@ # # spec file for package torsocks # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,13 +18,13 @@ %define _name libtorsocks Name: torsocks -Version: 2.3.0 +Version: 2.4.0 Release: 0 Summary: Use SOCKS-friendly applications with Tor License: GPL-2.0-only Group: Productivity/Networking/Security -URL: https://github.com/dgoulet/torsocks -Source0: https://github.com/dgoulet/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +URL: https://gitlab.torproject.org/tpo/core/torsocks/-/releases/ +Source0: https://gitlab.torproject.org/tpo/core/torsocks/-/archive/v%{version}/%{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc BuildRequires: autoconf BuildRequires: automake @@ -71,7 +71,7 @@ slogin-server %prep -%setup -q +%setup -q -n %{name}-v%{version}-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/ %build autoreconf -fi @@ -88,6 +88,9 @@ %post -n %{name} -p /sbin/ldconfig %postun -n %{name} -p /sbin/ldconfig +%check +%make_build check + %files %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} ++++++ torsocks-2.3.0.tar.gz -> torsocks-2.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/ChangeLog new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/ChangeLog --- old/torsocks-2.3.0/ChangeLog 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/ChangeLog 2022-05-25 16:36:05.000000000 +0200 @@ -1,3 +1,15 @@ +2022-05-25 torsocks 2.4.0 + * Disable ipv6 socket creation by default, fixing #40009 (signal-cli) + * Delegate to libc fclose when fileno fails, fixing #40002 (EBADF in mutt) + * Fix typos + * Add debug-log for opaque syscall passthrough + * Pass through non-blacklisted syscalls, fixing "Unsupported syscall number" + errors in #33552 and others. + * Fixes an issue when calling recvmsg on a domain socket non-blocking; #40001 + * Fixed out-of-bounds write in onion pool. + * Add getdents / getdents64 support re ticket #28861 + * Fix a bunch of stuff in the wrapper script, #24967 + 2018-11-19 torsocks 2.3.0 * Fix a bunch of stuff in the wrapper script, #24967 * gethostbyaddr_r: always assign result diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/README.md new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/README.md --- old/torsocks-2.3.0/README.md 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/README.md 2022-05-25 16:36:05.000000000 +0200 @@ -62,7 +62,7 @@ A configuration file named *torsocks.conf* is also provided for the user to control some parameters. -More informations +More information -------------- torsocks is distributed under the GNU General Public License version 2. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/configure.ac new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/configure.ac --- old/torsocks-2.3.0/configure.ac 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/configure.ac 2022-05-25 16:36:05.000000000 +0200 @@ -106,7 +106,7 @@ dnl "On OS X (at least in 10.6 and I believe starting at 10.3) the DNS resolution dnl services fail to compile. This is a result of the addition of BIND9 compatible dnl resolution libraries on OS X that are being picked up by the configure script - dnl instead of -lresolv causing the tests for useable resolution services to fail + dnl instead of -lresolv causing the tests for usable resolution services to fail dnl thus disabling features like pka auto lookup." LIBS="-lresolv $LIBS" ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/doc/proposals/01-Thread-safe-design.txt new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/proposals/01-Thread-safe-design.txt --- old/torsocks-2.3.0/doc/proposals/01-Thread-safe-design.txt 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/proposals/01-Thread-safe-design.txt 2022-05-25 16:36:05.000000000 +0200 @@ -11,7 +11,7 @@ connection. They are kept in a central registry that every thread needs to access. -The reason why it needs to be shared accross threads is because of fd passing. +The reason why it needs to be shared across threads is because of fd passing. It is possible and even not uncommon that threads exchange file descriptor(s) so we can't keep a registry of connections using TLS (Thread Local Storage). Furthermore, a process could easily, for instance, close(2) a socket within a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/doc/torsocks.conf new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/torsocks.conf --- old/torsocks-2.3.0/doc/torsocks.conf 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/torsocks.conf 2022-05-25 16:36:05.000000000 +0200 @@ -42,3 +42,7 @@ # If set, the SOCKS5Username and SOCKS5Password options must not be set. # (Default: 0) #IsolatePID 1 + +# Enable IPv6 support in torsocks. torsocks IPv6 support is currently incomplete +# and can have some tricky failure modes. +#EnableIPv6 1 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/doc/torsocks.conf.5 new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/torsocks.conf.5 --- old/torsocks-2.3.0/doc/torsocks.conf.5 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/doc/torsocks.conf.5 2022-05-25 16:36:05.000000000 +0200 @@ -74,7 +74,7 @@ .TP .I AllowInbound 0|1 Allow inbound connections meaning that listen() and accept()/accept4() will be -allowed for non localhost address so the applicaton can handle incoming +allowed for non localhost address so the application can handle incoming connection. Note that Unix socket are allowed. (Default: 0) .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/bin/torsocks.in new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/bin/torsocks.in --- old/torsocks-2.3.0/src/bin/torsocks.in 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/bin/torsocks.in 2022-05-25 16:36:05.000000000 +0200 @@ -277,6 +277,7 @@ echo " -u, --user NAME Username for the SOCKS5 authentication" echo " -p, --pass NAME Password for the SOCKS5 authentication" echo " -i, --isolate Automatic tor isolation. Can't be used with -u/-p" + echo " -6, --ipv6 Enable creation of IPv6 sockets" echo " -a, --address HOST Specify Tor address" echo " -P, --port PORT Specify Tor port" echo " on, off Set/Unset your shell to use Torsocks by default" @@ -380,6 +381,9 @@ -i|--isolate) export TORSOCKS_ISOLATE_PID=1 ;; + -6|--ipv6) + export TORSOCKS_ENABLE_IPV6=1 + ;; -d|--debug) # Set full DEBUG with 5 being the highest possible level. export TORSOCKS_LOG_LEVEL=5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/compat.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/compat.c --- old/torsocks-2.3.0/src/common/compat.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/compat.c 2022-05-25 16:36:05.000000000 +0200 @@ -74,7 +74,7 @@ /* * Call the given routine once, and only once. tsocks_once returning - * guarantees that the routine has succeded. + * guarantees that the routine has succeeded. */ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/compat.h new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/compat.h --- old/torsocks-2.3.0/src/common/compat.h 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/compat.h 2022-05-25 16:36:05.000000000 +0200 @@ -129,6 +129,12 @@ #ifndef __NR_memfd_create #define __NR_memfd_create -19 #endif +#ifndef __NR_getdents +#define __NR_getdents -20 +#endif +#ifndef __NR_getdents64 +#define __NR_getdents64 -21 +#endif #define TSOCKS_NR_SOCKET __NR_socket #define TSOCKS_NR_CONNECT __NR_connect @@ -149,6 +155,8 @@ #define TSOCKS_NR_CLOCK_GETTIME __NR_clock_gettime #define TSOCKS_NR_FORK __NR_fork #define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create +#define TSOCKS_NR_GETDENTS __NR_getdents +#define TSOCKS_NR_GETDENTS64 __NR_getdents64 /* * Despite glibc providing wrappers for these calls for a long time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/config-file.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/config-file.c --- old/torsocks-2.3.0/src/common/config-file.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/config-file.c 2022-05-25 16:36:05.000000000 +0200 @@ -40,6 +40,7 @@ static const char *conf_allow_inbound_str = "AllowInbound"; static const char *conf_allow_outbound_localhost_str = "AllowOutboundLocalhost"; static const char *conf_isolate_pid_str = "IsolatePID"; +static const char *conf_enable_ipv6_str = "EnableIPv6"; /* * Once this value reaches 2, it means both user and password for a SOCKS5 @@ -179,6 +180,11 @@ if (ret < 0) { goto error; } + } else if (!strcmp(tokens[0], conf_enable_ipv6_str)) { + ret = conf_file_set_enable_ipv6(tokens[1], config); + if (ret < 0) { + goto error; + } } else { WARN("Config file contains unknown value: %s", line); } @@ -457,6 +463,35 @@ } /* + * Set the enable_ipv6 option for the given config. + * + * Return 0 if option is off, 1 if on and negative value on error. + */ +ATTR_HIDDEN +int conf_file_set_enable_ipv6(const char *val, struct configuration *config) +{ + int ret; + + assert(val); + assert(config); + + ret = atoi(val); + if (ret == 0) { + config->enable_ipv6 = 0; + DBG("[config] PID isolation disabled."); + } else if (ret == 1) { + config->enable_ipv6 = 1; + DBG("[config] PID isolation enabled."); + } else { + ERR("[config] Invalid %s value for %s", val, + conf_enable_ipv6_str); + ret = -EINVAL; + } + + return ret; +} + +/* * Applies the SOCKS authentication configuration and sets the final SOCKS * username and password. * @@ -581,7 +616,7 @@ /* * Free everything inside a configuration file object. It is the caller - * responsability to free the object if needed. + * responsibility to free the object if needed. */ ATTR_HIDDEN void config_file_destroy(struct config_file *conf) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/config-file.h new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/config-file.h --- old/torsocks-2.3.0/src/common/config-file.h 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/config-file.h 2022-05-25 16:36:05.000000000 +0200 @@ -90,6 +90,11 @@ * username or password. */ unsigned int isolate_pid:1; + + /* + * Enable IPv6. + */ + unsigned int enable_ipv6:1; }; int config_file_read(const char *filename, struct configuration *config); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/defaults.h new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/defaults.h --- old/torsocks-2.3.0/src/common/defaults.h 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/defaults.h 2022-05-25 16:36:05.000000000 +0200 @@ -33,7 +33,7 @@ #define DEFAULT_LOG_LEVEL MSGWARN /* - * RFC 1035 specifies a maxium of 255 possibe for domain name. + * RFC 1035 specifies a maximum of 255 possible for domain name. * (https://www.ietf.org/rfc/rfc1035.txt). */ #define DEFAULT_DOMAIN_NAME_SIZE 255 @@ -73,4 +73,7 @@ /* Control if torsocks isolates based on PID or not. */ #define DEFAULT_ISOLATE_PID_ENV "TORSOCKS_ISOLATE_PID" +/* Control if torsocks supports IPv6 sockets or not. */ +#define DEFAULT_ENABLE_IPV6_ENV "TORSOCKS_ENABLE_IPV6" + #endif /* TORSOCKS_DEFAULTS_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/onion.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/onion.c --- old/torsocks-2.3.0/src/common/onion.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/onion.c 2022-05-25 16:36:05.000000000 +0200 @@ -62,7 +62,7 @@ assert(entry); assert(pool); - if (pool->count > pool->size) { + if (pool->count >= pool->size) { /* Double the size of the pool. */ ret = resize_onion_pool(pool, pool->size * 2); if (ret < 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/common/onion.h new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/onion.h --- old/torsocks-2.3.0/src/common/onion.h 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/common/onion.h 2022-05-25 16:36:05.000000000 +0200 @@ -72,7 +72,7 @@ * Starting base of available cookie. For a range of 127.0.69.64/26, this * base value would be 64 and the max value in this case is 127. * - * If the maxium value is reached, the DNS resolution will fail thus never + * If the maximum value is reached, the DNS resolution will fail thus never * returning any cookie to the caller. */ uint32_t base; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/lib/fclose.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/fclose.c --- old/torsocks-2.3.0/src/lib/fclose.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/fclose.c 2022-05-25 16:36:05.000000000 +0200 @@ -33,13 +33,18 @@ if (!fp) { errno = EBADF; - goto error; + return -1; } fd = fileno(fp); if (fd < 0) { - /* errno is set to EBADF here by fileno(). */ - goto error; + /* We don't have any bookkeeping to do. Pass through to libc instead of + * just returning an error though; the operation may succeed e.g. if the + * stream refers to an in-memory buffer without an associated file + * descriptor, such as one created using `fopencookie`, `open_memstream`, + * or `fmemopen`. */ + DBG("Passing through FILE without a valid descriptor to fclose"); + return tsocks_libc_fclose(fp); } DBG("[fclose] Close caught for fd %d", fd); @@ -66,9 +71,6 @@ /* Return the original libc fclose. */ return tsocks_libc_fclose(fp); - -error: - return -1; } /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/lib/recv.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/recv.c --- old/torsocks-2.3.0/src/lib/recv.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/recv.c 2022-05-25 16:36:05.000000000 +0200 @@ -50,7 +50,7 @@ * Torsocks call for recvmsg(2) * * We only hijack this call to handle the FD passing between process on Unix - * socket. If an INET/INET6 socket is recevied, we stop everything because at + * socket. If an INET/INET6 socket is received, we stop everything because at * that point we can't guarantee traffic going through Tor. * * Note that we don't rely on the given "msg" structure since it's controlled @@ -92,7 +92,7 @@ do { /* Just peek the data to inspect the payload for fd. */ - ret = tsocks_libc_recvmsg(sockfd, &msg_hdr, MSG_PEEK); + ret = tsocks_libc_recvmsg(sockfd, &msg_hdr, MSG_PEEK | flags); } while (ret < 0 && errno == EINTR); if (ret < 0) { /* Use the current errno set by the call above. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/lib/socket.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/socket.c --- old/torsocks-2.3.0/src/lib/socket.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/socket.c 2022-05-25 16:36:05.000000000 +0200 @@ -32,6 +32,12 @@ DBG("[socket] Creating socket with domain %d, type %d and protocol %d", domain, type, protocol); + if (domain == AF_INET6 && !tsocks_config.enable_ipv6) { + DBG("[socket] Denying ipv6"); + errno = ENOSYS; + return -1; + } + if (IS_SOCK_STREAM(type)) { /* * The socket family is not checked here since we accept local socket @@ -62,7 +68,7 @@ * the libc to do DNS resolution which first tries with UDP and then * with TCP. It's not critical for the user to know that a non TCP * socket has been denied and since the libc has a fallback that works, - * this message most of the time, simply polutes the application's + * this message most of the time, simply pollutes the application's * output which can cause issues with external applications parsing the * output. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/lib/syscall.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/syscall.c --- old/torsocks-2.3.0/src/lib/syscall.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/syscall.c 2022-05-25 16:36:05.000000000 +0200 @@ -437,8 +437,49 @@ return tsocks_libc_syscall(TSOCKS_NR_MEMFD_CREATE, name, flags); } +/* + * Handle getdents(2) syscall. + */ +static LIBC_SYSCALL_RET_TYPE handle_getdents(va_list args) +{ + unsigned int fd; + struct linux_dirent *dirp; + unsigned int count; + + fd = va_arg(args, __typeof__(fd)); + dirp = va_arg(args, __typeof__(dirp)); + count = va_arg(args, __typeof__(count)); + + return tsocks_libc_syscall(TSOCKS_NR_GETDENTS, fd, dirp, count); +} +/* + * Handle getdents64(2) syscall. + */ +static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args) +{ + unsigned int fd; + struct linux_dirent64 *dirp; + unsigned int count; + + fd = va_arg(args, __typeof__(fd)); + dirp = va_arg(args, __typeof__(dirp)); + count = va_arg(args, __typeof__(count)); + + return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count); +} + #endif /* __linux__ */ +static LIBC_SYSCALL_RET_TYPE handle_passthrough(long n, va_list args) { + long arg1 = va_arg(args, long); + long arg2 = va_arg(args, long); + long arg3 = va_arg(args, long); + long arg4 = va_arg(args, long); + long arg5 = va_arg(args, long); + long arg6 = va_arg(args, long); + return tsocks_libc_syscall(n, arg1, arg2, arg3, arg4, arg5, arg6); +} + /* * Torsocks call for syscall(2) */ @@ -558,16 +599,17 @@ case TSOCKS_NR_MEMFD_CREATE: ret = handle_memfd_create(args); break; + case TSOCKS_NR_GETDENTS: + ret = handle_getdents(args); + break; + case TSOCKS_NR_GETDENTS64: + ret = handle_getdents64(args); + break; #endif /* __linux__ */ default: - /* - * Because of the design of syscall(), we can't pass a va_list to it so - * we are constraint to use a whitelist scheme and denying the rest. - */ - WARN("[syscall] Unsupported syscall number %ld. Denying the call", + DBG("[syscall] Unsupported __syscall number %ld. Passing through", number); - ret = -1; - errno = ENOSYS; + ret = handle_passthrough(number, args); break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/src/lib/torsocks.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/torsocks.c --- old/torsocks-2.3.0/src/lib/torsocks.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/src/lib/torsocks.c 2022-05-25 16:36:05.000000000 +0200 @@ -75,7 +75,7 @@ static void read_env(void) { int ret; - const char *username, *password, *allow_in, *isolate_pid, *tor_address, *tor_port; + const char *username, *password, *allow_in, *isolate_pid, *enable_ipv6, *tor_address, *tor_port; if (is_suid) { goto end; @@ -97,6 +97,14 @@ } } + enable_ipv6 = getenv(DEFAULT_ENABLE_IPV6_ENV); + if (enable_ipv6) { + ret = conf_file_set_enable_ipv6(enable_ipv6, &tsocks_config); + if (ret < 0) { + goto error; + } + } + tor_address = getenv(DEFAULT_TOR_ADDRESS_ENV); if (tor_address) { ret = conf_file_set_tor_address(tor_address, &tsocks_config); @@ -329,7 +337,7 @@ init_config(); /* - * Initalized the onion pool which maps cookie address to hidden service + * Initialized the onion pool which maps cookie address to hidden service * onion address. */ ret = onion_pool_init(&tsocks_onion_pool, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/tests/tap-driver.sh new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/tap-driver.sh --- old/torsocks-2.3.0/tests/tap-driver.sh 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/tap-driver.sh 2022-05-25 16:36:05.000000000 +0200 @@ -369,7 +369,7 @@ sub("^(not )?ok[ \t]*", "", line) # If the result has an explicit number, get it and strip it; otherwise, - # automatically assing the next progresive number to it. + # automatically assign the next progresive number to it. if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) { match(line, "^[0-9]+") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/tests/test_fd_passing.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/test_fd_passing.c --- old/torsocks-2.3.0/tests/test_fd_passing.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/test_fd_passing.c 2022-05-25 16:36:05.000000000 +0200 @@ -34,7 +34,7 @@ /* * Indicate if the thread recv is ready. 0 means no, 1 means yes and -1 means - * error occured. + * error occurred. */ static volatile int thread_recv_ready; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/tests/unit/test_socks5.c new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/unit/test_socks5.c --- old/torsocks-2.3.0/tests/unit/test_socks5.c 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/unit/test_socks5.c 2022-05-25 16:36:05.000000000 +0200 @@ -260,7 +260,7 @@ return 1; } -static ssize_t socks5_recv_connect_reply_ipv4_unkown_stub(int fd, void *buf, +static ssize_t socks5_recv_connect_reply_ipv4_unknown_stub(int fd, void *buf, size_t len) { ((struct socks5_reply *)buf)->ver = SOCKS5_VERSION; @@ -622,7 +622,7 @@ req_name.port == htons(9050), "socks5 send connect request domain name"); - /* Unkown connection domain */ + /* Unknown connection domain */ conn_stub = get_connection_stub(); conn_stub->dest_addr.domain = 0; @@ -631,7 +631,7 @@ ret = socks5_send_connect_request(conn_stub); ok(ret == -EINVAL, "socks5 send connect request returns error for " - "unkown connection domain"); + "unknown connection domain"); connection_destroy(conn_stub); } @@ -797,17 +797,17 @@ socks5_init(NULL, NULL); } -static void test_socks5_recv_connect_reply_unkown(void) +static void test_socks5_recv_connect_reply_unknown(void) { int ret; struct connection *conn_stub; conn_stub = get_connection_stub(); - socks5_init(NULL, socks5_recv_connect_reply_ipv4_unkown_stub); + socks5_init(NULL, socks5_recv_connect_reply_ipv4_unknown_stub); ret = socks5_recv_connect_reply(conn_stub); - ok(ret == -ECONNABORTED, "socks5 reply unkown code"); + ok(ret == -ECONNABORTED, "socks5 reply unknown code"); connection_destroy(conn_stub); socks5_init(NULL, NULL); @@ -1078,13 +1078,13 @@ connection_destroy(conn_stub); socks5_init(NULL, NULL); - /* Unkown domain */ + /* Unknown domain */ conn_stub = get_connection_domain_stub(); ret = socks5_send_resolve_ptr_request(conn_stub, &addr_stub, 3); - ok(ret == -EINVAL, "socks5 send resolve ptr request unkown domain"); + ok(ret == -EINVAL, "socks5 send resolve ptr request unknown domain"); connection_destroy(conn_stub); } @@ -1205,7 +1205,7 @@ test_socks5_recv_connect_reply_ttl_expired(); test_socks5_recv_connect_reply_cmd_not_supported(); test_socks5_recv_connect_reply_addr_not_supported(); - test_socks5_recv_connect_reply_unkown(); + test_socks5_recv_connect_reply_unknown(); test_socks5_recv_connect_reply_ipv6_success(); test_socks5_send_resolve_request_valid(); test_socks5_send_resolve_request_failure(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/torsocks-2.3.0/tests/utils/tap/tap.h new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/utils/tap/tap.h --- old/torsocks-2.3.0/tests/utils/tap/tap.h 2018-11-19 16:42:40.000000000 +0100 +++ new/torsocks-v2.4.0-afe9dea542a8b495dbbbbe5e4b98a33cde06729b/tests/utils/tap/tap.h 2022-05-25 16:36:05.000000000 +0200 @@ -25,7 +25,7 @@ */ /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting - and requires the caller to add the final comma if they've ommitted + and requires the caller to add the final comma if they've omitted the optional arguments */ #ifdef __GNUC__ # define ok(e, test, ...) ((e) ? \