summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c10
-rw-r--r--src/libsystemd/sd-bus/bus-message.c20
-rw-r--r--src/libsystemd/sd-bus/bus-message.h3
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c11
4 files changed, 23 insertions, 21 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 4dcea8ee71..7c946e61c2 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -379,15 +379,6 @@ fail:
return r;
}
-static 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;
-}
-
static void unset_memfds(struct sd_bus_message *m) {
struct bus_body_part *part;
unsigned i;
@@ -1274,7 +1265,6 @@ static int translate_reply(
if (r < 0)
return r;
- bus_message_set_sender_driver(bus, m);
message_set_timestamp(bus, m, ts);
r = bus_seal_synthetic_message(bus, m);
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;
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
index 4dd280dcf0..b4cdce7bf4 100644
--- a/src/libsystemd/sd-bus/bus-message.h
+++ b/src/libsystemd/sd-bus/bus-message.h
@@ -235,3 +235,6 @@ int bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_e
int bus_message_remarshal(sd_bus *bus, sd_bus_message **m);
int bus_message_append_sender(sd_bus_message *m, const char *sender);
+
+void bus_message_set_sender_driver(sd_bus *bus, sd_bus_message *m);
+void bus_message_set_sender_local(sd_bus *bus, sd_bus_message *m);
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index a8d03b8ac4..4b1c60edac 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -2140,8 +2140,6 @@ static int process_timeout(sd_bus *bus) {
if (r < 0)
return r;
- m->sender = "org.freedesktop.DBus";
-
r = bus_seal_synthetic_message(bus, m);
if (r < 0)
return r;
@@ -2544,15 +2542,6 @@ null_message:
return r;
}
-static 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;
-}
-
static int process_closing(sd_bus *bus, sd_bus_message **ret) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
struct reply_callback *c;