Misc fixes to bring portable in line with upstream.

This commit is contained in:
bobsayshilol
2018-11-07 23:45:17 +00:00
parent d826f2dfc1
commit 34394e7ee0
12 changed files with 29 additions and 73 deletions

View File

@@ -1,16 +1,6 @@
--- apps/nc/netcat.c.orig Mon Jul 17 06:06:51 2017
+++ apps/nc/netcat.c Mon Jul 17 06:11:24 2017
@@ -66,7 +66,9 @@
#define POLL_NETIN 2
#define POLL_STDOUT 3
#define BUFSIZE 16384
+#ifndef DEFAULT_CA_FILE
#define DEFAULT_CA_FILE "/etc/ssl/cert.pem"
+#endif
#define TLS_ALL (1 << 1)
#define TLS_NOVERIFY (1 << 2)
@@ -95,9 +97,13 @@
@@ -92,9 +92,13 @@
int Dflag; /* sodebug */
int Iflag; /* TCP receive buffer size */
int Oflag; /* TCP send buffer size */
@@ -24,7 +14,7 @@
int usetls; /* use TLS */
char *Cflag; /* Public cert file */
@@ -266,12 +272,14 @@
@@ -266,12 +270,14 @@
case 'u':
uflag = 1;
break;
@@ -39,7 +29,7 @@
case 'v':
vflag = 1;
break;
@@ -318,9 +326,11 @@
@@ -318,9 +324,11 @@
case 'o':
oflag = optarg;
break;
@@ -51,7 +41,7 @@
case 'T':
errstr = NULL;
errno = 0;
@@ -344,9 +354,11 @@
@@ -344,9 +352,11 @@
argc -= optind;
argv += optind;
@@ -61,9 +51,9 @@
err(1, "setrtable");
+#endif
if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
@@ -892,7 +904,10 @@
/* Cruft to make sure options are clean, and used properly. */
if (argv[0] && !argv[1] && family == AF_UNIX) {
@@ -909,7 +919,10 @@
remote_connect(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
@@ -75,7 +65,7 @@
if ((error = getaddrinfo(host, port, &hints, &res0)))
errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
@@ -907,8 +922,10 @@
@@ -924,8 +937,10 @@
if (sflag || pflag) {
struct addrinfo ahints, *ares;
@@ -86,8 +76,8 @@
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
@@ -979,7 +996,10 @@
local_listen(char *host, char *port, struct addrinfo hints)
@@ -996,7 +1011,10 @@
local_listen(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
- int s = -1, ret, x = 1, save_errno;
@@ -98,7 +88,7 @@
int error;
/* Allow nodename to be null. */
@@ -1000,9 +1020,11 @@
@@ -1017,9 +1035,11 @@
res->ai_protocol)) < 0)
continue;
@@ -110,7 +100,7 @@
set_common_sockopts(s, res->ai_family);
@@ -1458,11 +1480,13 @@
@@ -1475,11 +1495,13 @@
{
int x = 1;
@@ -124,7 +114,7 @@
if (Dflag) {
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
&x, sizeof(x)) == -1)
@@ -1473,9 +1497,16 @@
@@ -1490,9 +1512,16 @@
IP_TOS, &Tflag, sizeof(Tflag)) == -1)
err(1, "set IP ToS");
@@ -141,7 +131,7 @@
}
if (Iflag) {
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
@@ -1499,13 +1530,17 @@
@@ -1516,13 +1545,17 @@
}
if (minttl != -1) {
@@ -160,7 +150,7 @@
}
}
@@ -1714,14 +1749,22 @@
@@ -1748,14 +1781,22 @@
\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\