diff options
author | Danielle Church <dani.church@gmail.com> | 2017-04-24 18:23:35 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-04-24 18:23:35 +0200 |
commit | 42d43f214e3f6029dea3ac08960516921549ab55 (patch) | |
tree | 92dbe6848d11422a828e4821d8c0ce0e49f0015a /src/core/load-fragment.c | |
parent | man: clarify udevadm monitor --tag-match/--filter-match (#5726) (diff) | |
download | systemd-42d43f214e3f6029dea3ac08960516921549ab55.tar.xz systemd-42d43f214e3f6029dea3ac08960516921549ab55.zip |
load-fragment: resolve specifiers in BindPaths/BindReadOnlyPaths (#5687)
Diffstat (limited to '')
-rw-r--r-- | src/core/load-fragment.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 5b7471c0d0..8cd79c3c9d 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3907,6 +3907,7 @@ int config_parse_bind_paths( void *userdata) { ExecContext *c = data; + Unit *u = userdata; const char *p; int r; @@ -3926,6 +3927,7 @@ int config_parse_bind_paths( p = rvalue; for (;;) { _cleanup_free_ char *source = NULL, *destination = NULL; + _cleanup_free_ char *sresolved = NULL, *dresolved = NULL; char *s = NULL, *d = NULL; bool rbind = true, ignore_enoent = false; @@ -3939,7 +3941,14 @@ int config_parse_bind_paths( return 0; } - s = source; + r = unit_full_printf(u, source, &sresolved); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to resolved specifiers in \"%s\", ignoring: %m", source); + return 0; + } + + s = sresolved; if (s[0] == '-') { ignore_enoent = true; s++; @@ -3970,16 +3979,23 @@ int config_parse_bind_paths( return 0; } - if (!utf8_is_valid(destination)) { - log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, destination); + r = unit_full_printf(u, destination, &dresolved); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to resolved specifiers in \"%s\", ignoring: %m", destination); + return 0; + } + + if (!utf8_is_valid(dresolved)) { + log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, dresolved); return 0; } - if (!path_is_absolute(destination)) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute destination path, ignoring: %s", destination); + if (!path_is_absolute(dresolved)) { + log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute destination path, ignoring: %s", dresolved); return 0; } - d = path_kill_slashes(destination); + d = path_kill_slashes(dresolved); /* Optionally, there's also a short option string specified */ if (p && p[-1] == ':') { |