summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-11-28 16:09:16 +0100
committerFranck Bui <fbui@suse.com>2018-12-10 09:19:14 +0100
commit7f0704da9454d36d19920e033ddadf06c9c6441e (patch)
treeb4d53c893d63ca428d1f1e8c48f80dbba84ae6e3 /src/tmpfiles
parent36c97decbe46a62b6976b8ba7c59e8552f14f935 (diff)
downloadsystemd-7f0704da9454d36d19920e033ddadf06c9c6441e.tar.gz
tmpfiles: use CHASE_WARN in addition to CHASE_SAFE
and let's emit a more comprehensive warning when an unsafe transition is encountered. Before this patch: Unsafe symlinks encountered in /run/nrpe, refusing. After: Detected unsafe path transition / → /run during canonicalization of /run/nrpe.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 1f2caf5f73..d4e4f0c535 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -861,10 +861,8 @@ static int path_open_parent_safe(const char *path) {
if (!dn)
return log_oom();
- fd = chase_symlinks(dn, NULL, CHASE_OPEN|CHASE_SAFE, NULL);
- if (fd == -ENOLINK)
- return log_error_errno(fd, "Unsafe symlinks encountered in %s, refusing.", path);
- if (fd < 0)
+ fd = chase_symlinks(dn, NULL, CHASE_OPEN|CHASE_SAFE|CHASE_WARN, NULL);
+ if (fd < 0 && fd != -ENOLINK)
return log_error_errno(fd, "Failed to validate path %s: %m", path);
return fd;
@@ -884,10 +882,8 @@ static int path_open_safe(const char *path) {
"Failed to open invalid path '%s'.",
path);
- fd = chase_symlinks(path, NULL, CHASE_OPEN|CHASE_SAFE|CHASE_NOFOLLOW, NULL);
- if (fd == -ENOLINK)
- return log_error_errno(fd, "Unsafe symlinks encountered in %s, refusing.", path);
- if (fd < 0)
+ fd = chase_symlinks(path, NULL, CHASE_OPEN|CHASE_SAFE|CHASE_WARN|CHASE_NOFOLLOW, NULL);
+ if (fd < 0 && fd != -ENOLINK)
return log_error_errno(fd, "Failed to validate path %s: %m", path);
return fd;