]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus: expose SELinuxContext property (#3284)
authorJonathan Boulle <jonathanboulle@gmail.com>
Fri, 20 May 2016 13:09:14 +0000 (15:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 May 2016 13:09:14 +0000 (15:09 +0200)
Adds support to core for systemd D-Bus clients to send the
`SELinuxContext` property . This means `systemd-run -p
SELinuxContext=foo` should now work.

src/core/dbus-execute.c
src/shared/bus-unit-util.c

index 04fbc7ad15449931da7df5af12a40f6921ec0f1e..888319593c541af77e00d9735ab3f29d723b199d 100644 (file)
@@ -1446,6 +1446,23 @@ int bus_exec_context_set_transient_property(
 
                 return 1;
 
+        } else if (streq(name, "SELinuxContext")) {
+                const char *s;
+
+                r = sd_bus_message_read(message, "s", &s);
+                if (r < 0)
+                        return r;
+
+                if (mode != UNIT_CHECK) {
+                        r = free_and_strdup(&c->selinux_context, s);
+                        if (r < 0)
+                                return r;
+
+                        unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, strempty(s));
+                }
+
+                return 1;
+
         }
 
         ri = rlimit_from_string(name);
index 8f0df84793c217a67c76300c7d52d4f18cde9237..9431dad411ed47d1701040a13e5febaa80cc58ee 100644 (file)
@@ -235,7 +235,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
                               "StandardInput", "StandardOutput", "StandardError",
                               "Description", "Slice", "Type", "WorkingDirectory",
                               "RootDirectory", "SyslogIdentifier", "ProtectSystem",
-                              "ProtectHome"))
+                              "ProtectHome", "SELinuxContext"))
                 r = sd_bus_message_append(m, "v", "s", eq);
 
         else if (streq(field, "SyslogLevel")) {