selinux: use SELinux status page
Switch from security_getenforce() and netlink notifications to the SELinux status page. This usage saves system calls and will also be the default in libselinux > 3.1 [1]. [1]: https://github.com/SELinuxProject/selinux/commit/05bdc03130d741e53e1fb45a958d0a2c184be503
This commit is contained in:
@@ -198,7 +198,7 @@ int mac_selinux_generic_access_check(
|
||||
return r;
|
||||
|
||||
/* delay call until we checked in `access_init()` if SELinux is actually enabled */
|
||||
enforce = security_getenforce() != 0;
|
||||
enforce = mac_selinux_enforcing();
|
||||
|
||||
r = sd_bus_query_sender_creds(
|
||||
message,
|
||||
@@ -278,7 +278,7 @@ int mac_selinux_generic_access_check(
|
||||
return enforce ? r : 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* HAVE_SELINUX */
|
||||
|
||||
int mac_selinux_generic_access_check(
|
||||
sd_bus_message *message,
|
||||
@@ -289,4 +289,4 @@ int mac_selinux_generic_access_check(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_SELINUX */
|
||||
|
||||
Reference in New Issue
Block a user