From: Yu Watanabe Date: Thu, 7 Mar 2019 06:12:10 +0000 (+0900) Subject: core: simplify and check validity of paths for RequiresMountsFor= X-Git-Tag: v242-rc1~180 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b459700b985e37b95879100b05fcd515e23b0650;p=thirdparty%2Fsystemd.git core: simplify and check validity of paths for RequiresMountsFor= Prompted by #11910. --- diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 17c2003c8fb..28ae6070a60 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)