- /* Check that the NEW_ACE_WRITE_DATA and NEW_ACE_APPEND_DATA bits are
- either both allowed or both denied. */
- if (((access_masks[0] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[0] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- if (((access_masks[2] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[2] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- if (((access_masks[4] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[4] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- }
-
- return 0;
-}
-
-# endif
-
-#elif USE_ACL && HAVE_GETACL /* HP-UX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl_entry *ace = &entries[i];
-
- if (!((ace->uid == sb->st_uid && ace->gid == ACL_NSGROUP)
- || (ace->uid == ACL_NSUSER && ace->gid == sb->st_gid)
- || (ace->uid == ACL_NSUSER && ace->gid == ACL_NSGROUP)))
- return 1;
- }
- return 0;
-}
-
-# if HAVE_ACLV_H /* HP-UX >= 11.11 */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-aclv_nontrivial (int count, struct acl *entries)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl *ace = &entries[i];
-
- /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
- If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
- We don't need to check ace->a_id in these cases. */
- if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
- || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
- || ace->a_type == CLASS_OBJ
- || ace->a_type == OTHER_OBJ))
- return 1;
- }
- return 0;
-}
-
-# endif
-
-#elif USE_ACL && (HAVE_ACLX_GET || HAVE_STATACL) /* AIX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (struct acl *a)
-{
- /* The normal way to iterate through an ACL is like this:
- struct acl_entry *ace;
- for (ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
- {
- struct ace_id *aei;
- switch (ace->ace_type)
- {
- case ACC_PERMIT:
- case ACC_DENY:
- case ACC_SPECIFY:
- ...;
- }
- for (aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
- ...
- }
- */
- return (acl_last (a) != a->acl_ext ? 1 : 0);
-}
-
-# if HAVE_ACLX_GET && defined ACL_AIX_WIP /* newer AIX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nfs4_nontrivial (nfs4_acl_int_t *a)
-{
-# if 1 /* let's try this first */
- return (a->aclEntryN > 0 ? 1 : 0);
-# else
- int count = a->aclEntryN;
- int i;
-
- for (i = 0; i < count; i++)
- {
- nfs4_ace_int_t *ace = &a->aclEntry[i];
-
- if (!((ace->flags & ACE4_ID_SPECIAL) != 0
- && (ace->aceWho.special_whoid == ACE4_WHO_OWNER
- || ace->aceWho.special_whoid == ACE4_WHO_GROUP
- || ace->aceWho.special_whoid == ACE4_WHO_EVERYONE)
- && ace->aceType == ACE4_ACCESS_ALLOWED_ACE_TYPE
- && ace->aceFlags == 0
- && (ace->aceMask & ~(ACE4_READ_DATA | ACE4_LIST_DIRECTORY
- | ACE4_WRITE_DATA | ACE4_ADD_FILE
- | ACE4_EXECUTE)) == 0))
- return 1;
- }
- return 0;
-# endif
-}
-
-# endif
-
-#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
-
-/* Test an ACL retrieved with ACL_GET.
- 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. */
-int
-acl_nontrivial (int count, struct acl *entries)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl *ace = &entries[i];
-
- /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
- If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
- We don't need to check ace->a_id in these cases. */
- if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
- || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
- || ace->a_type == CLASS_OBJ
- || ace->a_type == OTHER_OBJ))
- return 1;
- }
- return 0;
-}
-
-#endif
-
-
-/* Return 1 if NAME has a nontrivial access control list, 0 if NAME
- only has no or a base access control list, and -1 (setting errno)
- on error. SB must be set to the stat buffer of NAME, obtained
- through stat() or lstat(). */