summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-27 02:37:05 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-27 22:02:12 +0100
commitac653862e0a99505727dc8861e734d8d6f2b0afd (patch)
treed8183f49afbf9800cad1ef165c3b5fa979848303 /src/libsystemd/sd-bus/bus-kernel.c
parent50c4521675e94ade38b8af9e3b0f7fd2f300b6f4 (diff)
sd-bus: fake valid well-known-names metadata for faked bus messages
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 1276cd841a..9349c1d79d 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -737,9 +737,11 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
}
/* Override information from the user header with data from the kernel */
- if (k->src_id == KDBUS_SRC_ID_KERNEL)
+ if (k->src_id == KDBUS_SRC_ID_KERNEL) {
m->sender = m->creds.unique_name = (char*) "org.freedesktop.DBus";
- else {
+ m->creds.well_known_names_driver = true;
+ m->creds.mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES & bus->creds_mask;
+ } else {
snprintf(m->sender_buffer, sizeof(m->sender_buffer), ":1.%llu", (unsigned long long) k->src_id);
m->sender = m->creds.unique_name = m->sender_buffer;
}
@@ -1074,6 +1076,8 @@ static int push_name_owner_changed(sd_bus *bus, const char *name, const char *ol
return r;
m->sender = "org.freedesktop.DBus";
+ m->creds.well_known_names_driver = true;
+ m->creds.mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES & bus->creds_mask;
r = bus_seal_synthetic_message(bus, m);
if (r < 0)
@@ -1143,6 +1147,8 @@ static int translate_reply(sd_bus *bus, struct kdbus_msg *k, struct kdbus_item *
return r;
m->sender = "org.freedesktop.DBus";
+ m->creds.well_known_names_driver = true;
+ m->creds.mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES & bus->creds_mask;
r = bus_seal_synthetic_message(bus, m);
if (r < 0)