rebase netcat patch

This commit is contained in:
Brent Cook 2015-12-28 08:46:59 -06:00
parent 4a931b58fc
commit f5a4ee56be

View File

@ -1,5 +1,5 @@
--- apps/nc/netcat.c.orig Sun Dec 6 22:05:45 2015 --- apps/nc/netcat.c.orig Mon Dec 28 08:46:10 2015
+++ apps/nc/netcat.c Mon Dec 7 07:52:00 2015 +++ apps/nc/netcat.c Mon Dec 28 08:46:19 2015
@@ -57,6 +57,10 @@ @@ -57,6 +57,10 @@
#include <tls.h> #include <tls.h>
#include "atomicio.h" #include "atomicio.h"
@ -35,7 +35,7 @@
int usetls; /* use TLS */ int usetls; /* use TLS */
char *Cflag; /* Public cert file */ char *Cflag; /* Public cert file */
@@ -144,7 +154,7 @@ @@ -150,7 +160,7 @@
struct servent *sv; struct servent *sv;
socklen_t len; socklen_t len;
struct sockaddr_storage cliaddr; struct sockaddr_storage cliaddr;
@ -44,7 +44,7 @@
const char *errstr, *proxyhost = "", *proxyport = NULL; const char *errstr, *proxyhost = "", *proxyport = NULL;
struct addrinfo proxyhints; struct addrinfo proxyhints;
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
@@ -245,12 +255,14 @@ @@ -251,12 +261,14 @@
case 'u': case 'u':
uflag = 1; uflag = 1;
break; break;
@ -59,7 +59,7 @@
case 'v': case 'v':
vflag = 1; vflag = 1;
break; break;
@@ -283,9 +295,11 @@ @@ -289,9 +301,11 @@
errx(1, "TCP send window %s: %s", errx(1, "TCP send window %s: %s",
errstr, optarg); errstr, optarg);
break; break;
@ -71,7 +71,7 @@
case 'T': case 'T':
errstr = NULL; errstr = NULL;
errno = 0; errno = 0;
@@ -309,9 +323,11 @@ @@ -315,9 +329,11 @@
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@ -83,7 +83,7 @@
if (family == AF_UNIX) { if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
@@ -444,7 +460,10 @@ @@ -460,7 +476,10 @@
errx(1, "-H and -T noverify may not be used" errx(1, "-H and -T noverify may not be used"
"together"); "together");
tls_config_insecure_noverifycert(tls_cfg); tls_config_insecure_noverifycert(tls_cfg);
@ -95,7 +95,7 @@
} }
if (lflag) { if (lflag) {
struct tls *tls_cctx = NULL; struct tls *tls_cctx = NULL;
@@ -791,7 +810,10 @@ @@ -807,7 +826,10 @@
remote_connect(const char *host, const char *port, struct addrinfo hints) remote_connect(const char *host, const char *port, struct addrinfo hints)
{ {
struct addrinfo *res, *res0; struct addrinfo *res, *res0;
@ -107,7 +107,7 @@
if ((error = getaddrinfo(host, port, &hints, &res))) if ((error = getaddrinfo(host, port, &hints, &res)))
errx(1, "getaddrinfo: %s", gai_strerror(error)); errx(1, "getaddrinfo: %s", gai_strerror(error));
@@ -806,8 +828,10 @@ @@ -822,8 +844,10 @@
if (sflag || pflag) { if (sflag || pflag) {
struct addrinfo ahints, *ares; struct addrinfo ahints, *ares;
@ -118,7 +118,7 @@
memset(&ahints, 0, sizeof(struct addrinfo)); memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res0->ai_family; ahints.ai_family = res0->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
@@ -876,7 +900,10 @@ @@ -892,7 +916,10 @@
local_listen(char *host, char *port, struct addrinfo hints) local_listen(char *host, char *port, struct addrinfo hints)
{ {
struct addrinfo *res, *res0; struct addrinfo *res, *res0;
@ -130,7 +130,7 @@
int error; int error;
/* Allow nodename to be null. */ /* Allow nodename to be null. */
@@ -898,9 +925,11 @@ @@ -914,9 +941,11 @@
res0->ai_protocol)) < 0) res0->ai_protocol)) < 0)
continue; continue;
@ -142,7 +142,7 @@
set_common_sockopts(s, res0->ai_family); set_common_sockopts(s, res0->ai_family);
@@ -1340,11 +1369,13 @@ @@ -1356,11 +1385,13 @@
{ {
int x = 1; int x = 1;
@ -156,7 +156,7 @@
if (Dflag) { if (Dflag) {
if (setsockopt(s, SOL_SOCKET, SO_DEBUG, if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
&x, sizeof(x)) == -1) &x, sizeof(x)) == -1)
@@ -1519,14 +1550,22 @@ @@ -1538,14 +1569,22 @@
\t-P proxyuser\tUsername for proxy authentication\n\ \t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\ \t-p port\t Specify local port for remote connects\n\
\t-R CAfile CA bundle\n\ \t-R CAfile CA bundle\n\