From 66ceb5e9b7ccc1005b0b710f32228c0b69070e98 Mon Sep 17 00:00:00 2001 From: zrj Date: Thu, 3 Nov 2016 19:15:43 +0200 Subject: [PATCH] libressl: Few local modifications for netcat. * Exclude pledge(), has no use for us. * Make strtoport() static to prevent missing prototype warning. No functional change for libprivate_crypto or libprivate_ssl. --- crypto/libressl/apps/nc/netcat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/libressl/apps/nc/netcat.c b/crypto/libressl/apps/nc/netcat.c index cdb2db277e..326d7fe5a3 100644 --- a/crypto/libressl/apps/nc/netcat.c +++ b/crypto/libressl/apps/nc/netcat.c @@ -342,6 +342,7 @@ main(int argc, char *argv[]) err(1, "setrtable"); #endif +#ifdef __OpenBSD__ if (family == AF_UNIX) { if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) err(1, "pledge"); @@ -359,6 +360,7 @@ main(int argc, char *argv[]) err(1, "pledge"); } else if (pledge("stdio inet dns", NULL) == -1) err(1, "pledge"); +#endif /* Cruft to make sure options are clean, and used properly. */ if (argv[0] && !argv[1] && family == AF_UNIX) { @@ -463,11 +465,13 @@ main(int argc, char *argv[]) if (Kflag && (privkey = tls_load_file(Kflag, &privkeylen, NULL)) == NULL) errx(1, "unable to load TLS key file %s", Kflag); +#ifdef __OpenBSD__ if (Pflag) { if (pledge("stdio inet dns tty", NULL) == -1) err(1, "pledge"); } else if (pledge("stdio inet dns", NULL) == -1) err(1, "pledge"); +#endif if (tls_init() == -1) errx(1, "unable to initialize TLS"); @@ -1328,7 +1332,7 @@ atelnet(int nfd, unsigned char *buf, unsigned int size) } -int +static int strtoport(char *portstr, int udp) { struct servent *entry; -- 2.41.0