|
Lines 48-53
Link Here
|
| 48 |
|
48 |
|
| 49 |
#include "utils.h" |
49 |
#include "utils.h" |
| 50 |
|
50 |
|
|
|
51 |
#include "freebsd_test_suite/macros.h" |
| 52 |
|
| 51 |
static pid_t pid; |
53 |
static pid_t pid; |
| 52 |
static int filedesc, status; |
54 |
static int filedesc, status; |
| 53 |
static struct pollfd fds[1]; |
55 |
static struct pollfd fds[1]; |
|
Lines 1512-1525
Link Here
|
| 1512 |
|
1514 |
|
| 1513 |
ATF_TC_BODY(cap_enter_success, tc) |
1515 |
ATF_TC_BODY(cap_enter_success, tc) |
| 1514 |
{ |
1516 |
{ |
| 1515 |
int capinfo; |
|
|
| 1516 |
size_t len = sizeof(capinfo); |
| 1517 |
const char *capname = "kern.features.security_capability_mode"; |
1517 |
const char *capname = "kern.features.security_capability_mode"; |
| 1518 |
ATF_REQUIRE_EQ(0, sysctlbyname(capname, &capinfo, &len, NULL, 0)); |
|
|
| 1519 |
|
1518 |
|
| 1520 |
/* Without CAPABILITY_MODE enabled, cap_enter() returns ENOSYS */ |
1519 |
ATF_REQUIRE_SYSCTL_INT(capname, 1); |
| 1521 |
if (!capinfo) |
|
|
| 1522 |
atf_tc_skip("Capsicum is not enabled in the system"); |
| 1523 |
|
1520 |
|
| 1524 |
FILE *pipefd = setup(fds, auclass); |
1521 |
FILE *pipefd = setup(fds, auclass); |
| 1525 |
ATF_REQUIRE((pid = fork()) != -1); |
1522 |
ATF_REQUIRE((pid = fork()) != -1); |
|
Lines 1550-1563
Link Here
|
| 1550 |
|
1547 |
|
| 1551 |
ATF_TC_BODY(cap_getmode_success, tc) |
1548 |
ATF_TC_BODY(cap_getmode_success, tc) |
| 1552 |
{ |
1549 |
{ |
| 1553 |
int capinfo, modep; |
1550 |
int modep; |
| 1554 |
size_t len = sizeof(capinfo); |
|
|
| 1555 |
const char *capname = "kern.features.security_capability_mode"; |
1551 |
const char *capname = "kern.features.security_capability_mode"; |
| 1556 |
ATF_REQUIRE_EQ(0, sysctlbyname(capname, &capinfo, &len, NULL, 0)); |
|
|
| 1557 |
|
1552 |
|
| 1558 |
/* Without CAPABILITY_MODE enabled, cap_getmode() returns ENOSYS */ |
1553 |
ATF_REQUIRE_SYSCTL_INT(capname, 1); |
| 1559 |
if (!capinfo) |
|
|
| 1560 |
atf_tc_skip("Capsicum is not enabled in the system"); |
| 1561 |
|
1554 |
|
| 1562 |
pid = getpid(); |
1555 |
pid = getpid(); |
| 1563 |
snprintf(pcregex, sizeof(pcregex), "cap_getmode.*%d.*success", pid); |
1556 |
snprintf(pcregex, sizeof(pcregex), "cap_getmode.*%d.*success", pid); |