bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: acl: new function for testing triviality of ACL


From: Bruno Haible
Subject: Re: acl: new function for testing triviality of ACL
Date: Wed, 4 Jun 2008 22:49:01 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote:
> >     * lib/acl-internal.h (acl_access_nontrivial): New declaration.
> >     * lib/file-has-acl.c (acl_access_nontrivial): New function.
> >     (file_has_acl): Use it. Save errno afterwards.
> >     * lib/copy-acl.c (qcopy_acl): Use acl_access_nontrivial.
> 
> Please go ahead.

Thanks, I applied it, with this additional modification. On Tru64, an
acl_perm_t can contain more than the 3 bits for read/write/execute. If one
of the nonstandard bits is set, the ACL is not a trivial one.

Bruno


*** lib/file-has-acl.c  2008-06-04 22:42:30.000000000 +0200
--- lib/file-has-acl.c  2008-06-04 00:12:35.000000000 +0200
***************
*** 83,92 ****
  
    for (ace = acl->acl_first; count > 0; ace = ace->next, count--)
      {
!       acl_tag_t tag = ace->entry->acl_type;
  
        if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
        return 1;
      }
    return 0;
  
--- 83,100 ----
  
    for (ace = acl->acl_first; count > 0; ace = ace->next, count--)
      {
!       acl_tag_t tag;
!       acl_perm_t perm;
  
+       tag = ace->entry->acl_type;
        if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
        return 1;
+ 
+       perm = ace->entry->acl_perm;
+       /* On Tru64, perm can also contain non-standard bits such as
+        PERM_INSERT, PERM_DELETE, PERM_MODIFY, PERM_LOOKUP, ... */
+       if ((perm & ~(ACL_READ | ACL_WRITE | ACL_EXECUTE)) != 0)
+       return 1;
      }
    return 0;
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]