From nobody Thu Nov 10 07:53:12 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N7DbX3bClz4V1Xj; Thu, 10 Nov 2022 07:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N7DbX356cz3HRT; Thu, 10 Nov 2022 07:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668066792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qBFwgHHm+46mooDRjkmCgBQQpxekcGUaI+RtjgIcB4k=; b=pvw9/0OYBy6wxyhP2Gbu4I2LipWKEKrYe/hGa2NMcvLvgv/A5LWxntNNxFpJxaJsBma8nW pC6KDNyYQevEYjoOIfnwmRghIeQRRhyqIiQWMc7MuMyj4VyRdH2Nsw85eVwmKn7xfM1e9x UIxYRWXu6GDhwb3HqHNyNmQyR93SCV1VQXE1mnVhNdFyslHkw2Z2iyzYOu3SHNIhfLx9aV SCaCfkzlUC+bf6CxY+lpqSqD4Mc8Bp+CVVDL1xnOLFS4oPSlnK9XZCEw53/gFAefEx1Ys6 touUO9ZsSggXH4IvO8Bl29VwWEb/z6J5H/ZK2Q6FcP0KK03ACO7yZUUZ3LPt8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668066792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qBFwgHHm+46mooDRjkmCgBQQpxekcGUaI+RtjgIcB4k=; b=QQK3aMck/XRfCb1/wSd5C9LnzXMOEU9oJUrpPXvlHN1HGIJIZm8+a9EAPNHY/zo7F8x3gP 7SCdX0Ut0QLI3cFNxILhVebUtS0vnc+pm1Qwi1CXIuGa5xFor3W8y1EhrsgBep8A1mrw7W KAHxCmGbJBoncEhdAm+RoVC4+LhgtWRPkF6YKKOj+daxi1D3Mtru8sxgO42ZJNOW8lE+AC R1QlVonHGynlh0LYxA7NQ+Ob9NzVkVglKsdq/HLtM4wPfZG2Xm4JqaXRZEKSViaFtNyxlH e5kmictlNl1CbRaHNMQ7W/gwNQS3PdORlKr3EDmIYc4wEEUYz+LQ5SWcXNHOkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668066792; a=rsa-sha256; cv=none; b=AXiMnG3lpSWOEztVcSn+gnuH9K3je4U4sTwxELpM5qRVGGYdh19hnbIXH7Alehpfln41OP 1SvpLHNMY1oZMmXFas3hZMHWmcO70ZN0ZqVEoINHYtVuwLPv8LUAhxbVTGtYCjXboBzk4t b9+s0kDNIerF4/XHh4nGrxAPH5LtRB1QRyGgWv1YutCbhrEuIn7Ba1RAnDjAmcHzUEN9Kk rlHsn+VaBppDK/unCAq4tqBYIXjswIvfQRBOcWxmNDEiEXBVe0gDVphdrVfA/JiFfR2uFk prgr6HEdgMpcH+YggPRXqIUgUtUZlvytON2siqHmXnZJk5t8mu+HXIEFTO3/Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N7DbX29SXztHQ; Thu, 10 Nov 2022 07:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AA7rCCO033204; Thu, 10 Nov 2022 07:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AA7rCds033203; Thu, 10 Nov 2022 07:53:12 GMT (envelope-from git) Date: Thu, 10 Nov 2022 07:53:12 GMT Message-Id: <202211100753.2AA7rCds033203@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Emanuel Haupt Subject: git: d9f28ee265f9 - main - net/tsocks: Fix erroneous substitution List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ehaupt X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9f28ee265f94f4bcedb7d24648042ca1325c230 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ehaupt: URL: https://cgit.FreeBSD.org/ports/commit/?id=d9f28ee265f94f4bcedb7d24648042ca1325c230 commit d9f28ee265f94f4bcedb7d24648042ca1325c230 Author: Emanuel Haupt AuthorDate: 2022-11-10 07:40:57 +0000 Commit: Emanuel Haupt CommitDate: 2022-11-10 07:49:19 +0000 net/tsocks: Fix erroneous substitution When patching the wrapper script for /usr to ${PREFIX} a part in a sed statement gets substituted that should be escaped. Adjust sed statement in a way that it doesn't break after patching ${PREFIX}. While here: - move a REINPLACE_CMD operation to a pre-existing patch file - pacify portclippy - reformat with portfmt PR: 267670 Reported by: chris@mumac.de --- net/tsocks/Makefile | 24 ++++---- net/tsocks/files/patch-tsocks | 11 ++++ net/tsocks/files/patch-tsocks.c | 118 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 138 insertions(+), 15 deletions(-) diff --git a/net/tsocks/Makefile b/net/tsocks/Makefile index 2f67b428b335..b7930504b128 100644 --- a/net/tsocks/Makefile +++ b/net/tsocks/Makefile @@ -1,6 +1,6 @@ PORTNAME= tsocks DISTVERSION= 1.8.b5 -PORTREVISION= 8 +PORTREVISION= 9 CATEGORIES= net security MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/1.8%20beta%205 \ http://ftp1.sourceforge.net/tsocks/ \ @@ -17,29 +17,27 @@ USES= gmake USE_LDCONFIG= yes GNU_CONFIGURE= yes +CONFIGURE_ARGS= --libdir=${PREFIX}/lib \ + --with-conf=${PREFIX}/etc/tsocks.conf -WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:C/.b.*//} +SUB_FILES= pkg-message -CONFIGURE_ARGS= --with-conf=${PREFIX}/etc/tsocks.conf \ - --libdir=${PREFIX}/lib +WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:C/.b.*//} -OPTIONS_DEFINE= DOCS EXAMPLES HOSTNAMES MUTE OLDMETHOD SOCKSDNS -OPTIONS_DEFAULT=HOSTNAMES +OPTIONS_DEFINE= DOCS EXAMPLES HOSTNAMES MUTE OLDMETHOD SOCKSDNS +OPTIONS_DEFAULT= HOSTNAMES HOSTNAMES_DESC= Enable DNS lookups -OLDMETHOD_DESC= Do not use RTLD_NEXT parameter to dlsym MUTE_DESC= Disable all error messages +OLDMETHOD_DESC= Do not use RTLD_NEXT parameter to dlsym SOCKSDNS_DESC= Intercept DNS requests and attempt to force them to use TCP HOSTNAMES_CONFIGURE_OFF= --disable-hostnames -MUTE_CONFIGURE_ON= --disable-debug -OLDMETHOD_CONFIGURE_ON= --enable-oldmethod -SOCKSDNS_CONFIGURE_ON= --enable-socksdns - -SUB_FILES= pkg-message +MUTE_CONFIGURE_ON= --disable-debug +OLDMETHOD_CONFIGURE_ON= --enable-oldmethod +SOCKSDNS_CONFIGURE_ON= --enable-socksdns post-patch: - @${REINPLACE_CMD} -e 's|ufds|fds|g' ${WRKSRC}/tsocks.c @${REINPLACE_CMD} -e 's|/usr|${PREFIX}|' ${WRKSRC}/tsocks post-install: diff --git a/net/tsocks/files/patch-tsocks b/net/tsocks/files/patch-tsocks new file mode 100644 index 000000000000..ee7b7441bf33 --- /dev/null +++ b/net/tsocks/files/patch-tsocks @@ -0,0 +1,11 @@ +--- tsocks.orig 2002-03-16 10:27:18 UTC ++++ tsocks +@@ -53,7 +53,7 @@ case "$1" in + fi + ;; + off) +- export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/usr\/lib\/libtsocks.so \?//'` ++ export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's|/usr/lib/libtsocks.so[[:blank:]]*||'` + if [ -z "$LD_PRELOAD" ] + then + unset LD_PRELOAD diff --git a/net/tsocks/files/patch-tsocks.c b/net/tsocks/files/patch-tsocks.c index eed81cc56f58..4694fc25cf92 100644 --- a/net/tsocks/files/patch-tsocks.c +++ b/net/tsocks/files/patch-tsocks.c @@ -1,6 +1,120 @@ --- tsocks.c.orig 2002-07-15 22:50:52 UTC +++ tsocks.c -@@ -852,7 +852,7 @@ static int connect_server(struct connreq +@@ -531,12 +531,12 @@ int poll(POLL_SIGNATURE) { + /* If we're not currently managing any requests we can just + * leave here */ + if (!requests) +- return(realpoll(ufds, nfds, timeout)); ++ return(realpoll(fds, nfds, timeout)); + + get_environment(); + + show_msg(MSGDEBUG, "Intercepted call to poll with %d fds, " +- "0x%08x timeout %d\n", nfds, ufds, timeout); ++ "0x%08x timeout %d\n", nfds, fds, timeout); + + for (conn = requests; conn != NULL; conn = conn->next) + conn->selectevents = 0; +@@ -544,16 +544,16 @@ int poll(POLL_SIGNATURE) { + /* Record what events on our sockets the caller was interested + * in */ + for (i = 0; i < nfds; i++) { +- if (!(conn = find_socks_request(ufds[i].fd, 0))) ++ if (!(conn = find_socks_request(fds[i].fd, 0))) + continue; + show_msg(MSGDEBUG, "Have event checks for socks enabled socket %d\n", + conn->sockid); +- conn->selectevents = ufds[i].events; ++ conn->selectevents = fds[i].events; + monitoring = 1; + } + + if (!monitoring) +- return(realpoll(ufds, nfds, timeout)); ++ return(realpoll(fds, nfds, timeout)); + + /* This is our poll loop. In it we repeatedly call poll(). We + * pass select the same event list as provided by the caller except we +@@ -566,25 +566,25 @@ int poll(POLL_SIGNATURE) { + do { + /* Enable our sockets for the events WE want to hear about */ + for (i = 0; i < nfds; i++) { +- if (!(conn = find_socks_request(ufds[i].fd, 0))) ++ if (!(conn = find_socks_request(fds[i].fd, 0))) + continue; + + /* We always want to know about socket exceptions but they're + * always returned (i.e they don't need to be in the list of + * wanted events to be returned by the kernel */ +- ufds[i].events = 0; ++ fds[i].events = 0; + + /* If we're waiting for a connect or to be able to send + * on a socket we want to get write events */ + if ((conn->state == SENDING) || (conn->state == CONNECTING)) +- ufds[i].events |= POLLOUT; ++ fds[i].events |= POLLOUT; + /* If we're waiting to receive data we want to get + * read events */ + if (conn->state == RECEIVING) +- ufds[i].events |= POLLIN; ++ fds[i].events |= POLLIN; + } + +- nevents = realpoll(ufds, nfds, timeout); ++ nevents = realpoll(fds, nfds, timeout); + /* If there were no events we must have timed out or had an error */ + if (nevents <= 0) + break; +@@ -597,29 +597,29 @@ int poll(POLL_SIGNATURE) { + continue; + + /* Find the socket in the poll list */ +- for (i = 0; ((i < nfds) && (ufds[i].fd != conn->sockid)); i++) ++ for (i = 0; ((i < nfds) && (fds[i].fd != conn->sockid)); i++) + /* Empty Loop */; + if (i == nfds) + continue; + + show_msg(MSGDEBUG, "Checking socket %d for events\n", conn->sockid); + +- if (!ufds[i].revents) { ++ if (!fds[i].revents) { + show_msg(MSGDEBUG, "No events on socket\n"); + continue; + } + + /* Clear any read or write events on the socket, we'll reset + * any that are necessary later. */ +- setevents = ufds[i].revents; ++ setevents = fds[i].revents; + if (setevents & POLLIN) { + show_msg(MSGDEBUG, "Socket had read event\n"); +- ufds[i].revents &= ~POLLIN; ++ fds[i].revents &= ~POLLIN; + nevents--; + } + if (setevents & POLLOUT) { + show_msg(MSGDEBUG, "Socket had write event\n"); +- ufds[i].revents &= ~POLLOUT; ++ fds[i].revents &= ~POLLOUT; + nevents--; + } + if (setevents & (POLLERR | POLLNVAL | POLLHUP)) +@@ -669,10 +669,10 @@ int poll(POLL_SIGNATURE) { + + /* Now restore the events polled in each of the blocks */ + for (i = 0; i < nfds; i++) { +- if (!(conn = find_socks_request(ufds[i].fd, 1))) ++ if (!(conn = find_socks_request(fds[i].fd, 1))) + continue; + +- ufds[i].events = conn->selectevents; ++ fds[i].events = conn->selectevents; + } + + return(nevents); +@@ -852,7 +852,7 @@ static int connect_server(struct connreq *conn) { sizeof(conn->serveraddr)); show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno); @@ -9,7 +123,7 @@ if (errno != EINPROGRESS) { show_msg(MSGERR, "Error %d attempting to connect to SOCKS " "server (%s)\n", errno, strerror(errno)); -@@ -862,6 +862,7 @@ static int connect_server(struct connreq +@@ -862,6 +862,7 @@ static int connect_server(struct connreq *conn) { conn->state = CONNECTING; } } else {