]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: can launch units with ProtectSystem
authorEvgeny Vereshchagin <evvers@ya.ru>
Sat, 24 Oct 2015 22:48:33 +0000 (22:48 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sat, 24 Oct 2015 22:48:33 +0000 (22:48 +0000)
src/core/dbus-execute.c
src/shared/bus-util.c

index b8da66c9858c753a30684f3087b43324faf8d63b..47531e2354b1e5b322038be26188bc20c495176c 100644 (file)
@@ -1334,6 +1334,32 @@ int bus_exec_context_set_transient_property(
 
                 return 1;
 
+        } else if (streq(name, "ProtectSystem")) {
+                const char *s;
+                ProtectSystem ps;
+
+                r = sd_bus_message_read(message, "s", &s);
+                if (r < 0)
+                        return r;
+
+                r = parse_boolean(s);
+                if (r > 0)
+                        ps = PROTECT_SYSTEM_YES;
+                else if (r == 0)
+                        ps = PROTECT_SYSTEM_NO;
+                else {
+                        ps = protect_system_from_string(s);
+                        if (ps < 0)
+                                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Failed to parse protect system value");
+                }
+
+                if (mode != UNIT_CHECK) {
+                        c->protect_system = ps;
+                        unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, s);
+                }
+
+                return 1;
+
         } else if (rlimit_from_string(name) >= 0) {
                 uint64_t rl;
                 rlim_t x;
index 9c4d6a2da0abf4726bf479b8fe4a4ae47fa7f059..a106b64fd9fcede97e857785656fdef409372387 100644 (file)
@@ -1507,7 +1507,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
                               "UtmpIdentifier", "UtmpMode", "PAMName", "TTYPath",
                               "StandardInput", "StandardOutput", "StandardError",
                               "Description", "Slice", "Type", "WorkingDirectory",
-                              "RootDirectory", "SyslogIdentifier"))
+                              "RootDirectory", "SyslogIdentifier", "ProtectSystem"))
                 r = sd_bus_message_append(m, "v", "s", eq);
 
         else if (streq(field, "SyslogLevel")) {