summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2018-04-27 18:05:45 +0000
committerBob Beck <beck@cvs.openbsd.org>2018-04-27 18:05:45 +0000
commit4c0894ca8858f4a5a8f17b97c465ff65b8f91f25 (patch)
treea8e58dd13773b6a8fbfe863da8df01643fbff01c /regress
parent2a2ebcd9a4fc16f2f3f7d865715be9d35553d18c (diff)
Add test for stat behavior to make sure we can stat executable only
Diffstat (limited to 'regress')
-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);
-
}