diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-07 15:12:10 +0900 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-08 15:48:34 +0100 |
commit | b459700b985e37b95879100b05fcd515e23b0650 (patch) | |
tree | a7075d557b2a25c061d74e0443601832dcb1c749 /src/core/dbus-unit.c | |
parent | c5e6f734c6477d1347a42074b208b4ef71c3095a (diff) | |
download | systemd-b459700b985e37b95879100b05fcd515e23b0650.tar.gz |
core: simplify and check validity of paths for RequiresMountsFor=
Prompted by #11910.
Diffstat (limited to 'src/core/dbus-unit.c')
-rw-r--r-- | src/core/dbus-unit.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 17c2003c8f..28ae6070a6 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -1674,9 +1674,17 @@ static int bus_unit_set_transient_property( return r; STRV_FOREACH(p, l) { + path_simplify(*p, true); + if (!path_is_absolute(*p)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not absolute: %s", name, *p); + if (!path_is_valid(*p)) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s has invalid length: %s", name, *p); + + if (!path_is_normalized(*p)) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not normalized: %s", name, *p); + if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = unit_require_mounts_for(u, *p, UNIT_DEPENDENCY_FILE); if (r < 0) |