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/sd-bus.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/sd-bus.c')
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 2805b29839..0881b4779a 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -2952,22 +2952,35 @@ _public_ int sd_bus_add_match( s->match_callback.cookie = ++bus->match_cookie; if (bus->bus_client) { + enum bus_match_scope scope; - if (!bus->is_kernel) { - /* When this is not a kernel transport, we - * store the original match string, so that we - * can use it to remove the match again */ + scope = bus_match_get_scope(components, n_components); - s->match_callback.match_string = strdup(match); - if (!s->match_callback.match_string) { - r = -ENOMEM; - goto finish; + /* Do not install server-side matches for matches + * against the local service, interface or bus + * path. Also, when on kdbus don't install driver + * matches server side. */ + if (scope == BUS_MATCH_GENERIC || + (!bus->is_kernel && scope == BUS_MATCH_DRIVER)) { + + if (!bus->is_kernel) { + /* When this is not a kernel transport, we + * store the original match string, so that we + * can use it to remove the match again */ + + s->match_callback.match_string = strdup(match); + if (!s->match_callback.match_string) { + r = -ENOMEM; + goto finish; + } } - } - r = bus_add_match_internal(bus, s->match_callback.match_string, components, n_components, s->match_callback.cookie); - if (r < 0) - goto finish; + r = bus_add_match_internal(bus, s->match_callback.match_string, components, n_components, s->match_callback.cookie); + if (r < 0) + goto finish; + + s->match_added = true; + } } bus->match_callbacks_modified = true; |