summaryrefslogtreecommitdiffstats
path: root/regress/sys/kern/pledge
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2018-04-27 18:05:44 +0000
committerbeck <beck@openbsd.org>2018-04-27 18:05:44 +0000
commitc77d22033f56ea169fecf65017674e98407d9a39 (patch)
treee28b1bd1d2304ba38969ee2d045987f82236f79c /regress/sys/kern/pledge
parentIf a wifi driver does not provide an ic_bgscan_start() function there is no (diff)
downloadwireguard-openbsd-c77d22033f56ea169fecf65017674e98407d9a39.tar.xz
wireguard-openbsd-c77d22033f56ea169fecf65017674e98407d9a39.zip
Add test for stat behavior to make sure we can stat executable only
Diffstat (limited to 'regress/sys/kern/pledge')
-rw-r--r--regress/sys/kern/pledge/pledgepath/syscalls.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regress/sys/kern/pledge/pledgepath/syscalls.c b/regress/sys/kern/pledge/pledgepath/syscalls.c
index 5803db5f813..108ab10bf01 100644
--- a/regress/sys/kern/pledge/pledgepath/syscalls.c
+++ b/regress/sys/kern/pledge/pledgepath/syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscalls.c,v 1.21 2018/04/27 15:28:00 beck Exp $ */
+/* $OpenBSD: syscalls.c,v 1.22 2018/04/27 18:05:44 beck Exp $ */
/*
* Copyright (c) 2017 Bob Beck <beck@openbsd.org>
@@ -239,12 +239,15 @@ test_rw(int do_pp)
static int
test_x(int do_pp)
{
+ struct stat sb;
if (do_pp) {
printf("testing \"x\"\n");
if (pledgepath(pp_file1, "x") == -1)
err(1, "%s:%d - pledgepath", __FILE__, __LINE__);
}
PP_SHOULD_SUCCEED((pledgepath(NULL, NULL) == -1), "pledgepath");
+ PP_SHOULD_SUCCEED((lstat(pp_file1, &sb) == -1), "lstat");
+ PP_SHOULD_FAIL((open(pp_file1, O_RDONLY) == -1), "open");
PP_SHOULD_FAIL((open(pp_file1, O_RDONLY) == -1), "open");
PP_SHOULD_FAIL((open(pp_file2, O_RDWR) == -1), "open");
return 0;
@@ -610,5 +613,4 @@ main (int argc, char *argv[])
failures += runcompare(test_exec);
failures += runcompare(test_exec2);
exit(failures);
-
}