summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2019-05-15 21:05:56 +0000
committerBob Beck <beck@cvs.openbsd.org>2019-05-15 21:05:56 +0000
commit9750ac170c8ce7a4fcea43ba5d679c62d77ed6e2 (patch)
treefed4e334f75d17c8d3ec0873edf418cbc4837d30
parent9dee95d3ed478e22201195ccd5d5208a0dd33e01 (diff)
Add a regression test for path discovery outside of unveil() which
we should eventually fix
-rw-r--r--regress/sys/kern/unveil/syscalls.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/regress/sys/kern/unveil/syscalls.c b/regress/sys/kern/unveil/syscalls.c
index 16561500b31..650f698c061 100644
--- a/regress/sys/kern/unveil/syscalls.c
+++ b/regress/sys/kern/unveil/syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscalls.c,v 1.22 2019/03/24 18:14:20 beck Exp $ */
+/* $OpenBSD: syscalls.c,v 1.23 2019/05/15 21:05:55 beck Exp $ */
/*
* Copyright (c) 2017-2019 Bob Beck <beck@openbsd.org>
@@ -852,6 +852,23 @@ test_kn(int do_uv)
}
+static int
+test_pathdiscover(int do_uv)
+{
+ struct stat sb;
+ if (do_uv) {
+ printf("testing path discovery\n");
+ if (unveil("/usr/share/man", "rx") == -1)
+ err(1, "%s:%d - unveil", __FILE__, __LINE__);
+ }
+ UV_SHOULD_SUCCEED((lstat("/usr/share/man", &sb) == -1), "lstat");
+ UV_SHOULD_SUCCEED((lstat("/usr/share/man/../../share/man", &sb) == -1), "lstat");
+ /* XXX XXX XXX This should fail */
+ UV_SHOULD_SUCCEED((lstat("/usr/share/man/../../local/../share/man", &sb) == -1), "lstat");
+ return 0;
+}
+
+
int
main (int argc, char *argv[])
{
@@ -898,5 +915,6 @@ main (int argc, char *argv[])
failures += runcompare_internal(test_fork, 0);
failures += runcompare(test_dotdotup);
failures += runcompare(test_kn);
+ failures += runcompare(test_pathdiscover);
exit(failures);
}