diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-11 15:42:23 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-12 10:22:51 +0200 |
commit | d94bab0805cd3007414ee6ff33e2a24d585f1217 (patch) | |
tree | 94747f932bd637b59c908a00e702491a976d382a /src | |
parent | systemctl: merge log_target(), log_level(), service_log_setting() (diff) | |
download | systemd-d94bab0805cd3007414ee6ff33e2a24d585f1217.tar.xz systemd-d94bab0805cd3007414ee6ff33e2a24d585f1217.zip |
systemctl: immediately reject invalid log levels
Symbolic names and number in the appropriate range are allowed
(log_level_from_string() DTRT already).
The target names are more messy, so we leave the verification to the service.
Diffstat (limited to 'src')
-rw-r--r-- | src/systemctl/systemctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 86de4848a5..4e31dc7889 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -81,6 +81,7 @@ #include "stat-util.h" #include "string-table.h" #include "strv.h" +#include "syslog-util.h" #include "sysv-compat.h" #include "terminal-util.h" #include "tmpfile-util.h" @@ -6307,6 +6308,12 @@ static int log_setting_internal(sd_bus *bus, const BusLocator* bloc, const char int r; if (value) { + if (level) { + if (log_level_from_string(value) < 0) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "\"%s\" is not a valid log level.", value); + } + r = bus_set_property(bus, bloc, level ? "LogLevel" : "LogTarget", &error, "s", value); |