summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-22 16:28:58 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-22 16:40:40 +0100
commitcccb0b2cdbd25e90ae92d2d5b107125cb1ca3433 (patch)
treef004ea3e54e6022bfd625b0cbdb4eb97a2a495c0 /src/libsystemd/sd-bus/bus-control.c
parentbus: when allocating a memfd for usage in a bus connection, name the memfd af... (diff)
downloadsystemd-cccb0b2cdbd25e90ae92d2d5b107125cb1ca3433.tar.xz
systemd-cccb0b2cdbd25e90ae92d2d5b107125cb1ca3433.zip
bus: include connection name in credentials structure
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index e7e9ba07b0..5548239426 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -379,9 +379,10 @@ static int bus_get_owner_kdbus(
cmd = alloca0(size);
strcpy(cmd->name, name);
}
- cmd->flags = KDBUS_ATTACH_NAMES;
cmd->size = size;
+ kdbus_translate_attach_flags(mask, (uint64_t*) &cmd->flags);
+
r = ioctl(bus->input_fd, KDBUS_CMD_CONN_INFO, cmd);
if (r < 0)
return -errno;
@@ -553,6 +554,18 @@ static int bus_get_owner_kdbus(
c->mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES;
}
break;
+
+ case KDBUS_ITEM_CONN_NAME:
+ if ((mask & SD_BUS_CREDS_CONNECTION_NAME)) {
+ c->conn_name = strdup(item->str);
+ if (!c->conn_name) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
+ c->mask |= SD_BUS_CREDS_CONNECTION_NAME;
+ }
+ break;
}
}