]> gitweb.michael.orlitzky.com - apply-default-acl.git/commitdiff
Add a test to ensure that non-terminal symlinks are not followed.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 12:45:55 +0000 (07:45 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 19:10:29 +0000 (14:10 -0500)
run-tests.sh

index d87c678b811e90ce23bf32514914dbd0c0901460..d75e91eaa74f03b08929426c1268225fbba42ddd 100755 (executable)
@@ -760,7 +760,7 @@ LINK2TARGET="${TESTDIR}/baz"
 mkdir -p $(dirname "${TARGET}")
 touch "${TARGET}"
 ln -s foo "${TESTDIR}/baz"
-setfacl --default --modify user:${USERS[0]}:rw "${TESTDIR}/foo"
+setfacl --default --modify user:${USERS[0]}:rw $(dirname "${TARGET}")
 pushd "${TESTDIR}/baz" > /dev/null
 "${BIN}" bar
 popd > /dev/null
@@ -775,3 +775,23 @@ other::r--
 EOF
 )
 compare
+
+
+# Ensure that symlinks in non-terminal path components are not followed.
+TESTNUM=32
+TARGET="${TESTDIR}/foo/bar/baz"
+LINK2FOO="${TESTDIR}/quux"
+mkdir -p $(dirname "${TARGET}")
+touch "${TARGET}"
+ln -s foo "${LINK2FOO}"
+setfacl --default --modify user:${USERS[0]}:rw $(dirname "${TARGET}")
+"${BIN}" "${LINK2FOO}/bar/baz"
+ACTUAL=$( getfacl --omit-header "${TARGET}" )
+EXPECTED=$(cat <<EOF
+user::rw-
+group::r--
+other::r--
+
+EOF
+)
+compare