From: Brandon Philips <brandon@ifup.org>
To: Andreas Gruenbacher <agruen@suse.de>, tes@sgi.com
Cc: xfs@oss.sgi.com
Subject: [PATCH] acl: Fix WALK_TREE_RECURSIVE for the WALK_TREE_DEREFERENCE case
Date: Thu, 10 Jul 2008 17:53:40 -0700 [thread overview]
Message-ID: <20080711005340.GA30185@potty.ifup.org> (raw)
NOTE: Sending to xfs@oss.sgi.com instead of acl-devel since it doesn't
seem active anymore.
getfacl.c calls walk_tree() with WALK_TREE_DEREFERENCE. This causes a
stat() of symlinks which in turn causes S_ISDIR(st.st_mode) to be true
on symlinks.
This causes getfacl -P to return the contents of symlinks...
e.g.
$ mkdir -p test/sub
$ mkdir test/link
$ touch test/link/file
$ ln -s `pwd`/test/link test/sub/link
$ getfacl -P -R test/sub
# file: test/sub
# owner: philips
# group: users
user::rwx
group::r-x
other::r-x
# file: test/sub/link/file
# owner: philips
# group: users
user::rw-
group::r--
other::r--
After the fix:
$ getfacl -R -P test/sub/
# file: test/sub/
# owner: philips
# group: users
user::rwx
group::r-x
other::r-x
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
libmisc/walk_tree.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: acl-2.2.47/libmisc/walk_tree.c
===================================================================
--- acl-2.2.47.orig/libmisc/walk_tree.c
+++ acl-2.2.47/libmisc/walk_tree.c
@@ -93,8 +93,15 @@ static int walk_tree_rec(const char *pat
have_dir_stat = 1;
}
err = func(path, &st, flags, arg);
+
+ /*
+ * Recurse if WALK_TREE_RECURSIVE and the path is:
+ * a dir not from a symlink
+ * a link and follow_symlinks
+ */
if ((flags & WALK_TREE_RECURSIVE) &&
- (S_ISDIR(st.st_mode) || (S_ISLNK(st.st_mode) && follow_symlinks))) {
+ (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
+ ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
struct dirent *entry;
/*
reply other threads:[~2008-07-10 16:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080711005340.GA30185@potty.ifup.org \
--to=brandon@ifup.org \
--cc=agruen@suse.de \
--cc=tes@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox