From 38ce47e262fbb76b6f6514e8e80cacfc584bee5a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 27 Nov 2014 12:51:22 +0100 Subject: sd-bus: when we get the list of well-known names back from kdbus we shouldn't confuse the empty list with unknown information --- src/libsystemd/sd-bus/bus-control.c | 7 +++++++ src/libsystemd/sd-bus/bus-kernel.c | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 758715d74..e6e905c0e 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -692,6 +692,13 @@ static int bus_get_name_creds_kdbus( c->mask |= SD_BUS_CREDS_UNIQUE_NAME; } + /* If KDBUS_ITEM_OWNED_NAME is requested then we'll get 0 of + them in case the service has no names. This does not mean + however that the list of owned names could not be + acquired. Hence, let's explicitly clarify that the data is + complete. */ + c->mask |= mask & SD_BUS_CREDS_WELL_KNOWN_NAMES; + r = bus_populate_creds_from_items(bus, conn_info, mask, c); if (r < 0) goto fail; diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 3a3ed200a..3bf7b074e 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -717,6 +717,14 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { } } + /* If we requested the list of well-known names to be appended + * and the sender had none no item for it will be + * attached. However, this does *not* mean that we the kernel + * didn't want to provide this information to us. Hence, let's + * explicitly mark this information as available if it was + * requested. */ + m->creds.mask |= bus->creds_mask & SD_BUS_CREDS_WELL_KNOWN_NAMES; + r = bus_message_parse_fields(m); if (r < 0) goto fail; -- cgit v1.2.3