From 8c00ad59413278a93445b82ae6b22c0c63f28d75 Mon Sep 17 00:00:00 2001 From: schmonz Date: Mon, 15 Nov 2021 11:36:58 +0000 Subject: Add tcpexec, a minimal UCSPI inetd. It attaches the standard input and output of a command to a TCP socket. --- net/tcpexec/DESCR | 2 ++ net/tcpexec/Makefile | 25 +++++++++++++++++++++++++ net/tcpexec/PLIST | 3 +++ net/tcpexec/distinfo | 7 +++++++ net/tcpexec/patches/patch-Makefile | 24 ++++++++++++++++++++++++ net/tcpexec/patches/patch-tcpexec.c | 16 ++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 net/tcpexec/DESCR create mode 100644 net/tcpexec/Makefile create mode 100644 net/tcpexec/PLIST create mode 100644 net/tcpexec/distinfo create mode 100644 net/tcpexec/patches/patch-Makefile create mode 100644 net/tcpexec/patches/patch-tcpexec.c (limited to 'net') diff --git a/net/tcpexec/DESCR b/net/tcpexec/DESCR new file mode 100644 index 00000000000..14e1f682d09 --- /dev/null +++ b/net/tcpexec/DESCR @@ -0,0 +1,2 @@ +tcpexec is a minimal UCSPI inetd. It attaches the standard input and +output of a command to a TCP socket. diff --git a/net/tcpexec/Makefile b/net/tcpexec/Makefile new file mode 100644 index 00000000000..4c21b13733e --- /dev/null +++ b/net/tcpexec/Makefile @@ -0,0 +1,25 @@ +# $NetBSD: Makefile,v 1.1 2021/11/15 11:36:58 schmonz Exp $ + +GITHUB_PROJECT= tcpexec +GITHUB_TAG= 7e02e755aca4cb377910b729e43de8e3fb48eece +DISTNAME= ${GITHUB_TAG} +PKGNAME= ${GITHUB_PROJECT}-0.1.1 +CATEGORIES= net +MASTER_SITES= ${MASTER_SITE_GITHUB:=msantos/} +DIST_SUBDIR= ${GITHUB_PROJECT} + +MAINTAINER= schmonz@NetBSD.org +HOMEPAGE= https://github.com/msantos/tcpexec/ +COMMENT= Minimal UCSPI inetd +LICENSE= isc + +TEST_DEPENDS+= bats-[0-9]*:../../devel/bats +TEST_TARGET= test # XXX needs to be run as root + +INSTALLATION_DIRS= bin share/doc/${PKGBASE} + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/tcpexec ${DESTDIR}${PREFIX}/bin + ${INSTALL_DATA} ${WRKSRC}/README.md ${DESTDIR}${PREFIX}/share/doc/${PKGBASE} + +.include "../../mk/bsd.pkg.mk" diff --git a/net/tcpexec/PLIST b/net/tcpexec/PLIST new file mode 100644 index 00000000000..24478cfef93 --- /dev/null +++ b/net/tcpexec/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2021/11/15 11:36:58 schmonz Exp $ +bin/tcpexec +share/doc/tcpexec/README.md diff --git a/net/tcpexec/distinfo b/net/tcpexec/distinfo new file mode 100644 index 00000000000..70b9644cb1c --- /dev/null +++ b/net/tcpexec/distinfo @@ -0,0 +1,7 @@ +$NetBSD: distinfo,v 1.1 2021/11/15 11:36:58 schmonz Exp $ + +BLAKE2s (tcpexec/7e02e755aca4cb377910b729e43de8e3fb48eece-7e02e755aca4cb377910b729e43de8e3fb48eece.tar.gz) = 3e833e3aeb0a7bf8023ee870b1e5a1c39c10804037fbb6541470a018c646db0b +SHA512 (tcpexec/7e02e755aca4cb377910b729e43de8e3fb48eece-7e02e755aca4cb377910b729e43de8e3fb48eece.tar.gz) = d1ad7ff52499a3287cadf4f44ce012a2bb9eeeaca2c77c75caa12fdcff2c09b60fefa396ebcb4dc3478acea1340e8ba322955ed9bb8f73af33a39254e545f801 +Size (tcpexec/7e02e755aca4cb377910b729e43de8e3fb48eece-7e02e755aca4cb377910b729e43de8e3fb48eece.tar.gz) = 4219 bytes +SHA1 (patch-Makefile) = 17d61c1e7da32f51f528e282152f47601065c31b +SHA1 (patch-tcpexec.c) = d87d6cde188efc84905348cac092de9488078741 diff --git a/net/tcpexec/patches/patch-Makefile b/net/tcpexec/patches/patch-Makefile new file mode 100644 index 00000000000..99c668ff86c --- /dev/null +++ b/net/tcpexec/patches/patch-Makefile @@ -0,0 +1,24 @@ +$NetBSD: patch-Makefile,v 1.1 2021/11/15 11:36:58 schmonz Exp $ + +Use pkgsrc-provided CFLAGS and LDFLAGS. + +--- Makefile.orig 2021-11-13 13:34:51.000000000 +0000 ++++ Makefile +@@ -2,14 +2,13 @@ + + PROG= tcpexec + +-CFLAGS ?= -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong \ +- -Wformat -Werror=format-security \ ++CFLAGS ?= -Wformat -Werror=format-security \ + -fno-strict-aliasing +-LDFLAGS += -Wl,-z,relro,-z,now ++LDFLAGS ?= -Wl,-z,relro,-z,now + + RM ?= rm + +-TCPEXEC_CFLAGS ?= -g -Wall -fwrapv ++TCPEXEC_CFLAGS ?= -Wall -fwrapv + + CFLAGS += $(TCPEXEC_CFLAGS) + diff --git a/net/tcpexec/patches/patch-tcpexec.c b/net/tcpexec/patches/patch-tcpexec.c new file mode 100644 index 00000000000..d9b9149b9aa --- /dev/null +++ b/net/tcpexec/patches/patch-tcpexec.c @@ -0,0 +1,16 @@ +$NetBSD: patch-tcpexec.c,v 1.1 2021/11/15 11:36:58 schmonz Exp $ + +Fix macOS build. + +--- tcpexec.c.orig 2021-11-13 13:34:51.000000000 +0000 ++++ tcpexec.c +@@ -152,6 +152,9 @@ static int tcpexec_listen(const char *ad + } + + for (rp = res; rp != NULL; rp = rp->ai_next) { ++#ifndef SOCK_CLOEXEC ++#define SOCK_CLOEXEC 0 ++#endif + fd = socket(rp->ai_family, rp->ai_socktype | SOCK_CLOEXEC, rp->ai_protocol); + + if (fd == -1) -- cgit v1.2.3