Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package proxychains-ng for openSUSE:Factory 
checked in at 2026-11-26 15:54:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/proxychains-ng (Old)
 and      /work/SRC/openSUSE:Factory/.proxychains-ng.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "proxychains-ng"

Thu Nov 26 15:54:10 2026 rev:8 rq:1400642 version:4.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/proxychains-ng/proxychains-ng.changes    
2024-04-29 17:57:50.426267280 +0200
+++ 
/work/SRC/openSUSE:Factory/.proxychains-ng.new.1340718/proxychains-ng.changes   
    2026-11-26 15:54:50.126387583 +0100
@@ -1,0 +2,13 @@
+Fri Nov 20 17:12:37 UTC 2026 - Martin Hauke <[email protected]>
+
+- Update to version 4.18
+  * fix freeaddrinfo prototype.
+  * new --fat-binary-m2 configure option.
+  * fix getaddrinfo crash with node+hints=0 .
+  * fix socks5 parsing on big endian.
+  * fix MT race in strict chain.
+  * support for unix domain sockets as first proxy.
+  * fix http connect for ipv6 targets.
+  * several minor correctness fixes.
+
+-------------------------------------------------------------------

Old:
----
  proxychains-ng-4.17.tar.xz

New:
----
  proxychains-ng-4.18.tar.xz

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

Other differences:
------------------
++++++ proxychains-ng.spec ++++++
--- /var/tmp/diff_new_pack.ODVpJO/_old  2026-11-26 15:54:50.902420423 +0100
+++ /var/tmp/diff_new_pack.ODVpJO/_new  2026-11-26 15:54:50.904420507 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package proxychains-ng
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           proxychains-ng
-Version:        4.17
+Version:        4.18
 Release:        0
 Summary:        Redirect connection through proxy servers
 License:        GPL-2.0-only

++++++ proxychains-ng-4.17.tar.xz -> proxychains-ng-4.18.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/README 
new/proxychains-ng-4.18/README
--- old/proxychains-ng-4.17/README      2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/README      2026-11-20 17:37:56.000000000 +0100
@@ -1,4 +1,4 @@
-ProxyChains-NG ver 4.17 README
+ProxyChains-NG ver 4.18 README
 =============================
 
   ProxyChains is a UNIX program, that hooks network-related libc functions
@@ -52,6 +52,17 @@
 
 Changelog:
 ----------
+Version 4.18
+- fix freeaddrinfo prototype
+- new --fat-binary-m2 configure option
+- fix solaris, netbsd build and netbsd runtime
+- fix getaddrinfo crash with node+hints=0
+- fix socks5 parsing on big endian
+- fix MT race in strict chain
+- support for unix domain sockets as first proxy
+- fix http connect for ipv6 targets
+- several minor correctness fixes
+
 Version 4.17
 - add hook for close_range function, fixing newer versions of openssh
 - fat-binary-m1 option for mac
@@ -219,6 +230,18 @@
 
 ** usually /etc/proxychains.conf
 
+The first proxy of [ProxyList] may be reached through a unix domain socket
+instead of ip and port, e.g. the SOCKS proxy of an ssh tunnel bound to a
+socket only its owner can access:
+
+       $ ssh -N -o StreamLocalBindMask=0177 -D ~/.ssh/sock/socks.sock relay
+       [ProxyList]
+       socks5  unix:/home/user/.ssh/sock/socks.sock
+
+the path must be absolute and at most 107 characters long. such a proxy can
+only be the first one of the chain, and can not be combined with other proxies
+in random_chain or round_robin_chain mode.
+
 Usage Example:
 
        $ proxychains telnet targethost.com
@@ -263,6 +286,15 @@
   there are unconfirmed reports that it works as root though.
   musl libc is unaffected from the bug.
 
+Useful links
+------------
+the following sites may prove useful to check for leaks:
+https://ipfighter.com/
+https://browserleaks.com/webrtc
+https://dnsleaktest.com
+http://check.torproject.org - tor specific
+http://ifconfig.me - can be used via curl
+http://ifconfig.io/
 
 Community:
 ----------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/VERSION 
new/proxychains-ng-4.18/VERSION
--- old/proxychains-ng-4.17/VERSION     2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/VERSION     2026-11-20 17:37:56.000000000 +0100
@@ -1 +1 @@
-4.17
+4.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/configure 
new/proxychains-ng-4.18/configure
--- old/proxychains-ng-4.17/configure   2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/configure   2026-11-20 17:37:56.000000000 +0100
@@ -87,6 +87,7 @@
        echo "  to preload from current dir (possibly insecure, but handy)"
        echo "--fat-binary : build for both i386 and x86_64 architectures on 
64-bit Macs"
        echo "--fat-binary-m1 : build for both arm64e and x86_64 architectures 
on M1 Macs"
+       echo "--fat-binary-m2 : build for arm64, arm64e and x86_64 
architectures on M2+ Macs"
        echo "--hookmethod=dlsym|dyld   hook method for osx. default: auto"
        echo "  if OSX >= 12 is detected, dyld method will be used if auto."
        echo "--help : show this text"
@@ -102,6 +103,7 @@
 
 fat_binary=
 fat_binary_m1=
+fat_binary_m2=
 ignore_cve=no
 hookmethod=auto
 
@@ -118,6 +120,7 @@
        --hookmethod=*) hookmethod=`spliteq $1`;;
        --fat-binary) fat_binary=1;;
        --fat-binary-m1) fat_binary_m1=1;;
+       --fat-binary-m2) fat_binary_m2=1;;
        --help) usage;;
        esac
 }
@@ -179,6 +182,7 @@
 check_compile 'whether C compiler works' '' 'int main() {return 0;}' || fail 
'error: install a C compiler and library'
 check_compile 'whether libc headers are complete' '' '#include <netdb.h>\nint 
main() {return 0;}' || fail 'error: necessary libc headers are not installed'
 check_compile 'whether C compiler understands -Wno-unknown-pragmas' 
'-Wno-unknown-pragmas' 'int main() {return 0;}'
+check_compile 'whether C compiler understands 
-Werror=implicit-function-declaration' '-Werror=implicit-function-declaration' 
'int main() {return 0;}'
 
 if ! check_compile 'whether getnameinfo() servlen argument is POSIX compliant 
(socklen_t)' "-DGN_NODELEN_T=socklen_t -DGN_SERVLEN_T=socklen_t 
-DGN_FLAGS_T=int" \
 '#define _GNU_SOURCE\n#include <netdb.h>\nint getnameinfo(const struct 
sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);int main() 
{\nreturn 0;}' ; then
@@ -217,6 +221,7 @@
        fi
 }
 check_define __FreeBSD__ && bsd_detected=true
+check_define __NetBSD__ && bsd_detected=true
 check_define __OpenBSD__ && {
 bsd_detected=true
 echo "CFLAGS+=-DIS_OPENBSD">>config.mak
@@ -246,7 +251,7 @@
 LD_SONAME_FLAG=
 printf "checking what's the option to use in linker to set library name ... "
 for o in --soname -h -soname -install_name; do
-       check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(int 
a) {}" && LD_SONAME_FLAG=$o && break
+       check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(void) 
{}" && LD_SONAME_FLAG=$o && break
 done
 if [ -z "$LD_SONAME_FLAG" ]; then
        printf '\ncannot find an option to set library name\n'
@@ -289,6 +294,12 @@
                echo "FAT_LDFLAGS=-arch arm64 -arch arm64e -arch 
x86_64">>config.mak
                echo "FAT_BIN_LDFLAGS=-arch arm64 -arch x86_64">>config.mak
        fi
+       if [ "$fat_binary_m2" = 1 ] ; then
+               echo "Configuring a fat binary for arm64[e] and x86_64"
+               echo "MAC_CFLAGS+=-arch arm64 -arch arm64e -arch 
x86_64">>config.mak
+               echo "FAT_LDFLAGS=-arch arm64 -arch arm64e -arch 
x86_64">>config.mak
+               echo "FAT_BIN_LDFLAGS=-arch arm64 -arch arm64e -arch 
x86_64">>config.mak
+       fi
 elif isbsd ; then
        echo LIBDL=>>config.mak
        echo "CFLAGS+=-DIS_BSD">>config.mak
@@ -302,3 +313,6 @@
 fi
 
 echo "Done, now run $make_cmd && $make_cmd install"
+if [ "$fat_binary_m2" = 1 ] ; then
+echo "Don't forget to run csrutil disable and sudo nvram 
boot-args=-arm64e_preview_abi"
+fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/allocator_thread.c 
new/proxychains-ng-4.18/src/allocator_thread.c
--- old/proxychains-ng-4.17/src/allocator_thread.c      2024-01-21 
18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/allocator_thread.c      2026-11-20 
17:37:56.000000000 +0100
@@ -246,7 +246,7 @@
                                char *host = string_from_internal_ip(msg.m.ip);
                                if(host) {
                                        size_t l = strlen(host);
-                                       assert(l+1 < MSG_LEN_MAX);
+                                       assert(l+1 <= MSG_LEN_MAX);
                                        memcpy(msg.m.host, host, l + 1);
                                        msg.h.datalen = l + 1;
                                } else {
@@ -268,9 +268,10 @@
 
 ip_type4 at_get_ip_for_host(char* host, size_t len) {
        ip_type4 readbuf;
+       struct at_msg msg = {.h.msgtype = ATM_GETIP };
        MUTEX_LOCK(internal_ips_lock);
-       if(len > MSG_LEN_MAX) goto inv;
-       struct at_msg msg = {.h.msgtype = ATM_GETIP, .h.datalen = len + 1 };
+       if(len >= MSG_LEN_MAX) goto inv;
+       msg.h.datalen = len + 1;
        memcpy(msg.m.host, host, len+1);
        if(sendmessage(ATD_SERVER, &msg) &&
           getmessage(ATD_CLIENT, &msg)) readbuf = msg.m.ip;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/core.c 
new/proxychains-ng-4.18/src/core.c
--- old/proxychains-ng-4.17/src/core.c  2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/core.c  2026-11-20 17:37:56.000000000 +0100
@@ -27,6 +27,7 @@
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <poll.h>
 #include <sys/wait.h>
 #include <fcntl.h>
@@ -218,7 +219,7 @@
 
        int len;
        unsigned char buff[BUFF_SIZE];
-       char ip_buf[INET6_ADDRSTRLEN];
+       char ip_buf[INET6_ADDRSTRLEN + 2];
        int v6 = ip.is_v6;
        
        switch (pt) {
@@ -228,10 +229,14 @@
                break;
                case HTTP_TYPE:{
                        if(!dns_len) {
-                               
if(!inet_ntop(v6?AF_INET6:AF_INET,ip.addr.v6,ip_buf,sizeof ip_buf)) {
+                               /* an ipv6 literal has to be put in brackets 
(RFC 3986) */
+                               char *ip_str = ip_buf;
+                               if(v6) *ip_str++ = '[';
+                               
if(!inet_ntop(v6?AF_INET6:AF_INET,ip.addr.v6,ip_str,INET6_ADDRSTRLEN)) {
                                        proxychains_write_log(LOG_PREFIX 
"error: ip address conversion failed\n");
                                        goto err;
                                }
+                               if(v6) strcat(ip_str, "]");
                                dns_name = ip_buf;
                        }
                        #define HTTP_AUTH_MAX ((0xFF * 2) + 1 + 1) /* 2 * 0xff: 
username and pass, plus 1 for ':' and 1 for zero terminator. */
@@ -402,11 +407,13 @@
                                case 4:
                                        len = 16;
                                        break;
-                               case 3:
-                                       len = 0;
-                                       if(1 != read_n_bytes(sock, (char *) 
&len, 1))
+                               case 3: {
+                                       unsigned char blen;
+                                       if(1 != read_n_bytes(sock, (char *) 
&blen, 1))
                                                goto err;
+                                       len = blen;
                                        break;
+                                       }
                                default:
                                        goto err;
                        }
@@ -429,9 +436,35 @@
 #define RT "Random chain"
 #define RRT "Round Robin chain"
 
+static int start_chain_unix(int *fd, proxy_data * pd, char *begin_mark) {
+       struct sockaddr_un addr = { .sun_family = AF_UNIX };
+
+       proxychains_write_log(LOG_PREFIX "%s " TP " unix:%s ", begin_mark, 
pd->unix_path);
+       pd->ps = PLAY_STATE;
+       *fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if(*fd == -1)
+               goto error;
+       strcpy(addr.sun_path, pd->unix_path);
+       if(timed_connect(*fd, (struct sockaddr *) &addr, sizeof(addr)))
+               goto error;
+       pd->ps = BUSY_STATE;
+       return SUCCESS;
+       error:
+       proxychains_write_log(TP " %s\n", strerror(errno));
+       pd->ps = DOWN_STATE;
+       if(*fd != -1) {
+               close(*fd);
+               *fd = -1;
+       }
+       return SOCKET_ERROR;
+}
+
 static int start_chain(int *fd, proxy_data * pd, char *begin_mark) {
        int v6 = pd->ip.is_v6;
 
+       if(pd->unix_path)
+               return start_chain_unix(fd, pd, begin_mark);
+
        *fd = socket(v6?PF_INET6:PF_INET, SOCK_STREAM, 0);
        if(*fd == -1)
                goto error;
@@ -664,25 +697,30 @@
                                goto error;
                        break;
 
-               case STRICT_TYPE:
-                       alive_count = calc_alive(pd, proxy_count);
-                       offset = 0;
-                       if(!(p1 = select_proxy(FIFOLY, pd, proxy_count, 
&offset))) {
+               case STRICT_TYPE: {
+                       proxy_data strict_pd[2];
+                       proxy_data *tmp;
+
+                       if(!proxy_count) {
                                PDEBUG("select_proxy failed\n");
                                goto error_strict;
                        }
+                       p1 = &strict_pd[0];
+                       p2 = &strict_pd[1];
+                       *p1 = pd[0];
                        if(SUCCESS != start_chain(&ns, p1, ST)) {
                                PDEBUG("start_chain failed\n");
                                goto error_strict;
                        }
-                       while(offset < proxy_count) {
-                               if(!(p2 = select_proxy(FIFOLY, pd, proxy_count, 
&offset)))
-                                       break;
+                       for(offset = 1; offset < proxy_count; offset++) {
+                               *p2 = pd[offset];
                                if(SUCCESS != chain_step(&ns, p1, p2)) {
                                        PDEBUG("chain_step failed\n");
                                        goto error_strict;
                                }
+                               tmp = p1;
                                p1 = p2;
+                               p2 = tmp;
                        }
                        //proxychains_write_log(TP);
                        p3->ip = target_ip;
@@ -690,6 +728,7 @@
                        if(SUCCESS != chain_step(&ns, p1, p3))
                                goto error;
                        break;
+               }
 
                case RANDOM_TYPE:
                        alive_count = calc_alive(pd, proxy_count);
@@ -718,7 +757,11 @@
        }
 
        proxychains_write_log(TP " OK\n");
+       /* dup2() resets FD_CLOEXEC of sock, keep what the app has set */
+       int fdflags = fcntl(sock, F_GETFD);
        dup2(ns, sock);
+       if(fdflags != -1)
+               fcntl(sock, F_SETFD, fdflags);
        close(ns);
        return 0;
        error:
@@ -732,7 +775,8 @@
        error_strict:
        PDEBUG("error\n");
        
-       release_all(pd, proxy_count);
+       if(ct != STRICT_TYPE)
+               release_all(pd, proxy_count);
        if(ns != -1)
                close(ns);
        errno = ETIMEDOUT;
@@ -996,10 +1040,10 @@
                        goto err_nn;
        } else if(node) {
                af = ((struct sockaddr_in *) 
&space->sockaddr_space)->sin_family;
-       } else if(!node && !(hints->ai_flags & AI_PASSIVE)) {
+       } else if(!node && !(hints && (hints->ai_flags & AI_PASSIVE))) {
                af = ((struct sockaddr_in *) 
&space->sockaddr_space)->sin_family = AF_INET;
                memcpy(&((struct sockaddr_in *) 
&space->sockaddr_space)->sin_addr,
-                      (char[]){127,0,0,1}, 4);
+                      "\177\0\0\1", 4);
        }
        if(service) mygetservbyname_r(service, NULL, &se_buf, buf, sizeof(buf), 
&se);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/core.h 
new/proxychains-ng-4.18/src/core.h
--- old/proxychains-ng-4.17/src/core.h  2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/core.h  2026-11-20 17:37:56.000000000 +0100
@@ -91,6 +91,7 @@
        proxy_state ps;
        char user[256];
        char pass[256];
+       char *unix_path; /* NULL, or path of the AF_UNIX socket of the first 
proxy */
 } proxy_data;
 
 int connect_proxy_chain (int sock, ip_type target_ip, unsigned short 
target_port,
@@ -102,8 +103,9 @@
 typedef int (*close_t)(int);
 typedef int (*close_range_t)(unsigned, unsigned, int);
 typedef int (*connect_t)(int, const struct sockaddr *, socklen_t);
+typedef int (*setsockopt_t)(int, int, int, const void *, socklen_t);
 typedef struct hostent* (*gethostbyname_t)(const char *);
-typedef int (*freeaddrinfo_t)(struct addrinfo *);
+typedef void (*freeaddrinfo_t)(struct addrinfo *);
 typedef struct hostent *(*gethostbyaddr_t) (const void *, socklen_t, int);
 
 typedef int (*getaddrinfo_t)(const char *, const char *, const struct addrinfo 
*, 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/daemon/daemon.c 
new/proxychains-ng-4.18/src/daemon/daemon.c
--- old/proxychains-ng-4.17/src/daemon/daemon.c 2024-01-21 18:30:07.000000000 
+0100
+++ new/proxychains-ng-4.18/src/daemon/daemon.c 2026-11-20 17:37:56.000000000 
+0100
@@ -5,6 +5,7 @@
 
 */
 
+#undef _GNU_SOURCE
 #define _GNU_SOURCE
 #include <unistd.h>
 #define _POSIX_C_SOURCE 200809L
@@ -218,6 +219,7 @@
                } else {
                        dolog("%s: unknown request %u\n", ipstr(&c.addr, 
ipstr_buf),
                              (unsigned) msg.h.msgtype);
+                       FAIL();
                }
        sendresp:;
                if(failed) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/debug.c 
new/proxychains-ng-4.18/src/debug.c
--- old/proxychains-ng-4.17/src/debug.c 2024-01-21 18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/debug.c 2026-11-20 17:37:56.000000000 +0100
@@ -8,13 +8,17 @@
 void dump_proxy_chain(proxy_data *pchain, unsigned int count) {
        char ip_buf[INET6_ADDRSTRLEN];
        for (; count; pchain++, count--) {
-               
if(!inet_ntop(pchain->ip.is_v6?AF_INET6:AF_INET,pchain->ip.addr.v6,ip_buf,sizeof
 ip_buf)) {
+               if(pchain->unix_path) {
+                       PDEBUG("[%s] %s unix:%s", 
proxy_state_strmap[pchain->ps],
+                              proxy_type_strmap[pchain->pt], 
pchain->unix_path);
+               } else 
if(!inet_ntop(pchain->ip.is_v6?AF_INET6:AF_INET,pchain->ip.addr.v6,ip_buf,sizeof
 ip_buf)) {
                        proxychains_write_log(LOG_PREFIX "error: ip address 
conversion failed\n");
                        continue;
+               } else {
+                       PDEBUG("[%s] %s %s:%d", proxy_state_strmap[pchain->ps],
+                              proxy_type_strmap[pchain->pt],
+                              ip_buf, htons(pchain->port));
                }
-               PDEBUG("[%s] %s %s:%d", proxy_state_strmap[pchain->ps],
-                      proxy_type_strmap[pchain->pt], 
-                      ip_buf, htons(pchain->port));
                if (*pchain->user || *pchain->pass) {
                        PSTDERR(" [u=%s,p=%s]", pchain->user, pchain->pass);
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/libproxychains.c 
new/proxychains-ng-4.18/src/libproxychains.c
--- old/proxychains-ng-4.17/src/libproxychains.c        2024-01-21 
18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/libproxychains.c        2026-11-20 
17:37:56.000000000 +0100
@@ -58,6 +58,7 @@
 close_t true_close;
 close_range_t true_close_range;
 connect_t true_connect;
+setsockopt_t true_setsockopt;
 gethostbyname_t true_gethostbyname;
 getaddrinfo_t true_getaddrinfo;
 freeaddrinfo_t true_freeaddrinfo;
@@ -69,6 +70,7 @@
 int tcp_connect_time_out;
 chain_type proxychains_ct;
 proxy_data proxychains_pd[MAX_CHAIN];
+static char pd0_unix_path[108]; /* sizeof(((struct sockaddr_un*)0)->sun_path) 
*/
 unsigned int proxychains_proxy_count = 0;
 unsigned int proxychains_proxy_offset = 0;
 int proxychains_got_chain_data = 0;
@@ -241,7 +243,7 @@
                ul = p-u;
                p++;
                pl = at-p;
-               if(proxytype == RS_PT_SOCKS5 && (ul > 255 || pl > 255))
+               if(ul > 255 || pl > 255)
                        return 0;
                memcpy(user_buf, u, ul);
                user_buf[ul]=0;
@@ -334,6 +336,30 @@
                                pd[count].ps = PLAY_STATE;
                                port_n = 0;
 
+                               /* type unix:/path/to/socket [user pass] */
+                               if(sscanf(buff, "%s %s", type, host) == 2 && 
STR_STARTSWITH(host, "unix:")) {
+                                       char *path = host + sizeof("unix:") - 1;
+                                       sscanf(buff, "%*s %*s %255s %255s", 
pd[count].user, pd[count].pass);
+                                       /* the chain is built on the socket 
connected to the first proxy:
+                                          an AF_UNIX proxy can not be reached 
through another proxy. */
+                                       if(count > 0) {
+                                               fprintf(stderr, "error: proxy 
unix:%s must be first in [ProxyList]\n", path);
+                                               exit(1);
+                                       }
+                                       if(*path != '/') {
+                                               fprintf(stderr, "error: unix 
socket path must be absolute: %s\n", path);
+                                               exit(1);
+                                       }
+                                       if(strlen(path) >= 
sizeof(pd0_unix_path)) {
+                                               fprintf(stderr, "error: unix 
socket path too long (max %zu chars): %s\n",
+                                                       sizeof(pd0_unix_path) - 
1, path);
+                                               exit(1);
+                                       }
+                                       strcpy(pd0_unix_path, path);
+                                       pd[count].unix_path = pd0_unix_path;
+                                       goto set_type;
+                               }
+
                                int ret = sscanf(buff, "%s %s %d %s %s", type, 
host, &port_n, pd[count].user, pd[count].pass);
                                if(ret < 3 || ret == EOF) {
                                        if(!proxy_from_string(buff, type, host, 
&port_n, pd[count].user, pd[count].pass)) {
@@ -365,6 +391,7 @@
                                        }
                                }
 
+set_type:
                                if(!strcmp(type, "http")) {
                                        pd[count].pt = HTTP_TYPE;
                                } else if(!strcmp(type, "raw")) {
@@ -376,7 +403,7 @@
                                } else
                                        goto inv;
 
-                               if(port_n)
+                               if(port_n || pd[count].unix_path)
                                        count++;
                        } else {
                                if(!strcmp(buff, "[ProxyList]")) {
@@ -458,7 +485,7 @@
                                                        if (valid) {
                                                                if(local_family 
== AF_INET && local_prefix <= 32) {
                                                                        
localnet_addr[num_localnet_addr].in_mask.s_addr =
-                                                                               
htonl(0xFFFFFFFFu << (32u - local_prefix));
+                                                                               
local_prefix ? htonl(0xFFFFFFFFu << (32u - local_prefix)) : 0;
                                                                } else 
if(local_family == AF_INET6 && local_prefix <= 128) {
                                                                        
localnet_addr[num_localnet_addr].in6_prefix =
                                                                                
local_prefix;
@@ -567,6 +594,11 @@
                fprintf(stderr, "error: no valid proxy found in config\n");
                exit(1);
        }
+       /* random_chain and round_robin_chain could put it in the middle of the 
chain */
+       if(pd[0].unix_path && count > 1 && (*ct == RANDOM_TYPE || *ct == 
ROUND_ROBIN_TYPE)) {
+               fprintf(stderr, "error: proxy unix:%s can not be used with 
random_chain or round_robin_chain\n", pd[0].unix_path);
+               exit(1);
+       }
        *proxy_count = count;
        proxychains_got_chain_data = 1;
        PDEBUG("proxy_dns: %s\n", rdns_resolver_string(proxychains_resolver));
@@ -767,7 +799,7 @@
 }
 
 #ifdef IS_SOLARIS
-HOOKFUNC(int, __xnet_connect, int sock, const struct sockaddr *addr, unsigned 
int len)
+HOOKFUNC(int, __xnet_connect, int sock, const struct sockaddr *addr, unsigned 
int len) {
        return connect(sock, addr, len);
 }
 #endif
@@ -892,7 +924,7 @@
        INIT();
        PFUNC();
        if (flags & MSG_FASTOPEN) {
-               if (!connect(sockfd, dest_addr, addrlen) && errno != 
EINPROGRESS) {
+               if (connect(sockfd, dest_addr, addrlen) && errno != 
EINPROGRESS) {
                        return -1;
                }
                dest_addr = NULL;
@@ -902,6 +934,28 @@
        return true_sendto(sockfd, buf, len, flags, dest_addr, addrlen);
 }
 
+/* when the first proxy is an AF_UNIX socket, connect_proxy_chain() dup2()s
+   it over the application's TCP socket. TCP/IP level options do not apply
+   to it anymore: pretend they succeeded instead of failing the application. */
+HOOKFUNC(int, setsockopt, int sockfd, int level, int optname,
+              const void *optval, socklen_t optlen) {
+       INIT();
+       PFUNC();
+       int ret = true_setsockopt(sockfd, level, optname, optval, optlen);
+       if(ret == -1 && (errno == EOPNOTSUPP || errno == ENOPROTOOPT) &&
+          (level == IPPROTO_TCP || level == IPPROTO_IP || level == 
IPPROTO_IPV6)) {
+               struct sockaddr_storage ss;
+               socklen_t sslen = sizeof(ss);
+               int saved_errno = errno;
+               if(!getsockname(sockfd, (struct sockaddr *) &ss, &sslen) && 
ss.ss_family == AF_UNIX) {
+                       PDEBUG("ignoring setsockopt(%d, %d) on AF_UNIX socket 
%d\n", level, optname, sockfd);
+                       return 0;
+               }
+               errno = saved_errno;
+       }
+       return ret;
+}
+
 #ifdef MONTEREY_HOOKING
 #define SETUP_SYM(X) do { if (! true_ ## X ) true_ ## X = &X; } while(0)
 #define SETUP_SYM_OPTIONAL(X)
@@ -914,6 +968,7 @@
 static void setup_hooks(void) {
        SETUP_SYM(connect);
        SETUP_SYM(sendto);
+       SETUP_SYM(setsockopt);
        SETUP_SYM(gethostbyname);
        SETUP_SYM(getaddrinfo);
        SETUP_SYM(freeaddrinfo);
@@ -935,6 +990,7 @@
 
 DYLD_HOOK(connect);
 DYLD_HOOK(sendto);
+DYLD_HOOK(setsockopt);
 DYLD_HOOK(gethostbyname);
 DYLD_HOOK(getaddrinfo);
 DYLD_HOOK(freeaddrinfo);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/src/proxychains.conf 
new/proxychains-ng-4.18/src/proxychains.conf
--- old/proxychains-ng-4.17/src/proxychains.conf        2024-01-21 
18:30:07.000000000 +0100
+++ new/proxychains-ng-4.18/src/proxychains.conf        2026-11-20 
17:37:56.000000000 +0100
@@ -141,6 +141,11 @@
 #
 #       only numeric ipv4 addresses are valid
 #
+#       the first proxy may instead be reached via a unix domain socket:
+#       type  unix:/absolute/path/to/socket [user pass]
+#       (path at most 107 chars; such a proxy must be the first of the list
+#       and can't be combined with other proxies in random/round_robin mode)
+#
 #
 #        Examples:
 #
@@ -148,6 +153,7 @@
 #              http    192.168.89.3    8080    justu   hidden
 #              socks4  192.168.1.49    1080
 #              http    192.168.39.93   8080    
+#              socks5  unix:/home/user/.ssh/sock/socks.sock
 #              
 #
 #       proxy types: http, socks4, socks5, raw
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/tests/test_cloexec.c 
new/proxychains-ng-4.18/tests/test_cloexec.c
--- old/proxychains-ng-4.17/tests/test_cloexec.c        1970-01-01 
01:00:00.000000000 +0100
+++ new/proxychains-ng-4.18/tests/test_cloexec.c        2026-11-20 
17:37:56.000000000 +0100
@@ -0,0 +1,48 @@
+/*
+ * a proxified connect() must not change the file descriptor flags of the
+ * socket: if FD_CLOEXEC gets lost, the connection leaks into every program
+ * the application executes.
+ *
+ *     proxychains4 ./test_cloexec ip port
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+static int check(const struct sockaddr_in *a, int fdflags) {
+       int sock, got;
+
+       if((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
+               perror("socket");
+               exit(EXIT_FAILURE);
+       }
+       fcntl(sock, F_SETFD, fdflags);
+       if(connect(sock, (const struct sockaddr *)a, sizeof(*a)) == -1) {
+               perror("connect");
+               exit(EXIT_FAILURE);
+       }
+       got = fcntl(sock, F_GETFD);
+       printf("FD_CLOEXEC before connect: %d, after: %d\n",
+              !!(fdflags & FD_CLOEXEC), !!(got & FD_CLOEXEC));
+       close(sock);
+       return got == fdflags;
+}
+
+int main(int argc, char *argv[]) {
+       struct sockaddr_in a = { .sin_family = AF_INET };
+       int ok;
+
+       if(argc < 3 || inet_pton(AF_INET, argv[1], &a.sin_addr) != 1) {
+               printf("Usage: %s ip port\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       a.sin_port = htons(atoi(argv[2]));
+
+       ok = check(&a, 0);
+       ok &= check(&a, FD_CLOEXEC);
+       return ok ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/proxychains-ng-4.17/tests/test_getaddrinfo_null_hints.c 
new/proxychains-ng-4.18/tests/test_getaddrinfo_null_hints.c
--- old/proxychains-ng-4.17/tests/test_getaddrinfo_null_hints.c 1970-01-01 
01:00:00.000000000 +0100
+++ new/proxychains-ng-4.18/tests/test_getaddrinfo_null_hints.c 2026-11-20 
17:37:56.000000000 +0100
@@ -0,0 +1,25 @@
+/*
+ * NULL pointer dereference in proxy_getaddrinfo()
+ * if node == NULL && hints == NULL.
+ */
+#define _POSIX_C_SOURCE 200112L
+#include <netdb.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void on_crash(int sig) {
+    fprintf(stderr, "POC_HIT: signal %d from getaddrinfo(NULL, \"80\", NULL, 
&res)\n", sig);
+    fflush(stderr);
+    _exit(0);
+}
+
+int main(void) {
+    struct addrinfo *res = 0;
+    int rc;
+    signal(SIGSEGV, on_crash);
+    signal(SIGBUS, on_crash);
+    rc = getaddrinfo(NULL, "80", NULL, &res);
+    fprintf(stderr, "POC_MISS: getaddrinfo returned %d\n", rc);
+    return 1;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/proxychains-ng-4.17/tests/test_unix_proxy.c 
new/proxychains-ng-4.18/tests/test_unix_proxy.c
--- old/proxychains-ng-4.17/tests/test_unix_proxy.c     1970-01-01 
01:00:00.000000000 +0100
+++ new/proxychains-ng-4.18/tests/test_unix_proxy.c     2026-11-20 
17:37:56.000000000 +0100
@@ -0,0 +1,97 @@
+/*
+ * test for proxies reached through a unix domain socket ("unix:" in 
[ProxyList]).
+ *
+ * start a SOCKS proxy on a unix socket, e.g.
+ *     ssh -N -o StreamLocalBindMask=0177 -D /tmp/socks.sock relay
+ * use a config file with
+ *     [ProxyList]
+ *     socks5 unix:/tmp/socks.sock
+ * and run
+ *     proxychains4 -f unix.conf ./test_unix_proxy example.com 80
+ *
+ * the socket of the application is replaced by the AF_UNIX one connected to
+ * the proxy: TCP level options must still succeed, as many programs
+ * (curl, python requests, ...) fail on them.
+ *
+ * the config must also be rejected (with a clear message) when an unix:
+ * proxy is not first in the list, its path is relative or too long, or it is
+ * mixed with other proxies in random_chain / round_robin_chain mode.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+
+void error(const char *msg)
+{
+       perror(msg);
+       exit(1);
+}
+
+static void set_tcp_options(int fd)
+{
+       int one = 1, idle = 60;
+       assert(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) == 
0);
+       assert(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)) == 
0);
+       assert(setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)) 
== 0);
+}
+
+int main(int argc, char *argv[])
+{
+       if (argc < 3) {
+               printf("Usage: %s host port\n", argv[0]);
+               return 1;
+       }
+       const char *hostname = argv[1];
+       const int portno = atoi(argv[2]);
+       char request[BUFSIZ];
+       sprintf(request, "GET / HTTP/1.0\r\nHost: %s\r\n\r\n", hostname);
+       int sockfd, n, sv[2];
+       struct sockaddr_in serv_addr;
+       struct sockaddr_storage ss;
+       socklen_t sslen = sizeof(ss);
+       struct hostent *server;
+       char buffer[BUFSIZ];
+
+       /* TCP options on any AF_UNIX socket are accepted under proxychains */
+       if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0)
+               error("socketpair");
+       set_tcp_options(sv[0]);
+       close(sv[0]);
+       close(sv[1]);
+
+       sockfd = socket(AF_INET, SOCK_STREAM, 0);
+       if (sockfd < 0) error("ERROR opening socket");
+       server = gethostbyname(hostname);
+       if (server == NULL) {
+               fprintf(stderr, "%s: no such host\n", hostname);
+               return 1;
+       }
+       memset(&serv_addr, 0, sizeof(serv_addr));
+       serv_addr.sin_family = AF_INET;
+       memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length);
+       serv_addr.sin_port = htons(portno);
+       if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 
0)
+               error("connect");
+       if (getsockname(sockfd, (struct sockaddr *)&ss, &sslen) < 0)
+               error("getsockname");
+       printf("socket family after connect: %s\n",
+              ss.ss_family == AF_UNIX ? "AF_UNIX" : ss.ss_family == AF_INET ? 
"AF_INET" : "other");
+       set_tcp_options(sockfd);
+       n = send(sockfd, request, strlen(request), 0);
+       if (n < 0)
+                error("send");
+       memset(buffer, 0, BUFSIZ);
+       n = read(sockfd, buffer, BUFSIZ - 1);
+       if (n < 0)
+                error("ERROR reading from socket");
+       printf("%s\n", buffer);
+       close(sockfd);
+       return 0;
+}

Reply via email to