diff options
author | Alban Crequy <alban.crequy@collabora.co.uk> | 2012-03-04 14:56:02 +0000 |
---|---|---|
committer | Alban Crequy <alban.crequy@collabora.co.uk> | 2012-03-04 14:56:02 +0000 |
commit | 3c7c255ee7d5e478fa204a0f0848c98cc0e54a4f (patch) | |
tree | 961a25d4de8afd5cde846aa17a40db07752231e3 | |
parent | 5670dc6cf722ea552ea4e41f5742ec447f6cddf8 (diff) | |
download | dbus-3c7c255ee7d5e478fa204a0f0848c98cc0e54a4f.tar.gz |
policy: enforce policy on "allow own_prefix"
https://bugs.freedesktop.org/show_bug.cgi?id=46886
-rw-r--r-- | bus/policy.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bus/policy.c b/bus/policy.c index 34e84469..222b3c53 100644 --- a/bus/policy.c +++ b/bus/policy.c @@ -1267,12 +1267,25 @@ bus_client_policy_check_can_own (BusClientPolicy *policy, if (rule->type != BUS_POLICY_RULE_OWN) continue; - if (rule->d.own.service_name != NULL) + if (!rule->d.own.prefix && rule->d.own.service_name != NULL) { if (!_dbus_string_equal_c_str (service_name, rule->d.own.service_name)) continue; } + else if (rule->d.own.prefix) + { + const char *data; + char next_char; + if (!_dbus_string_starts_with_c_str (service_name, + rule->d.own.service_name)) + continue; + + data = _dbus_string_get_const_data (service_name); + next_char = data[strlen (rule->d.own.service_name)]; + if (next_char != '\0' && next_char != '.') + continue; + } /* Use this rule */ allowed = rule->allow; |