diff options
author | 2016-05-20 15:09:14 +0200 | |
---|---|---|
committer | 2016-05-20 15:09:14 +0200 | |
commit | 186ad4b1a05b5c5d231a3b4b7faba8a5c40e3c9d (patch) | |
tree | 9fef694a323d14f7d1dd09652cdd2a0af48e4f08 | |
parent | basic: remove rm_rf_and_free, add rm_rf_physical_and_free, use rm_rf_physical... (diff) | |
download | systemd-186ad4b1a05b5c5d231a3b4b7faba8a5c40e3c9d.tar.gz systemd-186ad4b1a05b5c5d231a3b4b7faba8a5c40e3c9d.tar.bz2 systemd-186ad4b1a05b5c5d231a3b4b7faba8a5c40e3c9d.zip |
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.
-rw-r--r-- | src/core/dbus-execute.c | 17 | ||||
-rw-r--r-- | src/shared/bus-unit-util.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 04fbc7ad1..888319593 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); diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 8f0df8479..9431dad41 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -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")) { |