From: INSUN PYO Date: Thu, 17 Jan 2019 06:53:13 +0000 (+0900) Subject: systemctl: show SELinuxContext=, AppArmorProfile= and SmackProcessLabel= X-Git-Tag: v242-rc1~205 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7bb2fec78f6707c25cf202b6c80936623b11200;p=thirdparty%2Fsystemd.git systemctl: show SELinuxContext=, AppArmorProfile= and SmackProcessLabel= Run: systemctl show -a dbus.service | grep -E "SELinuxContext|AppArmorProfile|SmackProcessLabel" Before patch: SELinuxContext=[unprintable] AppArmorProfile=[unprintable] SmackProcessLabel=[unprintable] After patch: SELinuxContext=[""|"value of context"] AppArmorProfile=[""|"value of context"] SmackProcessLabel=[""|"value of context"] --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 57e3111b8d6..fc21d318ad2 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -4751,6 +4751,20 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m fputc('\n', stdout); } + return 1; + } else if (STR_IN_SET(name, "SELinuxContext", "AppArmorProfile", "SmackProcessLabel")) { + int ignore; + const char *s; + + r = sd_bus_message_read(m, "(bs)", &ignore, &s); + if (r < 0) + return bus_log_parse_error(r); + + if (!isempty(s)) + bus_print_property_value(name, expected_value, value, "%s%s", ignore ? "-" : "", s); + else if (all) + bus_print_property_value(name, expected_value, value, "%s", ""); + return 1; }