summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-30 16:08:11 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-30 16:08:11 +0100
commit3310dfd5bdba0e8218eca1eb6c1fa719adc45bb1 (patch)
tree29b5d1320713808f4063622da9245923b8c54519 /src
parent49b832c5b810f4d8bb59249ff25472fd670503dc (diff)
bus: append unique and well known names to all messages unconditionally
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-dump.c5
-rw-r--r--src/libsystemd-bus/sd-bus.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/src/libsystemd-bus/bus-dump.c b/src/libsystemd-bus/bus-dump.c
index 849a3200df..469f7baaf5 100644
--- a/src/libsystemd-bus/bus-dump.c
+++ b/src/libsystemd-bus/bus-dump.c
@@ -395,9 +395,12 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f) {
fputs(*i, f);
}
- fputs("}\n", f);
+ fputc('}', f);
}
+ if (c->mask & SD_BUS_CREDS_UNIQUE_NAME || well_known)
+ fputc('\n', f);
+
dump_capabilities(c, f, "EffectiveCapabilities", sd_bus_creds_has_effective_cap);
dump_capabilities(c, f, "PermittedCapabilities", sd_bus_creds_has_permitted_cap);
dump_capabilities(c, f, "InheritableCapabilities", sd_bus_creds_has_inheritable_cap);
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 4bbeea92f3..e224be7056 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -181,6 +181,7 @@ _public_ int sd_bus_new(sd_bus **ret) {
r->n_ref = REFCNT_INIT;
r->input_fd = r->output_fd = -1;
r->message_version = 1;
+ r->creds_mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES|SD_BUS_CREDS_UNIQUE_NAME;
r->hello_flags |= KDBUS_HELLO_ACCEPT_FD;
r->attach_flags |= KDBUS_ATTACH_NAMES;
r->original_pid = getpid();
@@ -291,9 +292,9 @@ _public_ int sd_bus_negotiate_attach_creds(sd_bus *bus, uint64_t mask) {
assert_return(!bus_pid_changed(bus), -ECHILD);
/* The well knowns we need unconditionally, so that matches can work */
- mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES;
+ bus->creds_mask = mask | SD_BUS_CREDS_WELL_KNOWN_NAMES|SD_BUS_CREDS_UNIQUE_NAME;
- return kdbus_translate_attach_flags(mask, &bus->creds_mask);
+ return kdbus_translate_attach_flags(bus->creds_mask, &bus->creds_mask);
}
_public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
@@ -2805,7 +2806,7 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
c->uid = bus->ucred.uid;
c->gid = bus->ucred.gid;
- c->mask |= ((SD_BUS_CREDS_UID | SD_BUS_CREDS_PID | SD_BUS_CREDS_GID) & mask) & bus->creds_mask;
+ c->mask |= (SD_BUS_CREDS_UID | SD_BUS_CREDS_PID | SD_BUS_CREDS_GID) & mask;
}
if (!isempty(bus->label) && (mask & SD_BUS_CREDS_SELINUX_CONTEXT)) {
@@ -2815,7 +2816,7 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
return -ENOMEM;
}
- c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT | bus->creds_mask;
+ c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT;
}
r = bus_creds_add_more(c, mask, pid, 0);