summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2017-02-17 10:14:12 +0000
committertb <tb@openbsd.org>2017-02-17 10:14:12 +0000
commit90634dde6bb654d299182baf5300472c9936838b (patch)
treedf10ebe0467c461948b25455d9a4d51652711b33
parentAdd tests for chmod's interaction with symlinks: missing tests for -h and (diff)
downloadwireguard-openbsd-90634dde6bb654d299182baf5300472c9936838b.tar.xz
wireguard-openbsd-90634dde6bb654d299182baf5300472c9936838b.zip
In chmod's symbolic mode without -h and -R flags, a missing FTS_COMFOLLOW
flag to fts_open led to the following behavior: the symlink's permissions were read, changed according to the command line, and transferred to the target file. chflags had a similar problem while chmod was unaffected. Regression introduced in r1.33. Reported by Christopher Wellons, thanks! ok guenther
-rw-r--r--bin/chmod/chmod.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c
index 2ed31346ed9..9e5cd1b0711 100644
--- a/bin/chmod/chmod.c
+++ b/bin/chmod/chmod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chmod.c,v 1.40 2016/10/19 18:20:25 schwarze Exp $ */
+/* $OpenBSD: chmod.c,v 1.41 2017/02/17 10:14:12 tb Exp $ */
/* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */
/*
@@ -146,8 +146,10 @@ done:
fts_options |= FTS_LOGICAL;
atflags = 0;
}
- } else if (!hflag)
+ } else if (!hflag) {
+ fts_options |= FTS_COMFOLLOW;
atflags = 0;
+ }
if (ischflags) {
if (pledge("stdio rpath fattr", NULL) == -1)