c62b8e
From a221a65ad0563d1bfe8770e928b221efc6ba8c88 Mon Sep 17 00:00:00 2001
c62b8e
From: David Tardon <dtardon@redhat.com>
c62b8e
Date: Thu, 3 Jan 2019 13:09:43 +0100
c62b8e
Subject: [PATCH] backport chase_symlinks
c62b8e
c62b8e
Related: #1663143
c62b8e
---
c62b8e
 src/shared/util.c    | 233 +++++++++++++++++++++++++++++++++++++++++++
c62b8e
 src/shared/util.h    |   8 ++
c62b8e
 src/test/test-util.c | 208 ++++++++++++++++++++++++++++++++++++++
c62b8e
 3 files changed, 449 insertions(+)
c62b8e
c62b8e
diff --git a/src/shared/util.c b/src/shared/util.c
c62b8e
index 2838d50f6f..385551f2b3 100644
c62b8e
--- a/src/shared/util.c
c62b8e
+++ b/src/shared/util.c
c62b8e
@@ -9202,3 +9202,236 @@ int fd_is_fs_type(int fd, statfs_f_type_t magic_value) {
c62b8e
 
c62b8e
         return is_fs_type(&s, magic_value);
c62b8e
 }
c62b8e
+
c62b8e
+int chase_symlinks(const char *path, const char *original_root, unsigned flags, char **ret) {
c62b8e
+        _cleanup_free_ char *buffer = NULL, *done = NULL, *root = NULL;
c62b8e
+        _cleanup_close_ int fd = -1;
c62b8e
+        unsigned max_follow = 32; /* how many symlinks to follow before giving up and returning ELOOP */
c62b8e
+        bool exists = true;
c62b8e
+        char *todo;
c62b8e
+        int r;
c62b8e
+
c62b8e
+        assert(path);
c62b8e
+
c62b8e
+        /* This is a lot like canonicalize_file_name(), but takes an additional "root" parameter, that allows following
c62b8e
+         * symlinks relative to a root directory, instead of the root of the host.
c62b8e
+         *
c62b8e
+         * Note that "root" primarily matters if we encounter an absolute symlink. It is also used when following
c62b8e
+         * relative symlinks to ensure they cannot be used to "escape" the root directory. The path parameter passed is
c62b8e
+         * assumed to be already prefixed by it, except if the CHASE_PREFIX_ROOT flag is set, in which case it is first
c62b8e
+         * prefixed accordingly.
c62b8e
+         *
c62b8e
+         * Algorithmically this operates on two path buffers: "done" are the components of the path we already
c62b8e
+         * processed and resolved symlinks, "." and ".." of. "todo" are the components of the path we still need to
c62b8e
+         * process. On each iteration, we move one component from "todo" to "done", processing it's special meaning
c62b8e
+         * each time. The "todo" path always starts with at least one slash, the "done" path always ends in no
c62b8e
+         * slash. We always keep an O_PATH fd to the component we are currently processing, thus keeping lookup races
c62b8e
+         * at a minimum.
c62b8e
+         *
c62b8e
+         * Suggested usage: whenever you want to canonicalize a path, use this function. Pass the absolute path you got
c62b8e
+         * as-is: fully qualified and relative to your host's root. Optionally, specify the root parameter to tell this
c62b8e
+         * function what to do when encountering a symlink with an absolute path as directory: prefix it by the
c62b8e
+         * specified path. */
c62b8e
+
c62b8e
+        if (original_root) {
c62b8e
+                root = path_make_absolute_cwd(original_root);
c62b8e
+                if (root == NULL)
c62b8e
+                        return -ENOENT;
c62b8e
+
c62b8e
+                if (flags & CHASE_PREFIX_ROOT)
c62b8e
+                        path = prefix_roota(root, path);
c62b8e
+        }
c62b8e
+
c62b8e
+        buffer = path_make_absolute_cwd(path);
c62b8e
+        if (buffer == NULL)
c62b8e
+                return -ENOENT;
c62b8e
+
c62b8e
+        fd = open("/", O_CLOEXEC|O_NOFOLLOW|O_PATH);
c62b8e
+        if (fd < 0)
c62b8e
+                return -errno;
c62b8e
+
c62b8e
+        todo = buffer;
c62b8e
+        for (;;) {
c62b8e
+                _cleanup_free_ char *first = NULL;
c62b8e
+                _cleanup_close_ int child = -1;
c62b8e
+                struct stat st;
c62b8e
+                size_t n, m;
c62b8e
+
c62b8e
+                /* Determine length of first component in the path */
c62b8e
+                n = strspn(todo, "/");                  /* The slashes */
c62b8e
+                m = n + strcspn(todo + n, "/");         /* The entire length of the component */
c62b8e
+
c62b8e
+                /* Extract the first component. */
c62b8e
+                first = strndup(todo, m);
c62b8e
+                if (!first)
c62b8e
+                        return -ENOMEM;
c62b8e
+
c62b8e
+                todo += m;
c62b8e
+
c62b8e
+                /* Empty? Then we reached the end. */
c62b8e
+                if (isempty(first))
c62b8e
+                        break;
c62b8e
+
c62b8e
+                /* Just a single slash? Then we reached the end. */
c62b8e
+                if (path_equal(first, "/")) {
c62b8e
+                        /* Preserve the trailing slash */
c62b8e
+                        if (!strextend(&done, "/", NULL))
c62b8e
+                                return -ENOMEM;
c62b8e
+
c62b8e
+                        break;
c62b8e
+                }
c62b8e
+
c62b8e
+                /* Just a dot? Then let's eat this up. */
c62b8e
+                if (path_equal(first, "/."))
c62b8e
+                        continue;
c62b8e
+
c62b8e
+                /* Two dots? Then chop off the last bit of what we already found out. */
c62b8e
+                if (path_equal(first, "/..")) {
c62b8e
+                        _cleanup_free_ char *parent = NULL;
c62b8e
+                        int fd_parent = -1;
c62b8e
+
c62b8e
+                        /* If we already are at the top, then going up will not change anything. This is in-line with
c62b8e
+                         * how the kernel handles this. */
c62b8e
+                        if (isempty(done) || path_equal(done, "/"))
c62b8e
+                                continue;
c62b8e
+
c62b8e
+                        parent = dirname_malloc(done);
c62b8e
+                        if (!parent)
c62b8e
+                                return -ENOMEM;
c62b8e
+
c62b8e
+                        /* Don't allow this to leave the root dir.  */
c62b8e
+                        if (root &&
c62b8e
+                            path_startswith(done, root) &&
c62b8e
+                            !path_startswith(parent, root))
c62b8e
+                                continue;
c62b8e
+
c62b8e
+                        free(done);
c62b8e
+                        done = parent;
c62b8e
+                        parent = NULL;
c62b8e
+
c62b8e
+                        fd_parent = openat(fd, "..", O_CLOEXEC|O_NOFOLLOW|O_PATH);
c62b8e
+                        if (fd_parent < 0)
c62b8e
+                                return -errno;
c62b8e
+
c62b8e
+                        safe_close(fd);
c62b8e
+                        fd = fd_parent;
c62b8e
+
c62b8e
+                        continue;
c62b8e
+                }
c62b8e
+
c62b8e
+                /* Otherwise let's see what this is. */
c62b8e
+                child = openat(fd, first + n, O_CLOEXEC|O_NOFOLLOW|O_PATH);
c62b8e
+                if (child < 0) {
c62b8e
+
c62b8e
+                        if (errno == ENOENT &&
c62b8e
+                            (flags & CHASE_NONEXISTENT) &&
c62b8e
+                            (isempty(todo) || path_is_safe(todo))) {
c62b8e
+
c62b8e
+                                /* If CHASE_NONEXISTENT is set, and the path does not exist, then that's OK, return
c62b8e
+                                 * what we got so far. But don't allow this if the remaining path contains "../ or "./"
c62b8e
+                                 * or something else weird. */
c62b8e
+
c62b8e
+                                /* If done is "/", as first also contains slash at the head, then remove this redundant slash. */
c62b8e
+                                if (streq_ptr(done, "/"))
c62b8e
+                                        *done = '\0';
c62b8e
+
c62b8e
+                                if (!strextend(&done, first, todo, NULL))
c62b8e
+                                        return -ENOMEM;
c62b8e
+
c62b8e
+                                exists = false;
c62b8e
+                                break;
c62b8e
+                        }
c62b8e
+
c62b8e
+                        return -errno;
c62b8e
+                }
c62b8e
+
c62b8e
+                if (fstat(child, &st) < 0)
c62b8e
+                        return -errno;
c62b8e
+                if ((flags & CHASE_NO_AUTOFS) &&
c62b8e
+                    fd_is_fs_type(child, AUTOFS_SUPER_MAGIC) > 0)
c62b8e
+                        return -EREMOTE;
c62b8e
+
c62b8e
+                if (S_ISLNK(st.st_mode)) {
c62b8e
+                        char *joined;
c62b8e
+
c62b8e
+                        _cleanup_free_ char *destination = NULL;
c62b8e
+
c62b8e
+                        /* This is a symlink, in this case read the destination. But let's make sure we don't follow
c62b8e
+                         * symlinks without bounds. */
c62b8e
+                        if (--max_follow <= 0)
c62b8e
+                                return -ELOOP;
c62b8e
+
c62b8e
+                        r = readlinkat_malloc(fd, first + n, &destination);
c62b8e
+                        if (r < 0)
c62b8e
+                                return r;
c62b8e
+                        if (isempty(destination))
c62b8e
+                                return -EINVAL;
c62b8e
+
c62b8e
+                        if (path_is_absolute(destination)) {
c62b8e
+
c62b8e
+                                /* An absolute destination. Start the loop from the beginning, but use the root
c62b8e
+                                 * directory as base. */
c62b8e
+
c62b8e
+                                safe_close(fd);
c62b8e
+                                fd = open(root ?: "/", O_CLOEXEC|O_NOFOLLOW|O_PATH);
c62b8e
+                                if (fd < 0)
c62b8e
+                                        return -errno;
c62b8e
+
c62b8e
+                                free(done);
c62b8e
+
c62b8e
+                                /* Note that we do not revalidate the root, we take it as is. */
c62b8e
+                                if (isempty(root))
c62b8e
+                                        done = NULL;
c62b8e
+                                else {
c62b8e
+                                        done = strdup(root);
c62b8e
+                                        if (!done)
c62b8e
+                                                return -ENOMEM;
c62b8e
+                                }
c62b8e
+
c62b8e
+                                /* Prefix what's left to do with what we just read, and start the loop again, but
c62b8e
+                                 * remain in the current directory. */
c62b8e
+                                joined = strjoin(destination, todo, NULL);
c62b8e
+                        } else
c62b8e
+                                joined = strjoin("/", destination, todo, NULL);
c62b8e
+                        if (!joined)
c62b8e
+                                return -ENOMEM;
c62b8e
+
c62b8e
+                        free(buffer);
c62b8e
+                        todo = buffer = joined;
c62b8e
+
c62b8e
+                        continue;
c62b8e
+                }
c62b8e
+
c62b8e
+                /* If this is not a symlink, then let's just add the name we read to what we already verified. */
c62b8e
+                if (!done) {
c62b8e
+                        done = first;
c62b8e
+                        first = NULL;
c62b8e
+                } else {
c62b8e
+                        /* If done is "/", as first also contains slash at the head, then remove this redundant slash. */
c62b8e
+                        if (streq(done, "/"))
c62b8e
+                                *done = '\0';
c62b8e
+
c62b8e
+                        if (!strextend(&done, first, NULL))
c62b8e
+                                return -ENOMEM;
c62b8e
+                }
c62b8e
+
c62b8e
+                /* And iterate again, but go one directory further down. */
c62b8e
+                safe_close(fd);
c62b8e
+                fd = child;
c62b8e
+                child = -1;
c62b8e
+        }
c62b8e
+
c62b8e
+        if (!done) {
c62b8e
+                /* Special case, turn the empty string into "/", to indicate the root directory. */
c62b8e
+                done = strdup("/");
c62b8e
+                if (!done)
c62b8e
+                        return -ENOMEM;
c62b8e
+        }
c62b8e
+
c62b8e
+        if (ret) {
c62b8e
+                *ret = done;
c62b8e
+                done = NULL;
c62b8e
+        }
c62b8e
+
c62b8e
+        return exists;
c62b8e
+}
c62b8e
diff --git a/src/shared/util.h b/src/shared/util.h
c62b8e
index f768936ab1..915c7439e8 100644
c62b8e
--- a/src/shared/util.h
c62b8e
+++ b/src/shared/util.h
c62b8e
@@ -1155,3 +1155,11 @@ typedef typeof(((struct statfs*)NULL)->f_type) statfs_f_type_t;
c62b8e
 
c62b8e
 bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
c62b8e
 int fd_is_fs_type(int fd, statfs_f_type_t magic_value);
c62b8e
+
c62b8e
+enum {
c62b8e
+        CHASE_PREFIX_ROOT = 1,   /* If set, the specified path will be prefixed by the specified root before beginning the iteration */
c62b8e
+        CHASE_NONEXISTENT = 2,   /* If set, it's OK if the path doesn't actually exist. */
c62b8e
+        CHASE_NO_AUTOFS = 4,     /* If set, return -EREMOTE if autofs mount point found */
c62b8e
+};
c62b8e
+
c62b8e
+int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret);
c62b8e
diff --git a/src/test/test-util.c b/src/test/test-util.c
c62b8e
index efb02ff530..397c45a9f4 100644
c62b8e
--- a/src/test/test-util.c
c62b8e
+++ b/src/test/test-util.c
c62b8e
@@ -36,6 +36,7 @@
c62b8e
 #include "fileio.h"
c62b8e
 #include "conf-parser.h"
c62b8e
 #include "virt.h"
c62b8e
+#include "path-util.h"
c62b8e
 
c62b8e
 static void test_streq_ptr(void) {
c62b8e
         assert_se(streq_ptr(NULL, NULL));
c62b8e
@@ -1909,6 +1910,212 @@ static void test_acquire_data_fd(void) {
c62b8e
         test_acquire_data_fd_one(ACQUIRE_NO_DEV_NULL|ACQUIRE_NO_MEMFD|ACQUIRE_NO_PIPE|ACQUIRE_NO_TMPFILE);
c62b8e
 }
c62b8e
 
c62b8e
+static void test_chase_symlinks(void) {
c62b8e
+        _cleanup_free_ char *result = NULL;
c62b8e
+        char temp[] = "/tmp/test-chase.XXXXXX";
c62b8e
+        const char *top, *p, *pslash, *q, *qslash;
c62b8e
+        int r;
c62b8e
+
c62b8e
+        assert_se(mkdtemp(temp));
c62b8e
+
c62b8e
+        top = strjoina(temp, "/top");
c62b8e
+        assert_se(mkdir(top, 0700) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(top, "/dot");
c62b8e
+        assert_se(symlink(".", p) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(top, "/dotdot");
c62b8e
+        assert_se(symlink("..", p) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(top, "/dotdota");
c62b8e
+        assert_se(symlink("../a", p) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/a");
c62b8e
+        assert_se(symlink("b", p) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/b");
c62b8e
+        assert_se(symlink("/usr", p) >= 0);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/start");
c62b8e
+        assert_se(symlink("top/dot/dotdota", p) >= 0);
c62b8e
+
c62b8e
+        /* Paths that use symlinks underneath the "root" */
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, "/usr"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        pslash = strjoina(p, "/");
c62b8e
+        r = chase_symlinks(pslash, NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, "/usr/"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        r = chase_symlinks(pslash, temp, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        q = strjoina(temp, "/usr");
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(path_equal(result, q));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        qslash = strjoina(q, "/");
c62b8e
+
c62b8e
+        r = chase_symlinks(pslash, temp, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(path_equal(result, qslash));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        assert_se(mkdir(q, 0700) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, q));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks(pslash, temp, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, qslash));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/slash");
c62b8e
+        assert_se(symlink("/", p) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, "/"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, temp));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        /* Paths that would "escape" outside of the "root" */
c62b8e
+
c62b8e
+        p = strjoina(temp, "/6dots");
c62b8e
+        assert_se(symlink("../../..", p) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0 && path_equal(result, temp));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/6dotsusr");
c62b8e
+        assert_se(symlink("../../../usr", p) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0 && path_equal(result, q));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/top/8dotsusr");
c62b8e
+        assert_se(symlink("../../../../usr", p) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0 && path_equal(result, q));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        /* Paths that contain repeated slashes */
c62b8e
+
c62b8e
+        p = strjoina(temp, "/slashslash");
c62b8e
+        assert_se(symlink("///usr///", p) >= 0);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, "/usr"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, temp, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, q));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        /* Paths using . */
c62b8e
+
c62b8e
+        r = chase_symlinks("/etc/./.././", NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(path_equal(result, "/"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/etc/./.././", "/etc", 0, &result);
c62b8e
+        assert_se(r > 0 && path_equal(result, "/etc"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/../.././//../../etc", NULL, 0, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(streq(result, "/etc"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/../.././//../../test-chase.fsldajfl", NULL, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(streq(result, "/test-chase.fsldajfl"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/../.././//../../etc", "/", CHASE_PREFIX_ROOT, &result);
c62b8e
+        assert_se(r > 0);
c62b8e
+        assert_se(streq(result, "/etc"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/../.././//../../test-chase.fsldajfl", "/", CHASE_PREFIX_ROOT|CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(streq(result, "/test-chase.fsldajfl"));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        r = chase_symlinks("/etc/machine-id/foo", NULL, 0, &result);
c62b8e
+        assert_se(r == -ENOTDIR);
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        /* Path that loops back to self */
c62b8e
+
c62b8e
+        p = strjoina(temp, "/recursive-symlink");
c62b8e
+        assert_se(symlink("recursive-symlink", p) >= 0);
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r == -ELOOP);
c62b8e
+
c62b8e
+        /* Path which doesn't exist */
c62b8e
+
c62b8e
+        p = strjoina(temp, "/idontexist");
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(path_equal(result, p));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/idontexist/meneither");
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == 0);
c62b8e
+        assert_se(path_equal(result, p));
c62b8e
+        result = mfree(result);
c62b8e
+
c62b8e
+        /* Path which doesn't exist, but contains weird stuff */
c62b8e
+
c62b8e
+        p = strjoina(temp, "/idontexist/..");
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        p = strjoina(temp, "/target");
c62b8e
+        q = strjoina(temp, "/top");
c62b8e
+        assert_se(symlink(q, p) >= 0);
c62b8e
+        p = strjoina(temp, "/target/idontexist");
c62b8e
+        r = chase_symlinks(p, NULL, 0, &result);
c62b8e
+        assert_se(r == -ENOENT);
c62b8e
+
c62b8e
+        assert_se(rm_rf_dangerous(temp, false, true, false) >= 0);
c62b8e
+}
c62b8e
+
c62b8e
 int main(int argc, char *argv[]) {
c62b8e
         log_parse_environment();
c62b8e
         log_open();
c62b8e
@@ -1992,6 +2199,7 @@ int main(int argc, char *argv[]) {
c62b8e
         test_system_tasks_max();
c62b8e
         test_system_tasks_max_scale();
c62b8e
         test_acquire_data_fd();
c62b8e
+        test_chase_symlinks();
c62b8e
 
c62b8e
         return 0;
c62b8e
 }