Debian Codegraph @

libselinux/man/man3/security_getenforce.3

raw
1 .TH "security_getenforce" "3" "1 January 2004" "[email protected]" "SELinux API documentation"
2 .SH "NAME"
3 security_getenforce, security_setenforce, security_deny_unknown, security_reject_unknown,
4 security_get_checkreqprot \- get or set the enforcing state of SELinux
5 .
6 .SH "SYNOPSIS"
7 .B #include <selinux/selinux.h>
8 .sp
9 .B int security_getenforce(void);
10 .sp
11 .BI "int security_setenforce(int "value );
12 .sp
13 .B int security_deny_unknown(void);
14 .sp
15 .B int security_reject_unknown(void);
16 .sp
17 .B int security_get_checkreqprot(void);
18 .
19 .SH "DESCRIPTION"
20 .BR security_getenforce ()
21 returns 0 if SELinux is running in permissive mode, 1 if it is running in
22 enforcing mode, and \-1 on error.
23
24 .BR security_setenforce ()
25 sets SELinux to enforcing mode if the value 1 is passed in, and sets it to
26 permissive mode if 0 is passed in. On success 0 is returned, on error \-1 is
27 returned.
28
29 .BR security_deny_unknown ()
30 returns 0 if SELinux treats policy queries on undefined object classes or
31 permissions as being allowed, 1 if such queries are denied, and \-1 on error.
32
33 .BR security_reject_unknown ()
34 returns 1 if the current policy was built with handle-unknown=reject and SELinux
35 would reject loading it, if it did not define all kernel object classes and
36 permissions. In this state, when
37 .BR selinux_set_mapping()
38 and
39 .BR selinux_check_access()
40 are used with an undefined userspace class or permission, an error is returned
41 and errno is set to EINVAL.
42
43 It returns 0 if the current policy was built with handle-unknown=allow or
44 handle-unknown=deny. In this state, policy queries are treated according to
45 .BR security_deny_unknown().
46 \-1 is returned on error.
47
48 .BR security_get_checkreqprot ()
49 can be used to determine whether SELinux is configured to check the
50 protection requested by the application or the actual protection that will
51 be applied by the kernel (including the effects of READ_IMPLIES_EXEC) on
52 mmap and mprotect calls. It returns 0 if SELinux checks the actual
53 protection, 1 if it checks the requested protection, and \-1 on error.
54 .
55 .SH "SEE ALSO"
56 .BR selinux "(8)"