chiark / gitweb /
util: introduce our own gperf based capability list
[elogind.git] / src / shared / condition.c
index c5a3caa4dbbe2b0e318d0bcf1850da70a433e042..dcbf9a7e86a52f2ef089339550b6da4f02eba41f 100644 (file)
 #include "fileio.h"
 #include "unit.h"
 #include "architecture.h"
 #include "fileio.h"
 #include "unit.h"
 #include "architecture.h"
-#include "virt.h"
 #include "smack-util.h"
 #include "apparmor-util.h"
 #include "ima-util.h"
 #include "selinux-util.h"
 #include "audit.h"
 #include "condition.h"
 #include "smack-util.h"
 #include "apparmor-util.h"
 #include "ima-util.h"
 #include "selinux-util.h"
 #include "audit.h"
 #include "condition.h"
+#include "cap-list.h"
 
 Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
         Condition *c;
 
 Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
         Condition *c;
@@ -236,7 +236,7 @@ static int condition_test_security(Condition *c) {
 
 static int condition_test_capability(Condition *c) {
         _cleanup_fclose_ FILE *f = NULL;
 
 static int condition_test_capability(Condition *c) {
         _cleanup_fclose_ FILE *f = NULL;
-        cap_value_t value;
+        int value;
         char line[LINE_MAX];
         unsigned long long capabilities = -1;
 
         char line[LINE_MAX];
         unsigned long long capabilities = -1;
 
@@ -245,8 +245,8 @@ static int condition_test_capability(Condition *c) {
         assert(c->type == CONDITION_CAPABILITY);
 
         /* If it's an invalid capability, we don't have it */
         assert(c->type == CONDITION_CAPABILITY);
 
         /* If it's an invalid capability, we don't have it */
-
-        if (cap_from_name(c->parameter, &value) < 0)
+        value = capability_from_name(c->parameter);
+        if (value < 0)
                 return -EINVAL;
 
         /* If it's a valid capability we default to assume
                 return -EINVAL;
 
         /* If it's a valid capability we default to assume