From 906d2bb2eb7ae6e5c055f63c44f82a24641d17f8 Mon Sep 17 00:00:00 2001 From: David Bartley Date: Sun, 3 May 2009 18:34:06 -0400 Subject: [PATCH] Bug fixes in acl module. * lib/acl_entries.c: Correctly check return of acl_get_entry. * lib/file-has-acl.c: Likewise. * lib/set-mode-acl.c: Use correct struct with ACL_SETACL. --- ChangeLog | 7 +++++++ lib/acl_entries.c | 8 ++++---- lib/file-has-acl.c | 10 +++++----- lib/set-mode-acl.c | 4 ++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f552f8..716125e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-04 David Bartley + + Bug fixes in acl module. + * lib/acl_entries.c: Correctly check return of acl_get_entry. + * lib/file-has-acl.c: Likewise. + * lib/set-mode-acl.c: Use correct struct with ACL_SETACL. + 2009-05-04 Simon Josefsson * m4/fnmatch.m4: Fix fnmatch re-define. diff --git a/lib/acl_entries.c b/lib/acl_entries.c index a931fff..a8f59a8 100644 --- a/lib/acl_entries.c +++ b/lib/acl_entries.c @@ -35,11 +35,11 @@ acl_entries (acl_t acl) { #if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, MacOS X */ acl_entry_t ace; - int at_end; + int not_at_end; - for (at_end = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace); - !at_end; - at_end = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) + for (not_at_end = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace); + not_at_end == 1; + not_at_end = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) count++; #else /* IRIX, Tru64 */ # if HAVE_ACL_TO_SHORT_TEXT /* IRIX */ diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index d2ad48f..38ad90e 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -55,11 +55,11 @@ acl_access_nontrivial (acl_t acl) # if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD */ acl_entry_t ace; - int at_end; + int not_at_end; - for (at_end = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace); - !at_end; - at_end = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) + for (not_at_end = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace); + not_at_end == 1; + not_at_end = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) { acl_tag_t tag; if (acl_get_tag_type (ace, &tag) < 0) @@ -67,7 +67,7 @@ acl_access_nontrivial (acl_t acl) if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER)) return 1; } - return 0; + return not_at_end; # else /* IRIX, Tru64 */ # if HAVE_ACL_TO_SHORT_TEXT /* IRIX */ diff --git a/lib/set-mode-acl.c b/lib/set-mode-acl.c index dbcbea2..13d8b23 100644 --- a/lib/set-mode-acl.c +++ b/lib/set-mode-acl.c @@ -354,10 +354,10 @@ qset_acl (char const *name, int desc, mode_t mode) } if (desc != -1) ret = facl (desc, ACE_SETACL, - sizeof (entries) / sizeof (aclent_t), entries); + sizeof (entries) / sizeof (ace_t), entries); else ret = acl (name, ACE_SETACL, - sizeof (entries) / sizeof (aclent_t), entries); + sizeof (entries) / sizeof (ace_t), entries); if (ret < 0 && errno != EINVAL && errno != ENOTSUP) { if (errno == ENOSYS) -- 1.5.6.5