Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add forgotten AT_SYMLINK_NOFOLLOW
Baptiste Daroussin committed 10 years ago
commit 4d53b18e3e50588c0c5e1e36d7630ab4562893e5
parent 29e3523
2 files changed +28 -3
modified libpkg/pkg_add.c
@@ -220,7 +220,7 @@ set_attrs(int fd, char *path, mode_t perm, uid_t uid, gid_t gid,
	}

	/* zfs drops the setuid on fchownat */
-
	if (fchmodat(fd, RELATIVE_PATH(path), perm, 0) == -1) {
+
	if (fchmodat(fd, RELATIVE_PATH(path), perm, AT_SYMLINK_NOFOLLOW) == -1) {
		pkg_emit_error("Fail to chmod %s: %s", path, strerror(errno));
		return (EPKG_FATAL);
	}
modified tests/frontend/extract.sh
@@ -8,8 +8,8 @@ tests_init \
	setuid \
	setuid_hardlinks \
	chflags \
-
	chflags_schg
-

+
	chflags_schg \
+
	symlinks

basic_body()
{
@@ -239,3 +239,28 @@ chflags_schg_cleanup()
{
	chflags -R noschg ${TMPDIR}
}
+

+
symlinks_body()
+
{
+
	new_pkg "test" "test" "1" || atf_fail "fail to create the ucl file"
+
	cat << EOF >> test.ucl
+
files: {
+
${TMPDIR}/a = "";
+
}
+
EOF
+

+
	ln -sf nothing a
+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg create -M test.ucl
+

+
	mkdir ${TMPDIR}/target
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.txz
+
}