From 186ad4b1a05b5c5d231a3b4b7faba8a5c40e3c9d Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Fri, 20 May 2016 15:09:14 +0200 Subject: core/dbus: expose SELinuxContext property (#3284) 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/core') diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 04fbc7ad15..888319593c 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -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); -- cgit v1.2.3-54-g00ecf