refresh nc(1) support

This commit is contained in:
Brent Cook 2015-12-06 23:32:18 -06:00
parent 5b49c30cbc
commit 905e2a3b80
4 changed files with 17 additions and 14 deletions

View File

@ -1,5 +1,6 @@
if !HAVE_ARC4RANDOM_BUF
libcompat_la_SOURCES += compat/arc4random.c
libcompat_la_SOURCES += compat/arc4random_uniform.c
if !HAVE_GETENTROPY
if HOST_AIX

View File

@ -22,6 +22,7 @@
#ifndef HAVE_ARC4RANDOM_BUF
uint32_t arc4random(void);
void arc4random_buf(void *_buf, size_t n);
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
#ifndef HAVE_REALLOCARRAY

View File

@ -1,5 +1,5 @@
--- 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
--- apps/nc/netcat.c.orig Sun Dec 6 22:05:45 2015
+++ apps/nc/netcat.c Sun Dec 6 23:23:15 2015
@@ -57,6 +57,10 @@
#include <tls.h>
#include "atomicio.h"
@ -9,9 +9,9 @@
+#endif
+
#define PORT_MAX 65535
#define PORT_MAX_LEN 6
#define UNIX_DG_TMP_SOCKET_SIZE 19
@@ -93,9 +97,13 @@
@@ -92,9 +96,13 @@
int Dflag; /* sodebug */
int Iflag; /* TCP receive buffer size */
int Oflag; /* TCP send buffer size */
@ -25,7 +25,7 @@
int usetls; /* use TLS */
char *Cflag; /* Public cert file */
@@ -145,7 +153,7 @@
@@ -144,7 +152,7 @@
struct servent *sv;
socklen_t len;
struct sockaddr_storage cliaddr;
@ -34,7 +34,7 @@
const char *errstr, *proxyhost = "", *proxyport = NULL;
struct addrinfo proxyhints;
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
@@ -246,12 +254,14 @@
@@ -245,12 +253,14 @@
case 'u':
uflag = 1;
break;
@ -49,7 +49,7 @@
case 'v':
vflag = 1;
break;
@@ -284,9 +294,11 @@
@@ -283,9 +293,11 @@
errx(1, "TCP send window %s: %s",
errstr, optarg);
break;
@ -61,7 +61,7 @@
case 'T':
errstr = NULL;
errno = 0;
@@ -310,9 +322,11 @@
@@ -309,9 +321,11 @@
argc -= optind;
argv += optind;
@ -73,7 +73,7 @@
if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
@@ -792,7 +806,10 @@
@@ -791,7 +805,10 @@
remote_connect(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
@ -85,7 +85,7 @@
if ((error = getaddrinfo(host, port, &hints, &res)))
errx(1, "getaddrinfo: %s", gai_strerror(error));
@@ -807,8 +824,10 @@
@@ -806,8 +823,10 @@
if (sflag || pflag) {
struct addrinfo ahints, *ares;
@ -96,7 +96,7 @@
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res0->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
@@ -877,7 +896,10 @@
@@ -876,7 +895,10 @@
local_listen(char *host, char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
@ -108,7 +108,7 @@
int error;
/* Allow nodename to be null. */
@@ -899,9 +921,11 @@
@@ -898,9 +920,11 @@
res0->ai_protocol)) < 0)
continue;
@ -120,7 +120,7 @@
set_common_sockopts(s, res0->ai_family);
@@ -1344,11 +1368,13 @@
@@ -1340,11 +1364,13 @@
{
int x = 1;
@ -134,7 +134,7 @@
if (Dflag) {
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
&x, sizeof(x)) == -1)
@@ -1523,15 +1549,19 @@
@@ -1519,15 +1545,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\

View File

@ -73,6 +73,7 @@ $CP $libtls_src/tls.h libtls-standalone/include
for i in crypto/compat libtls-standalone/compat; do
for j in $libc_src/crypt/arc4random.c \
$libc_src/crypt/arc4random_uniform.c \
$libc_src/crypt/chacha_private.h \
$libc_src/string/explicit_bzero.c \
$libc_src/stdlib/reallocarray.c \