aboutsummaryrefslogtreecommitdiff
path: root/patches/netcat.c.patch
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2015-11-22 04:55:22 -0600
committerBrent Cook <busterb@gmail.com>2015-11-22 04:55:22 -0600
commitd35e8bbeaf797fde6bb8ac730b9cd2beefe78b85 (patch)
tree2e0e13b8a82657cf3d905e4ffecaf9e75da7c50d /patches/netcat.c.patch
parent1d5dfff695d7bfb32521f4f8c7c296e27b18e908 (diff)
downloadportable-d35e8bbeaf797fde6bb8ac730b9cd2beefe78b85.tar.gz
portable-d35e8bbeaf797fde6bb8ac730b9cd2beefe78b85.tar.bz2
portable-d35e8bbeaf797fde6bb8ac730b9cd2beefe78b85.zip
update netcat patch
Diffstat (limited to 'patches/netcat.c.patch')
-rw-r--r--patches/netcat.c.patch51
1 files 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 @@
1--- apps/nc/netcat.c.orig Mon Nov 2 20:00:31 2015 1--- apps/nc/netcat.c.orig 2015-11-22 09:54:13.947164164 -0600
2+++ apps/nc/netcat.c Mon Nov 2 20:00:39 2015 2+++ apps/nc/netcat.c 2015-11-22 10:49:52.455236524 -0600
3@@ -57,6 +57,10 @@ 3@@ -57,6 +57,10 @@
4 #include <tls.h> 4 #include <tls.h>
5 #include "atomicio.h" 5 #include "atomicio.h"
@@ -61,26 +61,19 @@
61 case 'T': 61 case 'T':
62 errstr = NULL; 62 errstr = NULL;
63 errno = 0; 63 errno = 0;
64@@ -310,14 +322,16 @@ 64@@ -310,9 +322,11 @@
65 argc -= optind; 65 argc -= optind;
66 argv += optind; 66 argv += optind;
67 67
68+#ifdef SO_RTABLE 68+#ifdef SO_RTABLE
69 if (rtableid >= 0) { 69 if (rtableid >= 0)
70 /* 70 if (setrtable(rtableid) == -1)
71 * XXX No pledge if doing rtable manipulation! 71 err(1, "setrtable");
72 * XXX the routing table stuff is dangerous and can't be pledged.
73 * XXX rtable should really have a better interface than sockopt
74 */
75- }
76- else if (family == AF_UNIX) {
77+ } else
78+#endif 72+#endif
79+ if (family == AF_UNIX) { 73
74 if (family == AF_UNIX) {
80 if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) 75 if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
81 err(1, "pledge"); 76@@ -792,7 +806,10 @@
82 }
83@@ -798,7 +812,10 @@
84 remote_connect(const char *host, const char *port, struct addrinfo hints) 77 remote_connect(const char *host, const char *port, struct addrinfo hints)
85 { 78 {
86 struct addrinfo *res, *res0; 79 struct addrinfo *res, *res0;
@@ -92,17 +85,7 @@
92 85
93 if ((error = getaddrinfo(host, port, &hints, &res))) 86 if ((error = getaddrinfo(host, port, &hints, &res)))
94 errx(1, "getaddrinfo: %s", gai_strerror(error)); 87 errx(1, "getaddrinfo: %s", gai_strerror(error));
95@@ -809,16 +826,20 @@ 88@@ -807,8 +824,10 @@
96 SOCK_NONBLOCK, res0->ai_protocol)) < 0)
97 continue;
98
99+#ifdef SO_RTABLE
100 if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE,
101 &rtableid, sizeof(rtableid)) == -1))
102 err(1, "setsockopt SO_RTABLE");
103+#endif
104
105 /* Bind to a local port or source address if specified. */
106 if (sflag || pflag) { 89 if (sflag || pflag) {
107 struct addrinfo ahints, *ares; 90 struct addrinfo ahints, *ares;
108 91
@@ -113,7 +96,7 @@
113 memset(&ahints, 0, sizeof(struct addrinfo)); 96 memset(&ahints, 0, sizeof(struct addrinfo));
114 ahints.ai_family = res0->ai_family; 97 ahints.ai_family = res0->ai_family;
115 ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; 98 ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
116@@ -887,7 +908,10 @@ 99@@ -877,7 +896,10 @@
117 local_listen(char *host, char *port, struct addrinfo hints) 100 local_listen(char *host, char *port, struct addrinfo hints)
118 { 101 {
119 struct addrinfo *res, *res0; 102 struct addrinfo *res, *res0;
@@ -125,16 +108,10 @@
125 int error; 108 int error;
126 109
127 /* Allow nodename to be null. */ 110 /* Allow nodename to be null. */
128@@ -909,13 +933,17 @@ 111@@ -899,9 +921,11 @@
129 res0->ai_protocol)) < 0) 112 res0->ai_protocol)) < 0)
130 continue; 113 continue;
131 114
132+#ifdef SO_RTABLE
133 if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE,
134 &rtableid, sizeof(rtableid)) == -1))
135 err(1, "setsockopt SO_RTABLE");
136+#endif
137
138+#ifdef SO_REUSEPORT 115+#ifdef SO_REUSEPORT
139 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); 116 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
140 if (ret == -1) 117 if (ret == -1)
@@ -143,7 +120,7 @@
143 120
144 set_common_sockopts(s, res0->ai_family); 121 set_common_sockopts(s, res0->ai_family);
145 122
146@@ -1358,11 +1386,13 @@ 123@@ -1344,11 +1368,13 @@
147 { 124 {
148 int x = 1; 125 int x = 1;
149 126
@@ -157,7 +134,7 @@
157 if (Dflag) { 134 if (Dflag) {
158 if (setsockopt(s, SOL_SOCKET, SO_DEBUG, 135 if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
159 &x, sizeof(x)) == -1) 136 &x, sizeof(x)) == -1)
160@@ -1537,15 +1567,19 @@ 137@@ -1523,15 +1549,19 @@
161 \t-P proxyuser\tUsername for proxy authentication\n\ 138 \t-P proxyuser\tUsername for proxy authentication\n\
162 \t-p port\t Specify local port for remote connects\n\ 139 \t-p port\t Specify local port for remote connects\n\
163 \t-R CAfile CA bundle\n\ 140 \t-R CAfile CA bundle\n\