summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2019-01-16 12:30:22 +0100
committerAdrian Szyndela <adrian.s@samsung.com>2019-04-26 13:29:42 +0200
commit3486e0f48dfadf1b175e3796f0a65c0da231889b (patch)
treed0c41ed30f82de6ea2814e4ab08cb4125f26ad46 /bus
parent96991501954b0924bcd8712d3269c1f5188968bb (diff)
downloaddbus-3486e0f48dfadf1b175e3796f0a65c0da231889b.tar.gz
DBusString: extend with checking for starting with words
This extracts a few lines of code and adds it as a DBusString function that checks if a DBusString starts with words given with a C string and a word separator. In other words, it checks if: - a DBusString is a given C string, or - a DBusString starts with a given C string and the next character is a given word separator. It is used for matching names to prefixes when checking the policy. Signed-off-by: Adrian Szyndela <adrian.s@samsung.com> Change-Id: Ie39d33916863d950dde38d3b8b20c8a539217302
Diffstat (limited to 'bus')
-rw-r--r--bus/policy.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/bus/policy.c b/bus/policy.c
index c87bfecf..11d21bf0 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -1341,15 +1341,9 @@ bus_rules_check_can_own (DBusList *rules,
}
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 != '.')
+ if (!_dbus_string_starts_with_words_c_str (service_name,
+ rule->d.own.service_name,
+ '.'))
continue;
}