blob: 9e7589a48587628625f8b370fa2742b8f9b81f39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <selinux/selinux.h>
int getenforce_main(int argc, char **argv)
{
int rc;
rc = is_selinux_enabled();
if (rc <= 0) {
printf("Disabled\n");
return 0;
}
rc = security_getenforce();
if (rc < 0) {
fprintf(stderr, "Could not get enforcing status: %s\n",
strerror(errno));
return 2;
}
if (rc)
printf("Enforcing\n");
else
printf("Permissive\n");
return 0;
}
|