-/****************************************************************************
- Go through the ACL entries one by one, count them and extract the permset
- of the mask entry as we scan the acl.
-****************************************************************************/
-
-static size_t get_num_entries(acl_t posix_acl, acl_permset_t *file_mask)
-{
- size_t num_entries;
- acl_entry_t entry;
- int entry_id = ACL_FIRST_ENTRY;
-
- *file_mask = (ACL_READ|ACL_WRITE|ACL_EXECUTE);
-
- /*
- * If the acl is NULL, then return 3 as we will fake this using UNIX
- * permissions.
- */
-
- if (posix_acl == NULL)
- return 3;
-
- num_entries = 0;
- while ( acl_get_entry(posix_acl, entry_id, &entry) == 1) {
- acl_tag_t tagtype;
- acl_permset_t permset;
-
- /* get_next... */
- if (entry_id == ACL_FIRST_ENTRY)
- entry_id = ACL_NEXT_ENTRY;
-
- /* Is this a MASK entry ? */
- if (acl_get_tag_type(entry, &tagtype) == -1)
- continue;
-
- if (tagtype == ACL_MASK) {
- if (acl_get_permset(entry, &permset) == 0)
- *file_mask = permset;
- continue; /* Don't count the mask as an entry. */
- }
-
- num_entries++;
- }
-
- return num_entries;
-}
-