selinux: split up mac_selinux_have() from mac_selinux_use()

Let's distuingish the cases where our code takes an active role in
selinux management, or just passively reports whatever selinux
properties are set.

mac_selinux_have() now checks whether selinux is around for the passive
stuff, and mac_selinux_use() for the active stuff. The latter checks the
former, plus also checks UID == 0, under the assumption that only when
we run priviliged selinux management really makes sense.

Fixes: #1941
This commit is contained in:
Lennart Poettering
2015-11-27 20:28:13 +01:00
parent 564c44436c
commit 6355e75610
9 changed files with 23 additions and 12 deletions
+1 -1
View File
@@ -231,7 +231,7 @@ static int condition_test_security(Condition *c) {
assert(c->type == CONDITION_SECURITY);
if (streq(c->parameter, "selinux"))
return mac_selinux_use();
return mac_selinux_have();
if (streq(c->parameter, "smack"))
return mac_smack_use();
if (streq(c->parameter, "apparmor"))