[systemd-commits] 2 commits - src/libsystemd

David Herrmann dvdhrm at kemper.freedesktop.org
Fri Dec 12 05:03:46 PST 2014


 src/libsystemd/sd-bus/bus-kernel.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 19ee32dc4d337a033c95c7d3302666f2ea4340bd
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Fri Dec 12 14:02:57 2014 +0100

    bus: send attach flags on BUS_MAKE
    
    Make sure to set send-attach-flags on BUS_MAKE. These control which
    information is revealed about the bus-owner.

diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index d910d8e..cdca48d 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1510,6 +1510,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
         make = alloca0_align(offsetof(struct kdbus_cmd_make, items) +
                              ALIGN8(offsetof(struct kdbus_item, bloom_parameter) + sizeof(struct kdbus_bloom_parameter)) +
                              ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
+                             ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
                              ALIGN8(offsetof(struct kdbus_item, str) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1),
                              8);
 
@@ -1536,6 +1537,13 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
         n->data64[0] = _KDBUS_ATTACH_ANY;
         make->size += ALIGN8(n->size);
 
+        /* Provide all metadata via bus-owner queries */
+        n = KDBUS_ITEM_NEXT(n);
+        n->type = KDBUS_ITEM_ATTACH_FLAGS_SEND;
+        n->size = offsetof(struct kdbus_item, data64) + sizeof(uint64_t);
+        n->data64[0] = _KDBUS_ATTACH_ANY;
+        make->size += ALIGN8(n->size);
+
         /* Set the a good name */
         n = KDBUS_ITEM_NEXT(n);
         sprintf(n->str, UID_FMT "-%s", getuid(), name);

commit 18ee085c155dcd5f196f2ef9b712698dfd377f82
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Fri Dec 12 14:02:05 2014 +0100

    bus: fix assert() on HELLO error-path
    
    Make sure we don't call into any bus_kernel_*() functions before
    b->is_kernel is set to true. Hard-code the CMD_FREE just like the other
    helpers do.

diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 1122927..d910d8e 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -815,6 +815,10 @@ fail:
 }
 
 int bus_kernel_take_fd(sd_bus *b) {
+        struct kdbus_cmd_free cmd_free = {
+                .size = sizeof(cmd_free),
+                .flags = 0,
+        };
         struct kdbus_bloom_parameter *bloom = NULL;
         struct kdbus_cmd_hello *hello;
         struct kdbus_item_list *items;
@@ -982,7 +986,8 @@ int bus_kernel_take_fd(sd_bus *b) {
         return bus_start_running(b);
 
 fail:
-        (void) bus_kernel_cmd_free(b, hello->offset);
+        cmd_free.offset = hello->offset;
+        (void) ioctl(b->input_fd, KDBUS_CMD_FREE, &cmd_free);
         return r;
 }
 



More information about the systemd-commits mailing list