sd-bus: fix path of object-manager signals
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 21 Jul 2015 10:59:56 +0000 (12:59 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Mon, 27 Jul 2015 17:15:08 +0000 (19:15 +0200)
commit2d5c8a2756fec59d12aa0122359135653de1b8cb
tree2ed8af62b45babe14fe3ad53a62da820bb276d3c
parent931618d08c64083ff7b29c494f482c40a5b05608
sd-bus: fix path of object-manager signals

Each signal of the ObjectManager interface carries the path of the object
in question as an argument. Therefore, a caller will deduce the object
this signal is generated for, by parsing the _argument_. A caller will
*not* use the object-path of the message itself (i.e., message->path).
This is done on purpose, so the caller can rely on message->path to be
the path of the actual object-manager that generated this signal, instead
of the path of the object that triggered this signal.

This commit fixes all InterfacesAdded/Removed signals to use the path of
the closest object-manager as message->path. 'closest' in this case means
closest parent with at least one object-manager registered.

This fix raises the question what happens if we stack object-managers in
a hierarchy. Two implementations are possible: First, we report each
object only on the nearest object-manager. Second, we report it on each
parent object-manager. This patch chooses the former. This is compatible
with other existing ObjectManager implementations, which are required to
call GetManagedObjects() recursively on each object they find, which
implements the ObjectManager interface.
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-bus/test-bus-objects.c