chiark / gitweb /
sd-bus: set creds info for "org.freedesktop.DBus.Local" generated messages, too
authorLennart Poettering <lennart@poettering.net>
Thu, 27 Nov 2014 11:52:13 +0000 (12:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 27 Nov 2014 21:05:23 +0000 (22:05 +0100)
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-creds.h
src/libsystemd/sd-bus/sd-bus.c

index e3bdda8..886e212 100644 (file)
@@ -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;
 }
index 9d6a5bf..5267170 100644 (file)
@@ -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;
 
index ea056d8..8f97a58 100644 (file)
@@ -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)