chiark / gitweb /
sd-bus: destination-matches cannot match NameOwnerChanged
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 16 Jul 2015 12:35:15 +0000 (14:35 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:06:20 +0000 (10:06 +0100)
Make sure we don't install NameOwnerChanged matches if the caller passed
a destination='' match (except if it is the broadcast address). Per spec,
all NameOwnerChanged signals are broadcasts.

Only the NameLost/NameAcquired signals are unicasts, but those are never
received through sd-bus. Instead, the bus-proxy synthesizes them and it
already installs proper matches for them.

src/libelogind/sd-bus/bus-control.c

index a38c5c5..526e1aa 100644 (file)
@@ -1345,6 +1345,10 @@ int bus_add_match_internal_kernel(
                         else if (r > 0)
                                 sz += ALIGN8(offsetof(struct kdbus_item, id) + sizeof(uint64_t));
 
                         else if (r > 0)
                                 sz += ALIGN8(offsetof(struct kdbus_item, id) + sizeof(uint64_t));
 
+                        /* if not a broadcast, it cannot be a name-change */
+                        if (r <= 0 || dst_id != KDBUS_DST_ID_BROADCAST)
+                                matches_name_change = false;
+
                         break;
                 }
 
                         break;
                 }