2014-06-06 19:41:24 +02:00
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2013 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "sd-login.h"
|
|
|
|
|
2015-10-27 03:01:06 +01:00
|
|
|
#include "alloc-util.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "bus-internal.h"
|
2015-10-25 22:32:30 +01:00
|
|
|
#include "bus-xml-policy.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "conf-files.h"
|
2014-06-06 19:41:24 +02:00
|
|
|
#include "fileio.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "formats-util.h"
|
2015-10-26 23:01:30 +01:00
|
|
|
#include "locale-util.h"
|
2015-01-17 21:18:52 +01:00
|
|
|
#include "set.h"
|
2015-10-26 22:31:05 +01:00
|
|
|
#include "string-table.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "string-util.h"
|
|
|
|
#include "strv.h"
|
2015-10-25 22:32:30 +01:00
|
|
|
#include "user-util.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "xml.h"
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
static void policy_item_free(PolicyItem *i) {
|
|
|
|
assert(i);
|
|
|
|
|
|
|
|
free(i->interface);
|
|
|
|
free(i->member);
|
|
|
|
free(i->error);
|
|
|
|
free(i->name);
|
|
|
|
free(i->path);
|
|
|
|
free(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(PolicyItem*, policy_item_free);
|
|
|
|
|
2014-09-19 22:05:01 +02:00
|
|
|
static void item_append(PolicyItem *i, PolicyItem **list) {
|
|
|
|
|
|
|
|
PolicyItem *tail;
|
|
|
|
|
|
|
|
LIST_FIND_TAIL(items, *list, tail);
|
|
|
|
LIST_INSERT_AFTER(items, *list, tail, i);
|
|
|
|
}
|
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
static int file_load(Policy *p, const char *path) {
|
|
|
|
|
|
|
|
_cleanup_free_ char *c = NULL, *policy_user = NULL, *policy_group = NULL;
|
|
|
|
_cleanup_(policy_item_freep) PolicyItem *i = NULL;
|
|
|
|
void *xml_state = NULL;
|
|
|
|
unsigned n_other = 0;
|
|
|
|
const char *q;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
STATE_OUTSIDE,
|
|
|
|
STATE_BUSCONFIG,
|
|
|
|
STATE_POLICY,
|
|
|
|
STATE_POLICY_CONTEXT,
|
2015-01-11 17:23:24 +01:00
|
|
|
STATE_POLICY_CONSOLE,
|
2014-06-06 19:41:24 +02:00
|
|
|
STATE_POLICY_USER,
|
|
|
|
STATE_POLICY_GROUP,
|
|
|
|
STATE_POLICY_OTHER_ATTRIBUTE,
|
|
|
|
STATE_ALLOW_DENY,
|
|
|
|
STATE_ALLOW_DENY_INTERFACE,
|
|
|
|
STATE_ALLOW_DENY_MEMBER,
|
|
|
|
STATE_ALLOW_DENY_ERROR,
|
|
|
|
STATE_ALLOW_DENY_PATH,
|
|
|
|
STATE_ALLOW_DENY_MESSAGE_TYPE,
|
|
|
|
STATE_ALLOW_DENY_NAME,
|
|
|
|
STATE_ALLOW_DENY_OTHER_ATTRIBUTE,
|
|
|
|
STATE_OTHER,
|
|
|
|
} state = STATE_OUTSIDE;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
POLICY_CATEGORY_NONE,
|
|
|
|
POLICY_CATEGORY_DEFAULT,
|
|
|
|
POLICY_CATEGORY_MANDATORY,
|
2015-01-11 17:23:24 +01:00
|
|
|
POLICY_CATEGORY_ON_CONSOLE,
|
|
|
|
POLICY_CATEGORY_NO_CONSOLE,
|
2014-06-06 19:41:24 +02:00
|
|
|
POLICY_CATEGORY_USER,
|
|
|
|
POLICY_CATEGORY_GROUP
|
|
|
|
} policy_category = POLICY_CATEGORY_NONE;
|
|
|
|
|
|
|
|
unsigned line = 0;
|
|
|
|
|
|
|
|
assert(p);
|
|
|
|
|
|
|
|
r = read_full_file(path, &c, NULL);
|
|
|
|
if (r < 0) {
|
|
|
|
if (r == -ENOENT)
|
|
|
|
return 0;
|
2014-06-10 15:46:32 +02:00
|
|
|
if (r == -EISDIR)
|
|
|
|
return r;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-11-28 18:23:20 +01:00
|
|
|
return log_error_errno(r, "Failed to load %s: %m", path);
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
q = c;
|
|
|
|
for (;;) {
|
|
|
|
_cleanup_free_ char *name = NULL;
|
|
|
|
int t;
|
|
|
|
|
|
|
|
t = xml_tokenize(&q, &name, &xml_state, &line);
|
2014-11-28 18:23:20 +01:00
|
|
|
if (t < 0)
|
|
|
|
return log_error_errno(t, "XML parse failure in %s: %m", path);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
|
|
|
|
case STATE_OUTSIDE:
|
|
|
|
|
|
|
|
if (t == XML_TAG_OPEN) {
|
|
|
|
if (streq(name, "busconfig"))
|
|
|
|
state = STATE_BUSCONFIG;
|
|
|
|
else {
|
|
|
|
log_error("Unexpected tag %s at %s:%u.", name, path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (t == XML_END)
|
|
|
|
return 0;
|
|
|
|
else if (t != XML_TEXT || !in_charset(name, WHITESPACE)) {
|
|
|
|
log_error("Unexpected token (1) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_BUSCONFIG:
|
|
|
|
|
|
|
|
if (t == XML_TAG_OPEN) {
|
|
|
|
if (streq(name, "policy")) {
|
|
|
|
state = STATE_POLICY;
|
|
|
|
policy_category = POLICY_CATEGORY_NONE;
|
|
|
|
free(policy_user);
|
|
|
|
free(policy_group);
|
|
|
|
policy_user = policy_group = NULL;
|
|
|
|
} else {
|
|
|
|
state = STATE_OTHER;
|
|
|
|
n_other = 0;
|
|
|
|
}
|
|
|
|
} else if (t == XML_TAG_CLOSE_EMPTY ||
|
|
|
|
(t == XML_TAG_CLOSE && streq(name, "busconfig")))
|
|
|
|
state = STATE_OUTSIDE;
|
|
|
|
else if (t != XML_TEXT || !in_charset(name, WHITESPACE)) {
|
|
|
|
log_error("Unexpected token (2) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_POLICY:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_NAME) {
|
|
|
|
if (streq(name, "context"))
|
|
|
|
state = STATE_POLICY_CONTEXT;
|
2015-01-11 17:23:24 +01:00
|
|
|
else if (streq(name, "at_console"))
|
|
|
|
state = STATE_POLICY_CONSOLE;
|
2014-06-06 19:41:24 +02:00
|
|
|
else if (streq(name, "user"))
|
|
|
|
state = STATE_POLICY_USER;
|
|
|
|
else if (streq(name, "group"))
|
|
|
|
state = STATE_POLICY_GROUP;
|
|
|
|
else {
|
2015-01-11 17:23:24 +01:00
|
|
|
log_warning("Attribute %s of <policy> tag unknown at %s:%u, ignoring.", name, path, line);
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_POLICY_OTHER_ATTRIBUTE;
|
|
|
|
}
|
|
|
|
} else if (t == XML_TAG_CLOSE_EMPTY ||
|
|
|
|
(t == XML_TAG_CLOSE && streq(name, "policy")))
|
|
|
|
state = STATE_BUSCONFIG;
|
|
|
|
else if (t == XML_TAG_OPEN) {
|
|
|
|
PolicyItemType it;
|
|
|
|
|
|
|
|
if (streq(name, "allow"))
|
|
|
|
it = POLICY_ITEM_ALLOW;
|
|
|
|
else if (streq(name, "deny"))
|
|
|
|
it = POLICY_ITEM_DENY;
|
|
|
|
else {
|
|
|
|
log_warning("Unknown tag %s in <policy> %s:%u.", name, path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(!i);
|
|
|
|
i = new0(PolicyItem, 1);
|
|
|
|
if (!i)
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
i->type = it;
|
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
|
|
|
|
} else if (t != XML_TEXT || !in_charset(name, WHITESPACE)) {
|
|
|
|
log_error("Unexpected token (3) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_POLICY_CONTEXT:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
if (streq(name, "default")) {
|
|
|
|
policy_category = POLICY_CATEGORY_DEFAULT;
|
|
|
|
state = STATE_POLICY;
|
|
|
|
} else if (streq(name, "mandatory")) {
|
|
|
|
policy_category = POLICY_CATEGORY_MANDATORY;
|
|
|
|
state = STATE_POLICY;
|
|
|
|
} else {
|
|
|
|
log_error("context= parameter %s unknown for <policy> at %s:%u.", name, path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (4) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2015-01-11 17:23:24 +01:00
|
|
|
case STATE_POLICY_CONSOLE:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
if (streq(name, "true")) {
|
|
|
|
policy_category = POLICY_CATEGORY_ON_CONSOLE;
|
|
|
|
state = STATE_POLICY;
|
|
|
|
} else if (streq(name, "false")) {
|
|
|
|
policy_category = POLICY_CATEGORY_NO_CONSOLE;
|
|
|
|
state = STATE_POLICY;
|
|
|
|
} else {
|
|
|
|
log_error("at_console= parameter %s unknown for <policy> at %s:%u.", name, path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (4.1) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
case STATE_POLICY_USER:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
free(policy_user);
|
|
|
|
policy_user = name;
|
|
|
|
name = NULL;
|
2014-06-06 19:52:50 +02:00
|
|
|
policy_category = POLICY_CATEGORY_USER;
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_POLICY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (5) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_POLICY_GROUP:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
free(policy_group);
|
|
|
|
policy_group = name;
|
|
|
|
name = NULL;
|
2014-06-06 19:52:50 +02:00
|
|
|
policy_category = POLICY_CATEGORY_GROUP;
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_POLICY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (6) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_POLICY_OTHER_ATTRIBUTE:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE)
|
|
|
|
state = STATE_POLICY;
|
|
|
|
else {
|
|
|
|
log_error("Unexpected token (7) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY:
|
|
|
|
|
|
|
|
assert(i);
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_NAME) {
|
|
|
|
PolicyItemClass ic;
|
|
|
|
|
|
|
|
if (startswith(name, "send_"))
|
|
|
|
ic = POLICY_ITEM_SEND;
|
|
|
|
else if (startswith(name, "receive_"))
|
|
|
|
ic = POLICY_ITEM_RECV;
|
|
|
|
else if (streq(name, "own"))
|
|
|
|
ic = POLICY_ITEM_OWN;
|
|
|
|
else if (streq(name, "own_prefix"))
|
|
|
|
ic = POLICY_ITEM_OWN_PREFIX;
|
|
|
|
else if (streq(name, "user"))
|
|
|
|
ic = POLICY_ITEM_USER;
|
|
|
|
else if (streq(name, "group"))
|
|
|
|
ic = POLICY_ITEM_GROUP;
|
2015-06-25 13:13:17 +02:00
|
|
|
else if (STR_IN_SET(name, "eavesdrop", "log")) {
|
2014-06-16 16:03:30 +02:00
|
|
|
log_debug("Unsupported attribute %s= at %s:%u, ignoring.", name, path, line);
|
|
|
|
state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
|
2015-01-09 18:46:08 +01:00
|
|
|
break;
|
2014-06-16 16:03:30 +02:00
|
|
|
} else {
|
2014-06-06 19:41:24 +02:00
|
|
|
log_error("Unknown attribute %s= at %s:%u, ignoring.", name, path, line);
|
|
|
|
state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i->class != _POLICY_ITEM_CLASS_UNSET && ic != i->class) {
|
2015-01-09 18:34:46 +01:00
|
|
|
log_error("send_, receive_/eavesdrop fields mixed on same tag at %s:%u.", path, line);
|
2014-06-06 19:41:24 +02:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
i->class = ic;
|
|
|
|
|
|
|
|
if (ic == POLICY_ITEM_SEND || ic == POLICY_ITEM_RECV) {
|
|
|
|
const char *u;
|
|
|
|
|
|
|
|
u = strchr(name, '_');
|
|
|
|
assert(u);
|
|
|
|
|
|
|
|
u++;
|
|
|
|
|
|
|
|
if (streq(u, "interface"))
|
|
|
|
state = STATE_ALLOW_DENY_INTERFACE;
|
|
|
|
else if (streq(u, "member"))
|
|
|
|
state = STATE_ALLOW_DENY_MEMBER;
|
|
|
|
else if (streq(u, "error"))
|
|
|
|
state = STATE_ALLOW_DENY_ERROR;
|
|
|
|
else if (streq(u, "path"))
|
|
|
|
state = STATE_ALLOW_DENY_PATH;
|
|
|
|
else if (streq(u, "type"))
|
|
|
|
state = STATE_ALLOW_DENY_MESSAGE_TYPE;
|
|
|
|
else if ((streq(u, "destination") && ic == POLICY_ITEM_SEND) ||
|
|
|
|
(streq(u, "sender") && ic == POLICY_ITEM_RECV))
|
|
|
|
state = STATE_ALLOW_DENY_NAME;
|
|
|
|
else {
|
2014-06-16 16:03:30 +02:00
|
|
|
if (streq(u, "requested_reply"))
|
|
|
|
log_debug("Unsupported attribute %s= at %s:%u, ignoring.", name, path, line);
|
|
|
|
else
|
|
|
|
log_error("Unknown attribute %s= at %s:%u, ignoring.", name, path, line);
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY_OTHER_ATTRIBUTE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
state = STATE_ALLOW_DENY_NAME;
|
|
|
|
|
|
|
|
} else if (t == XML_TAG_CLOSE_EMPTY ||
|
|
|
|
(t == XML_TAG_CLOSE && streq(name, i->type == POLICY_ITEM_ALLOW ? "allow" : "deny"))) {
|
|
|
|
|
2015-01-09 18:46:08 +01:00
|
|
|
/* 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;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
if (policy_category == POLICY_CATEGORY_DEFAULT)
|
2014-09-19 22:05:01 +02:00
|
|
|
item_append(i, &p->default_items);
|
2014-06-06 19:41:24 +02:00
|
|
|
else if (policy_category == POLICY_CATEGORY_MANDATORY)
|
2014-09-19 22:05:01 +02:00
|
|
|
item_append(i, &p->mandatory_items);
|
2015-01-11 17:23:24 +01:00
|
|
|
else if (policy_category == POLICY_CATEGORY_ON_CONSOLE)
|
|
|
|
item_append(i, &p->on_console_items);
|
|
|
|
else if (policy_category == POLICY_CATEGORY_NO_CONSOLE)
|
|
|
|
item_append(i, &p->no_console_items);
|
2014-06-06 19:41:24 +02:00
|
|
|
else if (policy_category == POLICY_CATEGORY_USER) {
|
2014-06-10 17:56:17 +02:00
|
|
|
const char *u = policy_user;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
|
|
|
|
|
2014-08-13 01:00:18 +02:00
|
|
|
r = hashmap_ensure_allocated(&p->user_items, NULL);
|
2014-06-06 19:41:24 +02:00
|
|
|
if (r < 0)
|
|
|
|
return log_oom();
|
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
if (!u) {
|
|
|
|
log_error("User policy without name");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
r = get_user_creds(&u, &i->uid, NULL, NULL, NULL);
|
2014-06-06 19:41:24 +02:00
|
|
|
if (r < 0) {
|
2014-11-28 13:19:16 +01:00
|
|
|
log_error_errno(r, "Failed to resolve user %s, ignoring policy: %m", u);
|
2014-06-10 17:56:17 +02:00
|
|
|
free(i);
|
|
|
|
} else {
|
|
|
|
PolicyItem *first;
|
|
|
|
|
2015-11-17 00:00:32 +01:00
|
|
|
first = hashmap_get(p->user_items, UID_TO_PTR(i->uid));
|
2014-09-19 22:05:01 +02:00
|
|
|
item_append(i, &first);
|
2014-09-20 16:34:31 +02:00
|
|
|
i->uid_valid = true;
|
2014-06-10 17:56:17 +02:00
|
|
|
|
2015-11-17 00:00:32 +01:00
|
|
|
r = hashmap_replace(p->user_items, UID_TO_PTR(i->uid), first);
|
2014-06-10 17:56:17 +02:00
|
|
|
if (r < 0) {
|
|
|
|
LIST_REMOVE(items, first, i);
|
|
|
|
return log_oom();
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
2014-06-10 17:56:17 +02:00
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
} else if (policy_category == POLICY_CATEGORY_GROUP) {
|
2014-06-10 17:56:17 +02:00
|
|
|
const char *g = policy_group;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
|
|
|
|
2014-08-13 01:00:18 +02:00
|
|
|
r = hashmap_ensure_allocated(&p->group_items, NULL);
|
2014-06-06 19:41:24 +02:00
|
|
|
if (r < 0)
|
|
|
|
return log_oom();
|
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
if (!g) {
|
|
|
|
log_error("Group policy without name");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
r = get_group_creds(&g, &i->gid);
|
2014-06-06 19:41:24 +02:00
|
|
|
if (r < 0) {
|
2014-11-28 13:19:16 +01:00
|
|
|
log_error_errno(r, "Failed to resolve group %s, ignoring policy: %m", g);
|
2014-06-10 17:56:17 +02:00
|
|
|
free(i);
|
|
|
|
} else {
|
|
|
|
PolicyItem *first;
|
|
|
|
|
2015-11-17 00:00:32 +01:00
|
|
|
first = hashmap_get(p->group_items, GID_TO_PTR(i->gid));
|
2014-09-19 22:05:01 +02:00
|
|
|
item_append(i, &first);
|
2014-09-20 16:34:31 +02:00
|
|
|
i->gid_valid = true;
|
2014-06-10 17:56:17 +02:00
|
|
|
|
2015-11-17 00:00:32 +01:00
|
|
|
r = hashmap_replace(p->group_items, GID_TO_PTR(i->gid), first);
|
2014-06-10 17:56:17 +02:00
|
|
|
if (r < 0) {
|
|
|
|
LIST_REMOVE(items, first, i);
|
|
|
|
return log_oom();
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
state = STATE_POLICY;
|
|
|
|
i = NULL;
|
|
|
|
|
|
|
|
} else if (t != XML_TEXT || !in_charset(name, WHITESPACE)) {
|
|
|
|
log_error("Unexpected token (8) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_INTERFACE:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
if (i->interface) {
|
|
|
|
log_error("Duplicate interface at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-01-09 19:28:18 +01:00
|
|
|
if (!streq(name, "*")) {
|
|
|
|
i->interface = name;
|
|
|
|
name = NULL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (9) at %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_MEMBER:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
if (i->member) {
|
|
|
|
log_error("Duplicate member in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-01-09 19:28:18 +01:00
|
|
|
if (!streq(name, "*")) {
|
|
|
|
i->member = name;
|
|
|
|
name = NULL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (10) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_ERROR:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
if (i->error) {
|
|
|
|
log_error("Duplicate error in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-01-09 19:28:18 +01:00
|
|
|
if (!streq(name, "*")) {
|
|
|
|
i->error = name;
|
|
|
|
name = NULL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (11) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_PATH:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
if (i->path) {
|
|
|
|
log_error("Duplicate path in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-01-09 19:28:18 +01:00
|
|
|
if (!streq(name, "*")) {
|
|
|
|
i->path = name;
|
|
|
|
name = NULL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (12) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_MESSAGE_TYPE:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
|
|
|
|
if (i->message_type != 0) {
|
|
|
|
log_error("Duplicate message type in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-01-09 19:28:18 +01:00
|
|
|
if (!streq(name, "*")) {
|
|
|
|
r = bus_message_type_from_string(name, &i->message_type);
|
|
|
|
if (r < 0) {
|
|
|
|
log_error("Invalid message type in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (13) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_NAME:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE) {
|
|
|
|
assert(i);
|
|
|
|
if (i->name) {
|
|
|
|
log_error("Duplicate name in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2014-09-20 04:34:30 +02:00
|
|
|
switch (i->class) {
|
|
|
|
case POLICY_ITEM_USER:
|
|
|
|
if (!streq(name, "*")) {
|
|
|
|
const char *u = name;
|
|
|
|
|
|
|
|
r = get_user_creds(&u, &i->uid, NULL, NULL, NULL);
|
|
|
|
if (r < 0)
|
2014-11-28 13:19:16 +01:00
|
|
|
log_error_errno(r, "Failed to resolve user %s: %m", name);
|
2014-09-20 04:34:30 +02:00
|
|
|
else
|
|
|
|
i->uid_valid = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POLICY_ITEM_GROUP:
|
|
|
|
if (!streq(name, "*")) {
|
|
|
|
const char *g = name;
|
|
|
|
|
|
|
|
r = get_group_creds(&g, &i->gid);
|
|
|
|
if (r < 0)
|
2014-11-28 13:19:16 +01:00
|
|
|
log_error_errno(r, "Failed to resolve group %s: %m", name);
|
2014-09-20 04:34:30 +02:00
|
|
|
else
|
|
|
|
i->gid_valid = true;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-09 19:28:18 +01:00
|
|
|
|
|
|
|
case POLICY_ITEM_SEND:
|
|
|
|
case POLICY_ITEM_RECV:
|
|
|
|
|
2015-07-31 19:56:38 +02:00
|
|
|
if (streq(name, "*"))
|
|
|
|
name = mfree(name);
|
2015-01-09 19:28:18 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2014-09-20 04:34:30 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
i->name = name;
|
|
|
|
name = NULL;
|
2014-09-20 04:34:30 +02:00
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
} else {
|
|
|
|
log_error("Unexpected token (14) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_ALLOW_DENY_OTHER_ATTRIBUTE:
|
|
|
|
|
|
|
|
if (t == XML_ATTRIBUTE_VALUE)
|
|
|
|
state = STATE_ALLOW_DENY;
|
|
|
|
else {
|
|
|
|
log_error("Unexpected token (15) in %s:%u.", path, line);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_OTHER:
|
|
|
|
|
|
|
|
if (t == XML_TAG_OPEN)
|
|
|
|
n_other++;
|
|
|
|
else if (t == XML_TAG_CLOSE || t == XML_TAG_CLOSE_EMPTY) {
|
|
|
|
|
|
|
|
if (n_other == 0)
|
|
|
|
state = STATE_BUSCONFIG;
|
|
|
|
else
|
|
|
|
n_other--;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
enum {
|
2014-11-26 23:14:13 +01:00
|
|
|
DENY,
|
2014-09-19 14:38:52 +02:00
|
|
|
ALLOW,
|
|
|
|
DUNNO,
|
|
|
|
};
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
static const char *verdict_to_string(int v) {
|
|
|
|
switch (v) {
|
|
|
|
|
|
|
|
case DENY:
|
|
|
|
return "DENY";
|
|
|
|
case ALLOW:
|
|
|
|
return "ALLOW";
|
|
|
|
case DUNNO:
|
|
|
|
return "DUNNO";
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-24 17:02:08 +02:00
|
|
|
struct policy_check_filter {
|
2014-11-26 20:22:22 +01:00
|
|
|
PolicyItemClass class;
|
2014-11-26 23:14:13 +01:00
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
2014-09-24 17:02:08 +02:00
|
|
|
int message_type;
|
2014-10-09 13:26:53 +02:00
|
|
|
const char *name;
|
2014-09-24 17:02:08 +02:00
|
|
|
const char *interface;
|
|
|
|
const char *path;
|
2014-10-09 13:26:53 +02:00
|
|
|
const char *member;
|
2014-09-24 17:02:08 +02:00
|
|
|
};
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
static int is_permissive(PolicyItem *i) {
|
|
|
|
|
2014-09-25 15:49:43 +02:00
|
|
|
assert(i);
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
return (i->type == POLICY_ITEM_ALLOW) ? ALLOW : DENY;
|
|
|
|
}
|
|
|
|
|
2014-09-24 17:02:08 +02:00
|
|
|
static int check_policy_item(PolicyItem *i, const struct policy_check_filter *filter) {
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2014-09-25 15:49:43 +02:00
|
|
|
assert(i);
|
|
|
|
assert(filter);
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
switch (i->class) {
|
|
|
|
case POLICY_ITEM_SEND:
|
|
|
|
case POLICY_ITEM_RECV:
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2014-10-09 13:26:53 +02:00
|
|
|
if (i->name && !streq_ptr(i->name, filter->name))
|
|
|
|
break;
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2014-11-26 21:15:39 +01:00
|
|
|
if ((i->message_type != 0) && (i->message_type != filter->message_type))
|
2014-09-24 17:02:08 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (i->path && !streq_ptr(i->path, filter->path))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i->member && !streq_ptr(i->member, filter->member))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i->interface && !streq_ptr(i->interface, filter->interface))
|
|
|
|
break;
|
|
|
|
|
|
|
|
return is_permissive(i);
|
2014-09-19 14:38:52 +02:00
|
|
|
|
|
|
|
case POLICY_ITEM_OWN:
|
2014-10-09 13:26:53 +02:00
|
|
|
assert(filter->name);
|
2014-09-25 15:49:43 +02:00
|
|
|
|
2014-10-07 17:58:29 +02:00
|
|
|
if (streq(i->name, "*") || streq(i->name, filter->name))
|
2014-09-19 14:38:52 +02:00
|
|
|
return is_permissive(i);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_ITEM_OWN_PREFIX:
|
2014-10-09 13:26:53 +02:00
|
|
|
assert(filter->name);
|
2014-09-25 15:49:43 +02:00
|
|
|
|
2014-11-26 20:22:22 +01:00
|
|
|
if (streq(i->name, "*") || service_name_startswith(filter->name, i->name))
|
2014-09-19 14:38:52 +02:00
|
|
|
return is_permissive(i);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_ITEM_USER:
|
2014-11-28 20:51:01 +01:00
|
|
|
if (filter->uid != UID_INVALID)
|
2014-11-26 23:14:13 +01:00
|
|
|
if ((streq_ptr(i->name, "*") || (i->uid_valid && i->uid == filter->uid)))
|
|
|
|
return is_permissive(i);
|
2014-09-19 14:38:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_ITEM_GROUP:
|
2014-11-28 20:51:01 +01:00
|
|
|
if (filter->gid != GID_INVALID)
|
2014-11-26 23:14:13 +01:00
|
|
|
if ((streq_ptr(i->name, "*") || (i->gid_valid && i->gid == filter->gid)))
|
|
|
|
return is_permissive(i);
|
2014-09-19 14:38:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_ITEM_IGNORE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DUNNO;
|
|
|
|
}
|
|
|
|
|
2014-09-24 17:02:08 +02:00
|
|
|
static int check_policy_items(PolicyItem *items, const struct policy_check_filter *filter) {
|
2014-09-19 14:38:52 +02:00
|
|
|
|
|
|
|
PolicyItem *i;
|
2014-11-26 23:14:13 +01:00
|
|
|
int verdict = DUNNO;
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2014-09-25 15:49:43 +02:00
|
|
|
assert(filter);
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
/* Check all policies in a set - a broader one might be followed by a more specific one,
|
|
|
|
* and the order of rules in policy definitions matters */
|
|
|
|
LIST_FOREACH(items, i, items) {
|
2014-11-26 23:14:13 +01:00
|
|
|
int v;
|
|
|
|
|
2014-11-26 20:22:22 +01:00
|
|
|
if (i->class != filter->class &&
|
2014-11-26 21:15:39 +01:00
|
|
|
!(i->class == POLICY_ITEM_OWN_PREFIX && filter->class == POLICY_ITEM_OWN))
|
2014-09-24 17:02:08 +02:00
|
|
|
continue;
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
v = check_policy_item(i, filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
2014-09-19 14:38:52 +02:00
|
|
|
}
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
return verdict;
|
2014-09-19 14:38:52 +02:00
|
|
|
}
|
|
|
|
|
2014-09-24 17:02:08 +02:00
|
|
|
static int policy_check(Policy *p, const struct policy_check_filter *filter) {
|
2014-09-19 14:38:52 +02:00
|
|
|
|
|
|
|
PolicyItem *items;
|
2014-11-26 23:14:13 +01:00
|
|
|
int verdict, v;
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2014-09-25 15:49:43 +02:00
|
|
|
assert(p);
|
|
|
|
assert(filter);
|
|
|
|
|
2014-11-26 21:15:39 +01:00
|
|
|
assert(IN_SET(filter->class, POLICY_ITEM_SEND, POLICY_ITEM_RECV, POLICY_ITEM_OWN, POLICY_ITEM_USER, POLICY_ITEM_GROUP));
|
|
|
|
|
2014-09-19 14:38:52 +02:00
|
|
|
/*
|
|
|
|
* The policy check is implemented by the following logic:
|
|
|
|
*
|
2014-11-26 23:14:13 +01:00
|
|
|
* 1. Check default items
|
|
|
|
* 2. Check group items
|
|
|
|
* 3. Check user items
|
2015-01-11 17:23:24 +01:00
|
|
|
* 4. Check on/no_console items
|
|
|
|
* 5. Check mandatory items
|
2014-11-26 23:14:13 +01:00
|
|
|
*
|
|
|
|
* Later rules override earlier rules.
|
2014-09-19 14:38:52 +02:00
|
|
|
*/
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
verdict = check_policy_items(p->default_items, filter);
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2014-11-28 20:51:01 +01:00
|
|
|
if (filter->gid != GID_INVALID) {
|
2015-11-17 00:00:32 +01:00
|
|
|
items = hashmap_get(p->group_items, GID_TO_PTR(filter->gid));
|
2014-09-19 14:38:52 +02:00
|
|
|
if (items) {
|
2014-11-26 23:14:13 +01:00
|
|
|
v = check_policy_items(items, filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
2014-09-19 14:38:52 +02:00
|
|
|
}
|
2014-11-26 23:14:13 +01:00
|
|
|
}
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2014-11-28 20:51:01 +01:00
|
|
|
if (filter->uid != UID_INVALID) {
|
2015-11-17 00:00:32 +01:00
|
|
|
items = hashmap_get(p->user_items, UID_TO_PTR(filter->uid));
|
2014-09-19 14:38:52 +02:00
|
|
|
if (items) {
|
2014-11-26 23:14:13 +01:00
|
|
|
v = check_policy_items(items, filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
2014-09-19 14:38:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-11 17:23:24 +01:00
|
|
|
if (filter->uid != UID_INVALID && sd_uid_get_seats(filter->uid, -1, NULL) > 0)
|
|
|
|
v = check_policy_items(p->on_console_items, filter);
|
|
|
|
else
|
|
|
|
v = check_policy_items(p->no_console_items, filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
v = check_policy_items(p->mandatory_items, filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
|
|
|
|
|
|
|
return verdict;
|
2014-09-24 17:02:08 +02:00
|
|
|
}
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
bool policy_check_own(Policy *p, uid_t uid, gid_t gid, const char *name) {
|
2014-09-24 17:02:08 +02:00
|
|
|
|
|
|
|
struct policy_check_filter filter = {
|
2014-10-07 17:58:29 +02:00
|
|
|
.class = POLICY_ITEM_OWN,
|
2014-11-26 23:14:13 +01:00
|
|
|
.uid = uid,
|
|
|
|
.gid = gid,
|
2014-10-07 17:58:29 +02:00
|
|
|
.name = name,
|
2014-09-24 17:02:08 +02:00
|
|
|
};
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
int verdict;
|
|
|
|
|
|
|
|
assert(p);
|
|
|
|
assert(name);
|
|
|
|
|
|
|
|
verdict = policy_check(p, &filter);
|
|
|
|
|
|
|
|
log_full(LOG_AUTH | (verdict != ALLOW ? LOG_WARNING : LOG_DEBUG),
|
|
|
|
"Ownership permission check for uid=" UID_FMT " gid=" GID_FMT" name=%s: %s",
|
|
|
|
uid, gid, strna(name), strna(verdict_to_string(verdict)));
|
|
|
|
|
|
|
|
return verdict == ALLOW;
|
2014-09-24 17:02:08 +02:00
|
|
|
}
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
bool policy_check_hello(Policy *p, uid_t uid, gid_t gid) {
|
2014-09-24 17:02:08 +02:00
|
|
|
|
|
|
|
struct policy_check_filter filter = {
|
2014-11-26 23:14:13 +01:00
|
|
|
.uid = uid,
|
|
|
|
.gid = gid,
|
2014-09-24 17:02:08 +02:00
|
|
|
};
|
2014-11-26 23:14:13 +01:00
|
|
|
int verdict;
|
|
|
|
|
|
|
|
assert(p);
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2014-10-07 17:58:29 +02:00
|
|
|
filter.class = POLICY_ITEM_USER;
|
2014-11-26 23:14:13 +01:00
|
|
|
verdict = policy_check(p, &filter);
|
|
|
|
|
|
|
|
if (verdict != DENY) {
|
|
|
|
int v;
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
filter.class = POLICY_ITEM_GROUP;
|
|
|
|
v = policy_check(p, &filter);
|
|
|
|
if (v != DUNNO)
|
|
|
|
verdict = v;
|
|
|
|
}
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
log_full(LOG_AUTH | (verdict != ALLOW ? LOG_WARNING : LOG_DEBUG),
|
|
|
|
"Hello permission check for uid=" UID_FMT " gid=" GID_FMT": %s",
|
|
|
|
uid, gid, strna(verdict_to_string(verdict)));
|
|
|
|
|
|
|
|
return verdict == ALLOW;
|
2014-09-24 17:02:08 +02:00
|
|
|
}
|
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
bool policy_check_one_recv(Policy *p,
|
|
|
|
uid_t uid,
|
|
|
|
gid_t gid,
|
|
|
|
int message_type,
|
|
|
|
const char *name,
|
|
|
|
const char *path,
|
|
|
|
const char *interface,
|
|
|
|
const char *member) {
|
2014-09-24 17:02:08 +02:00
|
|
|
|
|
|
|
struct policy_check_filter filter = {
|
|
|
|
.class = POLICY_ITEM_RECV,
|
2014-11-26 23:14:13 +01:00
|
|
|
.uid = uid,
|
|
|
|
.gid = gid,
|
2014-09-24 17:02:08 +02:00
|
|
|
.message_type = message_type,
|
2014-10-09 13:26:53 +02:00
|
|
|
.name = name,
|
2014-09-24 17:02:08 +02:00
|
|
|
.interface = interface,
|
|
|
|
.path = path,
|
|
|
|
.member = member,
|
|
|
|
};
|
|
|
|
|
2014-11-26 23:14:13 +01:00
|
|
|
assert(p);
|
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
return policy_check(p, &filter) == ALLOW;
|
2014-09-24 17:02:08 +02:00
|
|
|
}
|
2014-09-19 14:38:52 +02:00
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
bool policy_check_recv(Policy *p,
|
2014-11-26 23:14:13 +01:00
|
|
|
uid_t uid,
|
|
|
|
gid_t gid,
|
2014-09-24 17:02:08 +02:00
|
|
|
int message_type,
|
2015-01-17 21:18:52 +01:00
|
|
|
Set *names,
|
|
|
|
char **namesv,
|
2014-09-24 17:02:08 +02:00
|
|
|
const char *path,
|
|
|
|
const char *interface,
|
2015-01-11 15:27:18 +01:00
|
|
|
const char *member,
|
|
|
|
bool dbus_to_kernel) {
|
2014-09-24 17:02:08 +02:00
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
char *n, **nv, *last = NULL;
|
|
|
|
bool allow = false;
|
|
|
|
Iterator i;
|
|
|
|
|
|
|
|
assert(p);
|
|
|
|
|
|
|
|
if (set_isempty(names) && strv_isempty(namesv)) {
|
|
|
|
allow = policy_check_one_recv(p, uid, gid, message_type, NULL, path, interface, member);
|
|
|
|
} else {
|
|
|
|
SET_FOREACH(n, names, i) {
|
|
|
|
last = n;
|
|
|
|
allow = policy_check_one_recv(p, uid, gid, message_type, n, path, interface, member);
|
|
|
|
if (allow)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!allow) {
|
|
|
|
STRV_FOREACH(nv, namesv) {
|
|
|
|
last = *nv;
|
|
|
|
allow = policy_check_one_recv(p, uid, gid, message_type, *nv, path, interface, member);
|
|
|
|
if (allow)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log_full(LOG_AUTH | (!allow ? LOG_WARNING : LOG_DEBUG),
|
|
|
|
"Receive permission check %s for uid=" UID_FMT " gid=" GID_FMT" message=%s name=%s path=%s interface=%s member=%s: %s",
|
|
|
|
dbus_to_kernel ? "dbus-1 to kernel" : "kernel to dbus-1", uid, gid, bus_message_type_to_string(message_type), strna(last),
|
|
|
|
strna(path), strna(interface), strna(member), allow ? "ALLOW" : "DENY");
|
|
|
|
|
|
|
|
return allow;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool policy_check_one_send(Policy *p,
|
|
|
|
uid_t uid,
|
|
|
|
gid_t gid,
|
|
|
|
int message_type,
|
|
|
|
const char *name,
|
|
|
|
const char *path,
|
|
|
|
const char *interface,
|
|
|
|
const char *member) {
|
|
|
|
|
2014-09-24 17:02:08 +02:00
|
|
|
struct policy_check_filter filter = {
|
|
|
|
.class = POLICY_ITEM_SEND,
|
2014-11-26 23:14:13 +01:00
|
|
|
.uid = uid,
|
|
|
|
.gid = gid,
|
2014-09-24 17:02:08 +02:00
|
|
|
.message_type = message_type,
|
2014-10-09 13:26:53 +02:00
|
|
|
.name = name,
|
2014-09-24 17:02:08 +02:00
|
|
|
.interface = interface,
|
|
|
|
.path = path,
|
|
|
|
.member = member,
|
|
|
|
};
|
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
assert(p);
|
|
|
|
|
|
|
|
return policy_check(p, &filter) == ALLOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool policy_check_send(Policy *p,
|
|
|
|
uid_t uid,
|
|
|
|
gid_t gid,
|
|
|
|
int message_type,
|
|
|
|
Set *names,
|
|
|
|
char **namesv,
|
|
|
|
const char *path,
|
|
|
|
const char *interface,
|
|
|
|
const char *member,
|
|
|
|
bool dbus_to_kernel,
|
|
|
|
char **out_used_name) {
|
|
|
|
|
|
|
|
char *n, **nv, *last = NULL;
|
|
|
|
bool allow = false;
|
|
|
|
Iterator i;
|
2014-11-26 23:14:13 +01:00
|
|
|
|
|
|
|
assert(p);
|
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
if (set_isempty(names) && strv_isempty(namesv)) {
|
|
|
|
allow = policy_check_one_send(p, uid, gid, message_type, NULL, path, interface, member);
|
|
|
|
} else {
|
|
|
|
SET_FOREACH(n, names, i) {
|
|
|
|
last = n;
|
|
|
|
allow = policy_check_one_send(p, uid, gid, message_type, n, path, interface, member);
|
|
|
|
if (allow)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!allow) {
|
|
|
|
STRV_FOREACH(nv, namesv) {
|
|
|
|
last = *nv;
|
|
|
|
allow = policy_check_one_send(p, uid, gid, message_type, *nv, path, interface, member);
|
|
|
|
if (allow)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-26 23:14:13 +01:00
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
if (out_used_name)
|
|
|
|
*out_used_name = last;
|
|
|
|
|
|
|
|
log_full(LOG_AUTH | (!allow ? LOG_WARNING : LOG_DEBUG),
|
2015-01-11 15:27:18 +01:00
|
|
|
"Send permission check %s for uid=" UID_FMT " gid=" GID_FMT" message=%s name=%s path=%s interface=%s member=%s: %s",
|
2015-01-17 21:18:52 +01:00
|
|
|
dbus_to_kernel ? "dbus-1 to kernel" : "kernel to dbus-1", uid, gid, bus_message_type_to_string(message_type), strna(last),
|
|
|
|
strna(path), strna(interface), strna(member), allow ? "ALLOW" : "DENY");
|
2014-11-26 23:14:13 +01:00
|
|
|
|
2015-01-17 21:18:52 +01:00
|
|
|
return allow;
|
2014-09-19 14:38:52 +02:00
|
|
|
}
|
|
|
|
|
2014-06-10 15:46:32 +02:00
|
|
|
int policy_load(Policy *p, char **files) {
|
2014-06-06 19:41:24 +02:00
|
|
|
char **i;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
assert(p);
|
|
|
|
|
2014-06-10 15:46:32 +02:00
|
|
|
STRV_FOREACH(i, files) {
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-10 15:46:32 +02:00
|
|
|
r = file_load(p, *i);
|
|
|
|
if (r == -EISDIR) {
|
|
|
|
_cleanup_strv_free_ char **l = NULL;
|
|
|
|
char **j;
|
|
|
|
|
|
|
|
r = conf_files_list(&l, ".conf", NULL, *i, NULL);
|
2014-11-28 18:23:20 +01:00
|
|
|
if (r < 0)
|
|
|
|
return log_error_errno(r, "Failed to get configuration file list: %m");
|
2014-06-10 15:46:32 +02:00
|
|
|
|
|
|
|
STRV_FOREACH(j, l)
|
|
|
|
file_load(p, *j);
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-10 15:46:32 +02:00
|
|
|
/* We ignore all errors but EISDIR, and just proceed. */
|
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void policy_free(Policy *p) {
|
|
|
|
PolicyItem *i, *first;
|
|
|
|
|
|
|
|
if (!p)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while ((i = p->default_items)) {
|
|
|
|
LIST_REMOVE(items, p->default_items, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((i = p->mandatory_items)) {
|
|
|
|
LIST_REMOVE(items, p->mandatory_items, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
|
2015-01-11 17:23:24 +01:00
|
|
|
while ((i = p->on_console_items)) {
|
|
|
|
LIST_REMOVE(items, p->on_console_items, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((i = p->no_console_items)) {
|
|
|
|
LIST_REMOVE(items, p->no_console_items, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
while ((first = hashmap_steal_first(p->user_items))) {
|
|
|
|
|
|
|
|
while ((i = first)) {
|
|
|
|
LIST_REMOVE(items, first, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((first = hashmap_steal_first(p->group_items))) {
|
|
|
|
|
|
|
|
while ((i = first)) {
|
|
|
|
LIST_REMOVE(items, first, i);
|
|
|
|
policy_item_free(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hashmap_free(p->user_items);
|
|
|
|
hashmap_free(p->group_items);
|
|
|
|
|
|
|
|
p->user_items = p->group_items = NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
static void dump_items(PolicyItem *items, const char *prefix) {
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
PolicyItem *i;
|
|
|
|
|
|
|
|
if (!items)
|
2014-06-06 19:41:24 +02:00
|
|
|
return;
|
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
if (!prefix)
|
|
|
|
prefix = "";
|
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
LIST_FOREACH(items, i, items) {
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
printf("%sType: %s\n"
|
|
|
|
"%sClass: %s\n",
|
|
|
|
prefix, policy_item_type_to_string(i->type),
|
|
|
|
prefix, policy_item_class_to_string(i->class));
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->interface)
|
|
|
|
printf("%sInterface: %s\n",
|
|
|
|
prefix, i->interface);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->member)
|
|
|
|
printf("%sMember: %s\n",
|
|
|
|
prefix, i->member);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->error)
|
|
|
|
printf("%sError: %s\n",
|
|
|
|
prefix, i->error);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->path)
|
|
|
|
printf("%sPath: %s\n",
|
|
|
|
prefix, i->path);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->name)
|
|
|
|
printf("%sName: %s\n",
|
|
|
|
prefix, i->name);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->message_type != 0)
|
|
|
|
printf("%sMessage Type: %s\n",
|
|
|
|
prefix, bus_message_type_to_string(i->message_type));
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->uid_valid) {
|
|
|
|
_cleanup_free_ char *user;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
user = uid_to_name(i->uid);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2015-01-21 04:22:15 +01:00
|
|
|
printf("%sUser: %s ("UID_FMT")\n",
|
2014-09-20 18:09:00 +02:00
|
|
|
prefix, strna(user), i->uid);
|
2014-09-19 14:05:18 +02:00
|
|
|
}
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
if (i->gid_valid) {
|
|
|
|
_cleanup_free_ char *group;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-09-19 14:05:18 +02:00
|
|
|
group = gid_to_name(i->gid);
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2015-01-21 04:22:15 +01:00
|
|
|
printf("%sGroup: %s ("GID_FMT")\n",
|
2014-09-20 18:09:00 +02:00
|
|
|
prefix, strna(group), i->gid);
|
2014-09-19 14:05:18 +02:00
|
|
|
}
|
2014-11-26 23:14:13 +01:00
|
|
|
printf("%s-\n", prefix);
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dump_hashmap_items(Hashmap *h) {
|
|
|
|
PolicyItem *i;
|
|
|
|
Iterator j;
|
2014-06-06 19:52:50 +02:00
|
|
|
void *k;
|
2014-06-06 19:41:24 +02:00
|
|
|
|
|
|
|
HASHMAP_FOREACH_KEY(i, k, h, j) {
|
2015-11-17 00:00:32 +01:00
|
|
|
printf("\t%s Item for " UID_FMT ":\n", draw_special_char(DRAW_ARROW), PTR_TO_UID(k));
|
2014-06-10 17:56:17 +02:00
|
|
|
dump_items(i, "\t\t");
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-20 15:59:40 +02:00
|
|
|
void policy_dump(Policy *p) {
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-08 13:57:21 +02:00
|
|
|
printf("%s Default Items:\n", draw_special_char(DRAW_ARROW));
|
2014-06-10 17:56:17 +02:00
|
|
|
dump_items(p->default_items, "\t");
|
2014-06-06 19:41:24 +02:00
|
|
|
|
2014-06-08 13:57:21 +02:00
|
|
|
printf("%s Group Items:\n", draw_special_char(DRAW_ARROW));
|
2014-06-06 19:41:24 +02:00
|
|
|
dump_hashmap_items(p->group_items);
|
|
|
|
|
2014-06-08 13:57:21 +02:00
|
|
|
printf("%s User Items:\n", draw_special_char(DRAW_ARROW));
|
2014-06-06 19:41:24 +02:00
|
|
|
dump_hashmap_items(p->user_items);
|
2014-06-10 17:56:17 +02:00
|
|
|
|
2015-01-11 17:23:24 +01:00
|
|
|
printf("%s On-Console Items:\n", draw_special_char(DRAW_ARROW));
|
|
|
|
dump_items(p->on_console_items, "\t");
|
|
|
|
|
|
|
|
printf("%s No-Console Items:\n", draw_special_char(DRAW_ARROW));
|
|
|
|
dump_items(p->no_console_items, "\t");
|
|
|
|
|
2014-06-10 17:56:17 +02:00
|
|
|
printf("%s Mandatory Items:\n", draw_special_char(DRAW_ARROW));
|
|
|
|
dump_items(p->mandatory_items, "\t");
|
2015-01-09 19:30:01 +01:00
|
|
|
|
|
|
|
fflush(stdout);
|
2014-06-06 19:41:24 +02:00
|
|
|
}
|
|
|
|
|
2015-01-17 18:07:58 +01:00
|
|
|
int shared_policy_new(SharedPolicy **out) {
|
|
|
|
SharedPolicy *sp;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
sp = new0(SharedPolicy, 1);
|
|
|
|
if (!sp)
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
r = pthread_mutex_init(&sp->lock, NULL);
|
2015-10-17 16:23:45 +02:00
|
|
|
if (r != 0) {
|
|
|
|
r = log_error_errno(r, "Cannot initialize shared policy mutex: %m");
|
2015-01-17 18:07:58 +01:00
|
|
|
goto exit_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = pthread_rwlock_init(&sp->rwlock, NULL);
|
2015-10-17 16:23:45 +02:00
|
|
|
if (r != 0) {
|
|
|
|
r = log_error_errno(r, "Cannot initialize shared policy rwlock: %m");
|
2015-01-17 18:07:58 +01:00
|
|
|
goto exit_mutex;
|
|
|
|
}
|
|
|
|
|
|
|
|
*out = sp;
|
|
|
|
sp = NULL;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* pthread lock destruction is not fail-safe... meh! */
|
|
|
|
exit_mutex:
|
|
|
|
pthread_mutex_destroy(&sp->lock);
|
|
|
|
exit_free:
|
|
|
|
free(sp);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedPolicy *shared_policy_free(SharedPolicy *sp) {
|
|
|
|
if (!sp)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
policy_free(sp->policy);
|
|
|
|
pthread_rwlock_destroy(&sp->rwlock);
|
|
|
|
pthread_mutex_destroy(&sp->lock);
|
2015-01-17 19:06:34 +01:00
|
|
|
strv_free(sp->configuration);
|
2015-01-17 18:07:58 +01:00
|
|
|
free(sp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int shared_policy_reload_unlocked(SharedPolicy *sp, char **configuration) {
|
|
|
|
Policy old, buffer = {};
|
|
|
|
bool free_old;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
assert(sp);
|
|
|
|
|
|
|
|
r = policy_load(&buffer, configuration);
|
|
|
|
if (r < 0)
|
|
|
|
return log_error_errno(r, "Failed to load policy: %m");
|
|
|
|
|
2015-01-17 19:06:34 +01:00
|
|
|
log_debug("Reloading configuration");
|
2015-01-17 18:07:58 +01:00
|
|
|
/* policy_dump(&buffer); */
|
|
|
|
|
|
|
|
pthread_rwlock_wrlock(&sp->rwlock);
|
|
|
|
memcpy(&old, &sp->buffer, sizeof(old));
|
|
|
|
memcpy(&sp->buffer, &buffer, sizeof(buffer));
|
|
|
|
free_old = !!sp->policy;
|
|
|
|
sp->policy = &sp->buffer;
|
|
|
|
pthread_rwlock_unlock(&sp->rwlock);
|
|
|
|
|
|
|
|
if (free_old)
|
|
|
|
policy_free(&old);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-01-17 19:06:34 +01:00
|
|
|
int shared_policy_reload(SharedPolicy *sp) {
|
2015-01-17 18:07:58 +01:00
|
|
|
int r;
|
|
|
|
|
|
|
|
assert(sp);
|
|
|
|
|
|
|
|
pthread_mutex_lock(&sp->lock);
|
2015-01-17 19:06:34 +01:00
|
|
|
r = shared_policy_reload_unlocked(sp, sp->configuration);
|
2015-01-17 18:07:58 +01:00
|
|
|
pthread_mutex_unlock(&sp->lock);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
int shared_policy_preload(SharedPolicy *sp, char **configuration) {
|
2015-01-17 19:06:34 +01:00
|
|
|
_cleanup_strv_free_ char **conf = NULL;
|
|
|
|
int r = 0;
|
2015-01-17 18:07:58 +01:00
|
|
|
|
|
|
|
assert(sp);
|
|
|
|
|
2015-01-17 19:06:34 +01:00
|
|
|
conf = strv_copy(configuration);
|
|
|
|
if (!conf)
|
|
|
|
return log_oom();
|
|
|
|
|
2015-01-17 18:07:58 +01:00
|
|
|
pthread_mutex_lock(&sp->lock);
|
2015-01-17 19:06:34 +01:00
|
|
|
if (!sp->policy) {
|
|
|
|
r = shared_policy_reload_unlocked(sp, conf);
|
|
|
|
if (r >= 0) {
|
|
|
|
sp->configuration = conf;
|
|
|
|
conf = NULL;
|
|
|
|
}
|
|
|
|
}
|
2015-01-17 18:07:58 +01:00
|
|
|
pthread_mutex_unlock(&sp->lock);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
Policy *shared_policy_acquire(SharedPolicy *sp) {
|
|
|
|
assert(sp);
|
|
|
|
|
|
|
|
pthread_rwlock_rdlock(&sp->rwlock);
|
|
|
|
if (sp->policy)
|
|
|
|
return sp->policy;
|
|
|
|
pthread_rwlock_unlock(&sp->rwlock);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void shared_policy_release(SharedPolicy *sp, Policy *p) {
|
|
|
|
assert(sp);
|
|
|
|
assert(!p || sp->policy == p);
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
pthread_rwlock_unlock(&sp->rwlock);
|
|
|
|
}
|
|
|
|
|
2014-06-06 19:41:24 +02:00
|
|
|
static const char* const policy_item_type_table[_POLICY_ITEM_TYPE_MAX] = {
|
|
|
|
[_POLICY_ITEM_TYPE_UNSET] = "unset",
|
|
|
|
[POLICY_ITEM_ALLOW] = "allow",
|
|
|
|
[POLICY_ITEM_DENY] = "deny",
|
|
|
|
};
|
|
|
|
DEFINE_STRING_TABLE_LOOKUP(policy_item_type, PolicyItemType);
|
|
|
|
|
|
|
|
static const char* const policy_item_class_table[_POLICY_ITEM_CLASS_MAX] = {
|
|
|
|
[_POLICY_ITEM_CLASS_UNSET] = "unset",
|
|
|
|
[POLICY_ITEM_SEND] = "send",
|
|
|
|
[POLICY_ITEM_RECV] = "recv",
|
|
|
|
[POLICY_ITEM_OWN] = "own",
|
|
|
|
[POLICY_ITEM_OWN_PREFIX] = "own-prefix",
|
|
|
|
[POLICY_ITEM_USER] = "user",
|
|
|
|
[POLICY_ITEM_GROUP] = "group",
|
2014-07-10 04:29:24 +02:00
|
|
|
[POLICY_ITEM_IGNORE] = "ignore",
|
2014-06-06 19:41:24 +02:00
|
|
|
};
|
|
|
|
DEFINE_STRING_TABLE_LOOKUP(policy_item_class, PolicyItemClass);
|