diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2015-06-17 12:20:03 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2015-06-17 12:20:03 +0200 |
commit | 9d8a5fd3e62ee89073364a3f7fa95c50dc85d890 (patch) | |
tree | 5c2c60e3e0207b0d033bdf4f67873300006a1157 /src/libsystemd/sd-bus/test-bus-match.c | |
parent | 6e2ebc85ad5babb49e299d191f225742a7a0f63c (diff) | |
parent | cc65fe5e14770d0116e0f475c5dc2ef57113bc98 (diff) |
Merge pull request #244 from poettering/sdbus-suppress-local
sd-bus: suppress installing local bus matches server side
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-match.c')
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-match.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index 40c67046da..a1687b1c7b 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -77,6 +77,15 @@ static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char return r; } +static void test_match_scope(const char *match, enum bus_match_scope scope) { + struct bus_match_component *components = NULL; + unsigned n_components = 0; + + assert_se(bus_match_parse(match, &components, &n_components) >= 0); + assert_se(bus_match_get_scope(components, n_components) == scope); + bus_match_parse_free(components, n_components); +} + int main(int argc, char *argv[]) { struct bus_match_node root = { .type = BUS_MATCH_ROOT, @@ -142,5 +151,12 @@ int main(int argc, char *argv[]) { bus_match_free(&root); + test_match_scope("interface='foobar'", BUS_MATCH_GENERIC); + test_match_scope("", BUS_MATCH_GENERIC); + test_match_scope("interface='org.freedesktop.DBus.Local'", BUS_MATCH_LOCAL); + test_match_scope("sender='org.freedesktop.DBus.Local'", BUS_MATCH_LOCAL); + test_match_scope("member='gurke',path='/org/freedesktop/DBus/Local'", BUS_MATCH_LOCAL); + test_match_scope("arg2='piep',sender='org.freedesktop.DBus',member='waldo'", BUS_MATCH_DRIVER); + return 0; } |