diff options
-rw-r--r-- | shell-completion/bash/systemd-run | 2 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-run | 2 | ||||
-rw-r--r-- | src/core/dbus-execute.c | 26 | ||||
-rw-r--r-- | src/journal/journald-server.c | 16 | ||||
-rw-r--r-- | src/shared/bus-util.c | 3 |
5 files changed, 40 insertions, 9 deletions
diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index dee47d9dbe..dfcb01231f 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -86,7 +86,7 @@ _systemd_run() { TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWriteDirectories= ReadOnlyDirectories= InaccessibleDirectories= EnvironmentFile= - ProtectSystem=' + ProtectSystem= ProtectHome=' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run index 3254d05135..d4fa39341c 100644 --- a/shell-completion/zsh/_systemd-run +++ b/shell-completion/zsh/_systemd-run @@ -39,7 +39,7 @@ _arguments \ TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= \ SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWriteDirectories= \ ReadOnlyDirectories= InaccessibleDirectories= EnvironmentFile= \ - ProtectSystem= \ + ProtectSystem= ProtectHome= \ ))' \ '--description=[Description for unit]:description' \ '--slice=[Run in the specified slice]:slices:__slices' \ diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index af352531a4..6f1e0dc6ac 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -1361,6 +1361,32 @@ int bus_exec_context_set_transient_property( return 1; + } else if (streq(name, "ProtectHome")) { + const char *s; + ProtectHome ph; + + r = sd_bus_message_read(message, "s", &s); + if (r < 0) + return r; + + r = parse_boolean(s); + if (r > 0) + ph = PROTECT_HOME_YES; + else if (r == 0) + ph = PROTECT_HOME_NO; + else { + ph = protect_home_from_string(s); + if (ph < 0) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Failed to parse protect home value"); + } + + if (mode != UNIT_CHECK) { + c->protect_home = ph; + 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; diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 012970bad3..7cefea323e 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -36,6 +36,7 @@ #include "acl-util.h" #include "cgroup-util.h" #include "conf-parser.h" +#include "extract-word.h" #include "fd-util.h" #include "formats-util.h" #include "hashmap.h" @@ -1289,8 +1290,7 @@ static int setup_signals(Server *s) { static int server_parse_proc_cmdline(Server *s) { _cleanup_free_ char *line = NULL; - const char *w, *state; - size_t l; + const char *p; int r; r = proc_cmdline(&line); @@ -1299,12 +1299,16 @@ static int server_parse_proc_cmdline(Server *s) { return 0; } - FOREACH_WORD_QUOTED(w, l, line, state) { + p = line; + for(;;) { _cleanup_free_ char *word; - word = strndup(w, l); - if (!word) - return -ENOMEM; + r = extract_first_word(&p, &word, NULL, 0); + if (r < 0) + return log_error_errno(r, "Failed to parse journald syntax \"%s\": %m", line); + + if (r == 0) + break; if (startswith(word, "systemd.journald.forward_to_syslog=")) { r = parse_boolean(word + 35); diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index fdb6fced02..604b8f248a 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1509,7 +1509,8 @@ 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", "ProtectSystem")) + "RootDirectory", "SyslogIdentifier", "ProtectSystem", + "ProtectHome")) r = sd_bus_message_append(m, "v", "s", eq); else if (streq(field, "SyslogLevel")) { |