diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-11-11 16:53:52 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-11-19 11:07:31 +0100 |
commit | 28f0b34c57bc74737f498ca8de71178ca9ea65f1 (patch) | |
tree | a740d2d59840eaa2b317103a836433e2cb69c13e | |
parent | 8b888d236007b855568de362176113052185ada3 (diff) | |
download | systemd-28f0b34c57bc74737f498ca8de71178ca9ea65f1.tar.gz |
time-util: always accept UTC as valid timezone
We already handle it specially in get_timezones(), hence we should OK it
here too, even if the timezone file doesn't actually exist.
Prompted by:
https://serverfault.com/questions/991172/invalid-time-zone-utc
(Yes, Ubuntu should install the UTC timezone data unconditionally: it
should not be an option, even if all other timezone data is excluded,
but since it's our business to validate user input but not out business
to validate distros, let's just accept "UTC" unconditionally, it's magic
after all)
(cherry picked from commit e8b9e9c4705b4bc157ff460371387339977f233b)
-rw-r--r-- | src/basic/time-util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 3018e81acb..041bba4fdb 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -1279,6 +1279,10 @@ bool timezone_is_valid(const char *name, int log_level) { if (isempty(name)) return false; + /* Always accept "UTC" as valid timezone, since it's the fallback, even if user has no timezones installed. */ + if (streq(name, "UTC")) + return true; + if (name[0] == '/') return false; |