-static bool test_security(const char *parameter) {
- if (streq(parameter, "selinux"))
- return use_selinux();
- if (streq(parameter, "apparmor"))
- return use_apparmor();
- if (streq(parameter, "ima"))
- return use_ima();
- if (streq(parameter, "smack"))
- return use_smack();
- return false;
+static bool condition_test_security(Condition *c) {
+ assert(c);
+ assert(c->parameter);
+ assert(c->type == CONDITION_SECURITY);
+
+ if (streq(c->parameter, "selinux"))
+ return use_selinux() == !c->negate;
+ if (streq(c->parameter, "apparmor"))
+ return use_apparmor() == !c->negate;
+ if (streq(c->parameter, "ima"))
+ return use_ima() == !c->negate;
+ if (streq(c->parameter, "smack"))
+ return use_smack() == !c->negate;
+ return c->negate;