chiark / gitweb /
bus-proxyd: xml - consider empty tags as recv
authorKay Sievers <kay@vrfy.org>
Fri, 9 Jan 2015 17:46:08 +0000 (18:46 +0100)
committerKay Sievers <kay@vrfy.org>
Fri, 9 Jan 2015 17:46:08 +0000 (18:46 +0100)
src/bus-proxyd/bus-xml-policy.c

index 9e4cc454cf36af9f8813151cc1ca45b4a025f093..58241038ea5608bc1a140141d58927a74dec3424 100644 (file)
@@ -280,7 +280,7 @@ static int file_load(Policy *p, const char *path) {
                                 else if (streq(name, "eavesdrop")) {
                                         log_debug("Unsupported attribute %s= at %s:%u, ignoring.", name, path, line);
                                         state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
                                 else if (streq(name, "eavesdrop")) {
                                         log_debug("Unsupported attribute %s= at %s:%u, ignoring.", name, path, line);
                                         state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
-                                        ic = POLICY_ITEM_RECV; /* eavesdrop is a type of receive attribute match! */
+                                        break;
                                 } else {
                                         log_error("Unknown attribute %s= at %s:%u, ignoring.", name, path, line);
                                         state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
                                 } else {
                                         log_error("Unknown attribute %s= at %s:%u, ignoring.", name, path, line);
                                         state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
@@ -329,10 +329,9 @@ static int file_load(Policy *p, const char *path) {
                         } else if (t == XML_TAG_CLOSE_EMPTY ||
                                    (t == XML_TAG_CLOSE && streq(name, i->type == POLICY_ITEM_ALLOW ? "allow" : "deny"))) {
 
                         } else if (t == XML_TAG_CLOSE_EMPTY ||
                                    (t == XML_TAG_CLOSE && streq(name, i->type == POLICY_ITEM_ALLOW ? "allow" : "deny"))) {
 
-                                if (i->class == _POLICY_ITEM_CLASS_UNSET) {
-                                        log_error("Policy not set at %s:%u.", path, line);
-                                        return -EINVAL;
-                                }
+                                /* If the tag is fully empty so far, we consider it a recv */
+                                if (i->class == _POLICY_ITEM_CLASS_UNSET)
+                                        i->class = POLICY_ITEM_RECV;
 
                                 if (policy_category == POLICY_CATEGORY_DEFAULT)
                                         item_append(i, &p->default_items);
 
                                 if (policy_category == POLICY_CATEGORY_DEFAULT)
                                         item_append(i, &p->default_items);