summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-07 20:25:30 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-07 20:25:30 +0100
commitd29ae2914e1146f45ff4104faafef5331837bed7 (patch)
treec089dd2d77869d4ca8c6aff2a0ea6f4e2865d9f3 /src/libsystemd/sd-bus/bus-message.c
parent76877fb9ccb7f9f921ea921cf692f4d2774d590c (diff)
sd-bus: unify how we set the sender of synthetic messages
Diffstat (limited to 'src/libsystemd/sd-bus/bus-message.c')
-rw-r--r--src/libsystemd/sd-bus/bus-message.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 0f9334bb84..f352c72981 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -754,6 +754,24 @@ _public_ int sd_bus_message_new_method_errnof(
return sd_bus_message_new_method_error(call, m, &berror);
}
+void bus_message_set_sender_local(sd_bus *bus, sd_bus_message *m) {
+ assert(bus);
+ assert(m);
+
+ m->sender = m->creds.unique_name = (char*) "org.freedesktop.DBus.Local";
+ m->creds.well_known_names_local = true;
+ m->creds.mask |= (SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_WELL_KNOWN_NAMES) & bus->creds_mask;
+}
+
+void bus_message_set_sender_driver(sd_bus *bus, sd_bus_message *m) {
+ assert(bus);
+ assert(m);
+
+ m->sender = m->creds.unique_name = (char*) "org.freedesktop.DBus";
+ m->creds.well_known_names_driver = true;
+ m->creds.mask |= (SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_WELL_KNOWN_NAMES) & bus->creds_mask;
+}
+
int bus_message_new_synthetic_error(
sd_bus *bus,
uint64_t cookie,
@@ -796,6 +814,8 @@ int bus_message_new_synthetic_error(
t->error._need_free = -1;
+ bus_message_set_sender_driver(bus, t);
+
*m = t;
return 0;