From 8994a11790dc9bf91cdd94f5f90db0c3faaa23bf Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 18 May 2018 13:29:26 +0900 Subject: [PATCH 1/3] core: refuse StateDirectory=private Follow-up for e8865688735ba3bd34297fa89cca6bde7ba33997 (#9021). --- src/core/dbus-execute.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 3b1c77e967..fe9701b33d 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -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)) { From e760d687dc8fa8fb36de4d0705d37a4cdb6da68e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 18 May 2018 17:34:59 +0900 Subject: [PATCH 2/3] core: fix coding style --- src/core/load-fragment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 72c6e10008..53fe7d4b8b 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -366,7 +366,7 @@ int config_parse_socket_listen(const char *unit, p->type = SOCKET_SOCKET; r = unit_full_printf(UNIT(s), rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r,"Failed to resolve unit specifiers on %s, ignoring: %m", rvalue); + log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", rvalue); return 0; } From 5e2d3a54969156dd96681ada279ec6d2f60b29f5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 18 May 2018 17:35:23 +0900 Subject: [PATCH 3/3] core: use free_and_replace() --- src/core/load-fragment.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 53fe7d4b8b..1b6a57cf99 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -812,8 +812,7 @@ int config_parse_socket_bindtodevice( } else n = NULL; - free(s->bind_to_device); - s->bind_to_device = n; + free_and_replace(s->bind_to_device, n); return 0; }