diff options
Diffstat (limited to 'patches/netcat.c.patch')
| -rw-r--r-- | patches/netcat.c.patch | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index 35f88db..07205ec 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
| @@ -1,16 +1,6 @@ | |||
| 1 | --- apps/nc/netcat.c.orig Mon Jul 17 06:06:51 2017 | 1 | --- apps/nc/netcat.c.orig 2018-11-07 17:01:38.000000000 -0600 |
| 2 | +++ apps/nc/netcat.c Mon Jul 17 06:11:24 2017 | 2 | +++ apps/nc/netcat.c 2018-11-07 17:37:57.000000000 -0600 |
| 3 | @@ -66,7 +66,9 @@ | 3 | @@ -92,9 +92,13 @@ |
| 4 | #define POLL_NETIN 2 | ||
| 5 | #define POLL_STDOUT 3 | ||
| 6 | #define BUFSIZE 16384 | ||
| 7 | +#ifndef DEFAULT_CA_FILE | ||
| 8 | #define DEFAULT_CA_FILE "/etc/ssl/cert.pem" | ||
| 9 | +#endif | ||
| 10 | |||
| 11 | #define TLS_ALL (1 << 1) | ||
| 12 | #define TLS_NOVERIFY (1 << 2) | ||
| 13 | @@ -95,9 +97,13 @@ | ||
| 14 | int Dflag; /* sodebug */ | 4 | int Dflag; /* sodebug */ |
| 15 | int Iflag; /* TCP receive buffer size */ | 5 | int Iflag; /* TCP receive buffer size */ |
| 16 | int Oflag; /* TCP send buffer size */ | 6 | int Oflag; /* TCP send buffer size */ |
| @@ -21,10 +11,10 @@ | |||
| 21 | +#ifdef SO_RTABLE | 11 | +#ifdef SO_RTABLE |
| 22 | int rtableid = -1; | 12 | int rtableid = -1; |
| 23 | +#endif | 13 | +#endif |
| 24 | 14 | ||
| 25 | int usetls; /* use TLS */ | 15 | int usetls; /* use TLS */ |
| 26 | char *Cflag; /* Public cert file */ | 16 | char *Cflag; /* Public cert file */ |
| 27 | @@ -266,12 +272,14 @@ | 17 | @@ -266,12 +270,14 @@ |
| 28 | case 'u': | 18 | case 'u': |
| 29 | uflag = 1; | 19 | uflag = 1; |
| 30 | break; | 20 | break; |
| @@ -39,7 +29,7 @@ | |||
| 39 | case 'v': | 29 | case 'v': |
| 40 | vflag = 1; | 30 | vflag = 1; |
| 41 | break; | 31 | break; |
| 42 | @@ -318,9 +326,11 @@ | 32 | @@ -318,9 +324,11 @@ |
| 43 | case 'o': | 33 | case 'o': |
| 44 | oflag = optarg; | 34 | oflag = optarg; |
| 45 | break; | 35 | break; |
| @@ -51,19 +41,19 @@ | |||
| 51 | case 'T': | 41 | case 'T': |
| 52 | errstr = NULL; | 42 | errstr = NULL; |
| 53 | errno = 0; | 43 | errno = 0; |
| 54 | @@ -344,9 +354,11 @@ | 44 | @@ -344,9 +352,11 @@ |
| 55 | argc -= optind; | 45 | argc -= optind; |
| 56 | argv += optind; | 46 | argv += optind; |
| 57 | 47 | ||
| 58 | +#ifdef SO_RTABLE | 48 | +#ifdef SO_RTABLE |
| 59 | if (rtableid >= 0) | 49 | if (rtableid >= 0) |
| 60 | if (setrtable(rtableid) == -1) | 50 | if (setrtable(rtableid) == -1) |
| 61 | err(1, "setrtable"); | 51 | err(1, "setrtable"); |
| 62 | +#endif | 52 | +#endif |
| 63 | 53 | ||
| 64 | if (family == AF_UNIX) { | 54 | /* Cruft to make sure options are clean, and used properly. */ |
| 65 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) | 55 | if (argv[0] && !argv[1] && family == AF_UNIX) { |
| 66 | @@ -892,7 +904,10 @@ | 56 | @@ -909,7 +919,10 @@ |
| 67 | remote_connect(const char *host, const char *port, struct addrinfo hints) | 57 | remote_connect(const char *host, const char *port, struct addrinfo hints) |
| 68 | { | 58 | { |
| 69 | struct addrinfo *res, *res0; | 59 | struct addrinfo *res, *res0; |
| @@ -72,13 +62,13 @@ | |||
| 72 | +#ifdef SO_BINDANY | 62 | +#ifdef SO_BINDANY |
| 73 | + int on = 1; | 63 | + int on = 1; |
| 74 | +#endif | 64 | +#endif |
| 75 | 65 | ||
| 76 | if ((error = getaddrinfo(host, port, &hints, &res0))) | 66 | if ((error = getaddrinfo(host, port, &hints, &res0))) |
| 77 | errx(1, "getaddrinfo for host \"%s\" port %s: %s", host, | 67 | errx(1, "getaddrinfo for host \"%s\" port %s: %s", host, |
| 78 | @@ -907,8 +922,10 @@ | 68 | @@ -924,8 +937,10 @@ |
| 79 | if (sflag || pflag) { | 69 | if (sflag || pflag) { |
| 80 | struct addrinfo ahints, *ares; | 70 | struct addrinfo ahints, *ares; |
| 81 | 71 | ||
| 82 | +#ifdef SO_BINDANY | 72 | +#ifdef SO_BINDANY |
| 83 | /* try SO_BINDANY, but don't insist */ | 73 | /* try SO_BINDANY, but don't insist */ |
| 84 | setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); | 74 | setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); |
| @@ -86,8 +76,8 @@ | |||
| 86 | memset(&ahints, 0, sizeof(struct addrinfo)); | 76 | memset(&ahints, 0, sizeof(struct addrinfo)); |
| 87 | ahints.ai_family = res->ai_family; | 77 | ahints.ai_family = res->ai_family; |
| 88 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; | 78 | ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; |
| 89 | @@ -979,7 +996,10 @@ | 79 | @@ -996,7 +1011,10 @@ |
| 90 | local_listen(char *host, char *port, struct addrinfo hints) | 80 | local_listen(const char *host, const char *port, struct addrinfo hints) |
| 91 | { | 81 | { |
| 92 | struct addrinfo *res, *res0; | 82 | struct addrinfo *res, *res0; |
| 93 | - int s = -1, ret, x = 1, save_errno; | 83 | - int s = -1, ret, x = 1, save_errno; |
| @@ -96,24 +86,24 @@ | |||
| 96 | + int ret, x = 1; | 86 | + int ret, x = 1; |
| 97 | +#endif | 87 | +#endif |
| 98 | int error; | 88 | int error; |
| 99 | 89 | ||
| 100 | /* Allow nodename to be null. */ | 90 | /* Allow nodename to be null. */ |
| 101 | @@ -1000,9 +1020,11 @@ | 91 | @@ -1017,9 +1035,11 @@ |
| 102 | res->ai_protocol)) < 0) | 92 | res->ai_protocol)) < 0) |
| 103 | continue; | 93 | continue; |
| 104 | 94 | ||
| 105 | +#ifdef SO_REUSEPORT | 95 | +#ifdef SO_REUSEPORT |
| 106 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 96 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
| 107 | if (ret == -1) | 97 | if (ret == -1) |
| 108 | err(1, NULL); | 98 | err(1, NULL); |
| 109 | +#endif | 99 | +#endif |
| 110 | 100 | ||
| 111 | set_common_sockopts(s, res->ai_family); | 101 | set_common_sockopts(s, res->ai_family); |
| 112 | 102 | ||
| 113 | @@ -1458,11 +1480,13 @@ | 103 | @@ -1475,11 +1495,13 @@ |
| 114 | { | 104 | { |
| 115 | int x = 1; | 105 | int x = 1; |
| 116 | 106 | ||
| 117 | +#ifdef TCP_MD5SIG | 107 | +#ifdef TCP_MD5SIG |
| 118 | if (Sflag) { | 108 | if (Sflag) { |
| 119 | if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG, | 109 | if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG, |
| @@ -124,10 +114,10 @@ | |||
| 124 | if (Dflag) { | 114 | if (Dflag) { |
| 125 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, | 115 | if (setsockopt(s, SOL_SOCKET, SO_DEBUG, |
| 126 | &x, sizeof(x)) == -1) | 116 | &x, sizeof(x)) == -1) |
| 127 | @@ -1473,9 +1497,16 @@ | 117 | @@ -1490,9 +1512,16 @@ |
| 128 | IP_TOS, &Tflag, sizeof(Tflag)) == -1) | 118 | IP_TOS, &Tflag, sizeof(Tflag)) == -1) |
| 129 | err(1, "set IP ToS"); | 119 | err(1, "set IP ToS"); |
| 130 | 120 | ||
| 131 | +#ifdef IPV6_TCLASS | 121 | +#ifdef IPV6_TCLASS |
| 132 | else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 122 | else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| 133 | IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1) | 123 | IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1) |
| @@ -141,16 +131,16 @@ | |||
| 141 | } | 131 | } |
| 142 | if (Iflag) { | 132 | if (Iflag) { |
| 143 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, | 133 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, |
| 144 | @@ -1499,13 +1530,17 @@ | 134 | @@ -1516,13 +1545,17 @@ |
| 145 | } | 135 | } |
| 146 | 136 | ||
| 147 | if (minttl != -1) { | 137 | if (minttl != -1) { |
| 148 | +#ifdef IP_MINTTL | 138 | +#ifdef IP_MINTTL |
| 149 | if (af == AF_INET && setsockopt(s, IPPROTO_IP, | 139 | if (af == AF_INET && setsockopt(s, IPPROTO_IP, |
| 150 | IP_MINTTL, &minttl, sizeof(minttl))) | 140 | IP_MINTTL, &minttl, sizeof(minttl))) |
| 151 | err(1, "set IP min TTL"); | 141 | err(1, "set IP min TTL"); |
| 152 | +#endif | 142 | +#endif |
| 153 | 143 | ||
| 154 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 144 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| 155 | +#ifdef IPV6_MINHOPCOUNT | 145 | +#ifdef IPV6_MINHOPCOUNT |
| 156 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 146 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| @@ -159,8 +149,8 @@ | |||
| 159 | +#endif | 149 | +#endif |
| 160 | } | 150 | } |
| 161 | } | 151 | } |
| 162 | 152 | ||
| 163 | @@ -1714,14 +1749,22 @@ | 153 | @@ -1748,14 +1781,22 @@ |
| 164 | \t-P proxyuser\tUsername for proxy authentication\n\ | 154 | \t-P proxyuser\tUsername for proxy authentication\n\ |
| 165 | \t-p port\t Specify local port for remote connects\n\ | 155 | \t-p port\t Specify local port for remote connects\n\ |
| 166 | \t-R CAfile CA bundle\n\ | 156 | \t-R CAfile CA bundle\n\ |
