From d35e8bbeaf797fde6bb8ac730b9cd2beefe78b85 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 22 Nov 2015 04:55:22 -0600 Subject: update netcat patch --- patches/netcat.c.patch | 51 ++++++++++++++------------------------------------ 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index fffd726..8f186f6 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch @@ -1,5 +1,5 @@ ---- apps/nc/netcat.c.orig Mon Nov 2 20:00:31 2015 -+++ apps/nc/netcat.c Mon Nov 2 20:00:39 2015 +--- apps/nc/netcat.c.orig 2015-11-22 09:54:13.947164164 -0600 ++++ apps/nc/netcat.c 2015-11-22 10:49:52.455236524 -0600 @@ -57,6 +57,10 @@ #include #include "atomicio.h" @@ -61,26 +61,19 @@ case 'T': errstr = NULL; errno = 0; -@@ -310,14 +322,16 @@ +@@ -310,9 +322,11 @@ argc -= optind; argv += optind; +#ifdef SO_RTABLE - if (rtableid >= 0) { - /* - * XXX No pledge if doing rtable manipulation! - * XXX the routing table stuff is dangerous and can't be pledged. - * XXX rtable should really have a better interface than sockopt - */ -- } -- else if (family == AF_UNIX) { -+ } else + if (rtableid >= 0) + if (setrtable(rtableid) == -1) + err(1, "setrtable"); +#endif -+ if (family == AF_UNIX) { + + if (family == AF_UNIX) { if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) - err(1, "pledge"); - } -@@ -798,7 +812,10 @@ +@@ -792,7 +806,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) { struct addrinfo *res, *res0; @@ -92,17 +85,7 @@ if ((error = getaddrinfo(host, port, &hints, &res))) errx(1, "getaddrinfo: %s", gai_strerror(error)); -@@ -809,16 +826,20 @@ - SOCK_NONBLOCK, res0->ai_protocol)) < 0) - continue; - -+#ifdef SO_RTABLE - if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, - &rtableid, sizeof(rtableid)) == -1)) - err(1, "setsockopt SO_RTABLE"); -+#endif - - /* Bind to a local port or source address if specified. */ +@@ -807,8 +824,10 @@ if (sflag || pflag) { struct addrinfo ahints, *ares; @@ -113,7 +96,7 @@ memset(&ahints, 0, sizeof(struct addrinfo)); ahints.ai_family = res0->ai_family; ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; -@@ -887,7 +908,10 @@ +@@ -877,7 +896,10 @@ local_listen(char *host, char *port, struct addrinfo hints) { struct addrinfo *res, *res0; @@ -125,16 +108,10 @@ int error; /* Allow nodename to be null. */ -@@ -909,13 +933,17 @@ +@@ -899,9 +921,11 @@ res0->ai_protocol)) < 0) continue; -+#ifdef SO_RTABLE - if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, - &rtableid, sizeof(rtableid)) == -1)) - err(1, "setsockopt SO_RTABLE"); -+#endif - +#ifdef SO_REUSEPORT ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); if (ret == -1) @@ -143,7 +120,7 @@ set_common_sockopts(s, res0->ai_family); -@@ -1358,11 +1386,13 @@ +@@ -1344,11 +1368,13 @@ { int x = 1; @@ -157,7 +134,7 @@ if (Dflag) { if (setsockopt(s, SOL_SOCKET, SO_DEBUG, &x, sizeof(x)) == -1) -@@ -1537,15 +1567,19 @@ +@@ -1523,15 +1549,19 @@ \t-P proxyuser\tUsername for proxy authentication\n\ \t-p port\t Specify local port for remote connects\n\ \t-R CAfile CA bundle\n\ -- cgit v1.2.3-55-g6feb