From ff8da2f7c86a34a1ed3244d926c4505498fea940 Mon Sep 17 00:00:00 2001 From: beck Date: Fri, 27 Jul 2018 01:41:39 +0000 Subject: [PATCH] add regress for unveil of "." now that I fixed this --- regress/sys/kern/unveil/syscalls.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/regress/sys/kern/unveil/syscalls.c b/regress/sys/kern/unveil/syscalls.c index e3a5518ef1a..8fc5999fb1d 100644 --- a/regress/sys/kern/unveil/syscalls.c +++ b/regress/sys/kern/unveil/syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscalls.c,v 1.12 2018/07/27 01:38:02 beck Exp $ */ +/* $OpenBSD: syscalls.c,v 1.13 2018/07/27 01:41:39 beck Exp $ */ /* * Copyright (c) 2017-2018 Bob Beck @@ -741,6 +741,7 @@ test_slash(int do_uv) { extern char **environ; if (do_uv) { + printf("testing unveil(\"/\")\n"); if (unveil("/bin/sh", "x") == -1) err(1, "%s:%d - unveil", __FILE__, __LINE__); if (unveil("/", "r") == -1) @@ -749,6 +750,18 @@ test_slash(int do_uv) return 0; } +static int +test_dot(int do_uv) +{ + extern char **environ; + if (do_uv) { + printf("testing unveil(\".\")\n"); + if (unveil(".", "rwxc") == -1) + err(1, "%s:%d - unveil", __FILE__, __LINE__); + } + return 0; +} + static int test_bypassunveil(int do_uv) { @@ -804,6 +817,7 @@ main (int argc, char *argv[]) failures += runcompare(test_realpath); failures += runcompare(test_parent_dir); failures += runcompare(test_slash); + failures += runcompare(test_dot); failures += runcompare(test_bypassunveil); failures += runcompare_internal(test_fork, 0); exit(failures); -- 2.20.1