Mercurial > hg > octave-lyh > gnulib-hg
changeset 16380:1d3faf917922
acl: Fix copy-acl test failure on Solaris 11 2011-11.
* lib/file-has-acl.c (NEW_ACE_WRITEA_DATA): New macro.
(acl_ace_nontrivial): Relax the restrictions on access_masks[] so
that this function returns 0 in some more cases.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 19 Feb 2012 21:59:07 +0100 |
parents | 124cbda01e1f |
children | fc5c37ccbece |
files | ChangeLog lib/file-has-acl.c |
diffstat | 2 files changed, 64 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-02-19 Bruno Haible <bruno@clisp.org> + + acl: Fix copy-acl test failure on Solaris 11 2011-11. + * lib/file-has-acl.c (NEW_ACE_WRITEA_DATA): New macro. + (acl_ace_nontrivial): Relax the restrictions on access_masks[] so + that this function returns 0 in some more cases. + 2012-02-19 Bruno Haible <bruno@clisp.org> acl: Update doc references.
--- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -154,6 +154,9 @@ # ifdef ACE_GETACL +/* A shortcut for a bitmask. */ +# define NEW_ACE_WRITEA_DATA (NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA) + /* Test an ACL retrieved with ACE_GETACL. Return 1 if the given ACL, consisting of COUNT entries, is non-trivial. Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */ @@ -250,16 +253,6 @@ | NEW_ACE_WRITE_ATTRIBUTES | NEW_ACE_WRITE_ACL | NEW_ACE_WRITE_OWNER); - if ((NEW_ACE_WRITE_NAMED_ATTRS - | NEW_ACE_WRITE_ATTRIBUTES - | NEW_ACE_WRITE_ACL - | NEW_ACE_WRITE_OWNER) - & ~ access_masks[4]) - return 1; - access_masks[4] &= ~(NEW_ACE_WRITE_NAMED_ATTRS - | NEW_ACE_WRITE_ATTRIBUTES - | NEW_ACE_WRITE_ACL - | NEW_ACE_WRITE_OWNER); if ((NEW_ACE_READ_NAMED_ATTRS | NEW_ACE_READ_ATTRIBUTES | NEW_ACE_READ_ACL @@ -272,21 +265,60 @@ | NEW_ACE_SYNCHRONIZE); /* Check the allowed or denied bits. */ - if ((access_masks[0] | access_masks[1]) - != (NEW_ACE_READ_DATA - | NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA - | NEW_ACE_EXECUTE)) - return 1; - if ((access_masks[2] | access_masks[3]) - != (NEW_ACE_READ_DATA - | NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA - | NEW_ACE_EXECUTE)) - return 1; - if ((access_masks[4] | access_masks[5]) - != (NEW_ACE_READ_DATA - | NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA - | NEW_ACE_EXECUTE)) - return 1; + switch ((access_masks[0] | access_masks[1]) + & ~(NEW_ACE_READ_NAMED_ATTRS + | NEW_ACE_READ_ATTRIBUTES + | NEW_ACE_READ_ACL + | NEW_ACE_SYNCHRONIZE)) + { + case 0: + case NEW_ACE_READ_DATA: + case NEW_ACE_WRITEA_DATA: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA: + case NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + break; + default: + return 1; + } + switch ((access_masks[2] | access_masks[3]) + & ~(NEW_ACE_READ_NAMED_ATTRS + | NEW_ACE_READ_ATTRIBUTES + | NEW_ACE_READ_ACL + | NEW_ACE_SYNCHRONIZE)) + { + case 0: + case NEW_ACE_READ_DATA: + case NEW_ACE_WRITEA_DATA: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA: + case NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + break; + default: + return 1; + } + switch ((access_masks[4] | access_masks[5]) + & ~(NEW_ACE_WRITE_NAMED_ATTRS + | NEW_ACE_WRITE_ATTRIBUTES + | NEW_ACE_WRITE_ACL + | NEW_ACE_WRITE_OWNER)) + { + case 0: + case NEW_ACE_READ_DATA: + case NEW_ACE_WRITEA_DATA: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA: + case NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE: + break; + default: + return 1; + } /* Check that the NEW_ACE_WRITE_DATA and NEW_ACE_APPEND_DATA bits are either both allowed or both denied. */