diff options
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.c | 10 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.h | 3 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 11 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index e3bdda83de..886e212fbf 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -563,6 +563,16 @@ _public_ int sd_bus_creds_get_well_known_names(sd_bus_creds *c, char ***well_kno return 0; } + if (c->well_known_names_local) { + static const char* const wkn[] = { + "org.freedesktop.DBus.Local", + NULL + }; + + *well_known_names = (char**) wkn; + return 0; + } + *well_known_names = c->well_known_names; return 0; } diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h index 9d6a5bfc9c..5267170ff5 100644 --- a/src/libsystemd/sd-bus/bus-creds.h +++ b/src/libsystemd/sd-bus/bus-creds.h @@ -72,7 +72,8 @@ struct sd_bus_creds { char *unique_name; char **well_known_names; - bool well_known_names_driver; + bool well_known_names_driver:1; + bool well_known_names_local:1; char *cgroup_root; diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index ea056d8119..8f97a582d7 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -2505,6 +2505,15 @@ 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; @@ -2573,7 +2582,7 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) { if (r < 0) return r; - m->sender = "org.freedesktop.DBus.Local"; + bus_message_set_sender_local(bus, m); r = bus_seal_synthetic_message(bus, m); if (r < 0) |