diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-12-06 23:32:18 -0600 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-12-06 23:32:18 -0600 |
| commit | 905e2a3b8046e227bf02410def56b0c2535de14f (patch) | |
| tree | 82159c1b9d0f627e00d6ba27bea725ff0ee20ef8 | |
| parent | 5b49c30cbc1cd115a1d39bbdb67271e9d182b7a8 (diff) | |
| download | portable-905e2a3b8046e227bf02410def56b0c2535de14f.tar.gz portable-905e2a3b8046e227bf02410def56b0c2535de14f.tar.bz2 portable-905e2a3b8046e227bf02410def56b0c2535de14f.zip | |
refresh nc(1) support
| -rw-r--r-- | crypto/Makefile.am.arc4random | 1 | ||||
| -rw-r--r-- | include/compat/stdlib.h | 1 | ||||
| -rw-r--r-- | patches/netcat.c.patch | 28 | ||||
| -rwxr-xr-x | update.sh | 1 |
4 files changed, 17 insertions, 14 deletions
diff --git a/crypto/Makefile.am.arc4random b/crypto/Makefile.am.arc4random index c44051c..6a01966 100644 --- a/crypto/Makefile.am.arc4random +++ b/crypto/Makefile.am.arc4random | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | if !HAVE_ARC4RANDOM_BUF | 1 | if !HAVE_ARC4RANDOM_BUF |
| 2 | libcompat_la_SOURCES += compat/arc4random.c | 2 | libcompat_la_SOURCES += compat/arc4random.c |
| 3 | libcompat_la_SOURCES += compat/arc4random_uniform.c | ||
| 3 | 4 | ||
| 4 | if !HAVE_GETENTROPY | 5 | if !HAVE_GETENTROPY |
| 5 | if HOST_AIX | 6 | if HOST_AIX |
diff --git a/include/compat/stdlib.h b/include/compat/stdlib.h index 506d463..781be77 100644 --- a/include/compat/stdlib.h +++ b/include/compat/stdlib.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #ifndef HAVE_ARC4RANDOM_BUF | 22 | #ifndef HAVE_ARC4RANDOM_BUF |
| 23 | uint32_t arc4random(void); | 23 | uint32_t arc4random(void); |
| 24 | void arc4random_buf(void *_buf, size_t n); | 24 | void arc4random_buf(void *_buf, size_t n); |
| 25 | uint32_t arc4random_uniform(uint32_t upper_bound); | ||
| 25 | #endif | 26 | #endif |
| 26 | 27 | ||
| 27 | #ifndef HAVE_REALLOCARRAY | 28 | #ifndef HAVE_REALLOCARRAY |
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index 8f186f6..d914231 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | --- apps/nc/netcat.c.orig 2015-11-22 09:54:13.947164164 -0600 | 1 | --- apps/nc/netcat.c.orig Sun Dec 6 22:05:45 2015 |
| 2 | +++ apps/nc/netcat.c 2015-11-22 10:49:52.455236524 -0600 | 2 | +++ apps/nc/netcat.c Sun Dec 6 23:23:15 2015 |
| 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" |
| @@ -9,9 +9,9 @@ | |||
| 9 | +#endif | 9 | +#endif |
| 10 | + | 10 | + |
| 11 | #define PORT_MAX 65535 | 11 | #define PORT_MAX 65535 |
| 12 | #define PORT_MAX_LEN 6 | ||
| 13 | #define UNIX_DG_TMP_SOCKET_SIZE 19 | 12 | #define UNIX_DG_TMP_SOCKET_SIZE 19 |
| 14 | @@ -93,9 +97,13 @@ | 13 | |
| 14 | @@ -92,9 +96,13 @@ | ||
| 15 | int Dflag; /* sodebug */ | 15 | int Dflag; /* sodebug */ |
| 16 | int Iflag; /* TCP receive buffer size */ | 16 | int Iflag; /* TCP receive buffer size */ |
| 17 | int Oflag; /* TCP send buffer size */ | 17 | int Oflag; /* TCP send buffer size */ |
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | int usetls; /* use TLS */ | 26 | int usetls; /* use TLS */ |
| 27 | char *Cflag; /* Public cert file */ | 27 | char *Cflag; /* Public cert file */ |
| 28 | @@ -145,7 +153,7 @@ | 28 | @@ -144,7 +152,7 @@ |
| 29 | struct servent *sv; | 29 | struct servent *sv; |
| 30 | socklen_t len; | 30 | socklen_t len; |
| 31 | struct sockaddr_storage cliaddr; | 31 | struct sockaddr_storage cliaddr; |
| @@ -34,7 +34,7 @@ | |||
| 34 | const char *errstr, *proxyhost = "", *proxyport = NULL; | 34 | const char *errstr, *proxyhost = "", *proxyport = NULL; |
| 35 | struct addrinfo proxyhints; | 35 | struct addrinfo proxyhints; |
| 36 | char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; | 36 | char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; |
| 37 | @@ -246,12 +254,14 @@ | 37 | @@ -245,12 +253,14 @@ |
| 38 | case 'u': | 38 | case 'u': |
| 39 | uflag = 1; | 39 | uflag = 1; |
| 40 | break; | 40 | break; |
| @@ -49,7 +49,7 @@ | |||
| 49 | case 'v': | 49 | case 'v': |
| 50 | vflag = 1; | 50 | vflag = 1; |
| 51 | break; | 51 | break; |
| 52 | @@ -284,9 +294,11 @@ | 52 | @@ -283,9 +293,11 @@ |
| 53 | errx(1, "TCP send window %s: %s", | 53 | errx(1, "TCP send window %s: %s", |
| 54 | errstr, optarg); | 54 | errstr, optarg); |
| 55 | break; | 55 | break; |
| @@ -61,7 +61,7 @@ | |||
| 61 | case 'T': | 61 | case 'T': |
| 62 | errstr = NULL; | 62 | errstr = NULL; |
| 63 | errno = 0; | 63 | errno = 0; |
| 64 | @@ -310,9 +322,11 @@ | 64 | @@ -309,9 +321,11 @@ |
| 65 | argc -= optind; | 65 | argc -= optind; |
| 66 | argv += optind; | 66 | argv += optind; |
| 67 | 67 | ||
| @@ -73,7 +73,7 @@ | |||
| 73 | 73 | ||
| 74 | if (family == AF_UNIX) { | 74 | if (family == AF_UNIX) { |
| 75 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) | 75 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) |
| 76 | @@ -792,7 +806,10 @@ | 76 | @@ -791,7 +805,10 @@ |
| 77 | remote_connect(const char *host, const char *port, struct addrinfo hints) | 77 | remote_connect(const char *host, const char *port, struct addrinfo hints) |
| 78 | { | 78 | { |
| 79 | struct addrinfo *res, *res0; | 79 | struct addrinfo *res, *res0; |
| @@ -85,7 +85,7 @@ | |||
| 85 | 85 | ||
| 86 | if ((error = getaddrinfo(host, port, &hints, &res))) | 86 | if ((error = getaddrinfo(host, port, &hints, &res))) |
| 87 | errx(1, "getaddrinfo: %s", gai_strerror(error)); | 87 | errx(1, "getaddrinfo: %s", gai_strerror(error)); |
| 88 | @@ -807,8 +824,10 @@ | 88 | @@ -806,8 +823,10 @@ |
| 89 | if (sflag || pflag) { | 89 | if (sflag || pflag) { |
| 90 | struct addrinfo ahints, *ares; | 90 | struct addrinfo ahints, *ares; |
| 91 | 91 | ||
| @@ -96,7 +96,7 @@ | |||
| 96 | memset(&ahints, 0, sizeof(struct addrinfo)); | 96 | memset(&ahints, 0, sizeof(struct addrinfo)); |
| 97 | ahints.ai_family = res0->ai_family; | 97 | ahints.ai_family = res0->ai_family; |
| 98 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; | 98 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; |
| 99 | @@ -877,7 +896,10 @@ | 99 | @@ -876,7 +895,10 @@ |
| 100 | local_listen(char *host, char *port, struct addrinfo hints) | 100 | local_listen(char *host, char *port, struct addrinfo hints) |
| 101 | { | 101 | { |
| 102 | struct addrinfo *res, *res0; | 102 | struct addrinfo *res, *res0; |
| @@ -108,7 +108,7 @@ | |||
| 108 | int error; | 108 | int error; |
| 109 | 109 | ||
| 110 | /* Allow nodename to be null. */ | 110 | /* Allow nodename to be null. */ |
| 111 | @@ -899,9 +921,11 @@ | 111 | @@ -898,9 +920,11 @@ |
| 112 | res0->ai_protocol)) < 0) | 112 | res0->ai_protocol)) < 0) |
| 113 | continue; | 113 | continue; |
| 114 | 114 | ||
| @@ -120,7 +120,7 @@ | |||
| 120 | 120 | ||
| 121 | set_common_sockopts(s, res0->ai_family); | 121 | set_common_sockopts(s, res0->ai_family); |
| 122 | 122 | ||
| 123 | @@ -1344,11 +1368,13 @@ | 123 | @@ -1340,11 +1364,13 @@ |
| 124 | { | 124 | { |
| 125 | int x = 1; | 125 | int x = 1; |
| 126 | 126 | ||
| @@ -134,7 +134,7 @@ | |||
| 134 | if (Dflag) { | 134 | if (Dflag) { |
| 135 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, | 135 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, |
| 136 | &x, sizeof(x)) == -1) | 136 | &x, sizeof(x)) == -1) |
| 137 | @@ -1523,15 +1549,19 @@ | 137 | @@ -1519,15 +1545,19 @@ |
| 138 | \t-P proxyuser\tUsername for proxy authentication\n\ | 138 | \t-P proxyuser\tUsername for proxy authentication\n\ |
| 139 | \t-p port\t Specify local port for remote connects\n\ | 139 | \t-p port\t Specify local port for remote connects\n\ |
| 140 | \t-R CAfile CA bundle\n\ | 140 | \t-R CAfile CA bundle\n\ |
| @@ -73,6 +73,7 @@ $CP $libtls_src/tls.h libtls-standalone/include | |||
| 73 | 73 | ||
| 74 | for i in crypto/compat libtls-standalone/compat; do | 74 | for i in crypto/compat libtls-standalone/compat; do |
| 75 | for j in $libc_src/crypt/arc4random.c \ | 75 | for j in $libc_src/crypt/arc4random.c \ |
| 76 | $libc_src/crypt/arc4random_uniform.c \ | ||
| 76 | $libc_src/crypt/chacha_private.h \ | 77 | $libc_src/crypt/chacha_private.h \ |
| 77 | $libc_src/string/explicit_bzero.c \ | 78 | $libc_src/string/explicit_bzero.c \ |
| 78 | $libc_src/stdlib/reallocarray.c \ | 79 | $libc_src/stdlib/reallocarray.c \ |
