core: refuse StateDirectory=private

Follow-up for e886568873 (#9021).
This commit is contained in:
Yu Watanabe 2018-05-18 13:29:26 +09:00
parent a78388e1cb
commit 8994a11790

View file

@ -2139,8 +2139,14 @@ int bus_exec_context_set_transient_property(
return r;
STRV_FOREACH(p, l) {
if (!path_is_normalized(*p) || path_is_absolute(*p))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is not valid: %s", name, *p);
if (!path_is_normalized(*p))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is not normalized: %s", name, *p);
if (path_is_absolute(*p))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is absolute: %s", name, *p);
if (path_startswith(*p, "private"))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path can't be 'private': %s", name, *p);
}
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {