1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-25 06:35:46 +00:00

nc(1) has the more crazy unveil + pledge configuration based upon

argument flags.  I think this correctly replaces "tmppath" with an
unveil.
This commit is contained in:
deraadt
2026-02-23 16:47:07 +00:00
parent 3ae6636769
commit c2d38473df

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: netcat.c,v 1.237 2025/12/06 09:48:30 phessler Exp $ */
/* $OpenBSD: netcat.c,v 1.238 2026/02/23 16:47:07 deraadt Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -381,6 +381,8 @@ main(int argc, char *argv[])
*/
} else {
if (family == AF_UNIX) {
if (unveil("/tmp", "rwc") == -1)
err(1, "unveil /tmp");
if (unveil(host, "rwc") == -1)
err(1, "unveil %s", host);
if (uflag && !kflag) {
@@ -400,7 +402,7 @@ main(int argc, char *argv[])
}
if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
if (pledge("stdio rpath wpath cpath unix", NULL) == -1)
err(1, "pledge");
} else if (Fflag && Pflag) {
if (pledge("stdio inet dns sendfd tty", NULL) == -1)