From 6a2321937634bc08fb7554bc72a55ccd41f7ed5a Mon Sep 17 00:00:00 2001 From: oshogbo Date: Tue, 30 Aug 2016 19:58:41 +0000 Subject: [PATCH] Fix Capsicum syscalls test suite. --- .../regression/capsicum/syscalls/cap_fcntls_limit.c | 10 ++++++++-- .../regression/capsicum/syscalls/cap_ioctls_limit.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/regression/capsicum/syscalls/cap_fcntls_limit.c b/tools/regression/capsicum/syscalls/cap_fcntls_limit.c index f37710d9df12..e3a05bf66149 100644 --- a/tools/regression/capsicum/syscalls/cap_fcntls_limit.c +++ b/tools/regression/capsicum/syscalls/cap_fcntls_limit.c @@ -157,13 +157,16 @@ static void fcntl_tests_1(int fd) { uint32_t fcntlrights; + cap_rights_t rights; CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0); fcntlrights = 0; CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); CHECK(fcntlrights == CAP_FCNTL_GETFL); - CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0); + CAP_ALL(&rights); + cap_rights_clear(&rights, CAP_FCNTL); + CHECK(cap_rights_limit(fd, &rights) == 0); fcntlrights = CAP_FCNTL_ALL; CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); @@ -206,8 +209,11 @@ static void fcntl_tests_2(int fd) { uint32_t fcntlrights; + cap_rights_t rights; - CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0); + CAP_ALL(&rights); + cap_rights_clear(&rights, CAP_FCNTL); + CHECK(cap_rights_limit(fd, &rights) == 0); fcntlrights = CAP_FCNTL_ALL; CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); diff --git a/tools/regression/capsicum/syscalls/cap_ioctls_limit.c b/tools/regression/capsicum/syscalls/cap_ioctls_limit.c index 27d85896533f..2ed00f175469 100644 --- a/tools/regression/capsicum/syscalls/cap_ioctls_limit.c +++ b/tools/regression/capsicum/syscalls/cap_ioctls_limit.c @@ -131,6 +131,7 @@ static void ioctl_tests_1(int fd) { unsigned long cmds[2]; + cap_rights_t rights; cmds[0] = FIOCLEX; CHECK(cap_ioctls_limit(fd, cmds, 1) == 0); @@ -139,7 +140,10 @@ ioctl_tests_1(int fd) CHECK(cmds[0] == FIOCLEX); CHECK(cmds[1] == 0); - CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0); + CAP_ALL(&rights); + cap_rights_clear(&rights, CAP_IOCTL); + + CHECK(cap_rights_limit(fd, &rights) == 0); CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0); cmds[0] = FIOCLEX; @@ -173,8 +177,12 @@ static void ioctl_tests_2(int fd) { unsigned long cmds[2]; + cap_rights_t rights; - CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0); + CAP_ALL(&rights); + cap_rights_clear(&rights, CAP_IOCTL); + + CHECK(cap_rights_limit(fd, &rights) == 0); CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0); cmds[0] = FIOCLEX;