-/* Return 1 if NAME has a nontrivial access control list, 0 if
- NAME only has no or a base access control list, and -1 on
- error. SB must be set to the stat buffer of FILE. */
-
-int
-file_has_acl (char const *name, struct stat const *sb)
-{
-#if USE_ACL && HAVE_ACL && defined GETACLCNT
- /* This implementation should work on recent-enough versions of HP-UX,
- Solaris, and Unixware. */
-
-# ifndef MIN_ACL_ENTRIES
-# define MIN_ACL_ENTRIES 4
-# endif
-
- if (! S_ISLNK (sb->st_mode))
- {
- int n = acl (name, GETACLCNT, 0, NULL);
- return n < 0 ? (errno == ENOSYS ? 0 : -1) : (MIN_ACL_ENTRIES < n);
- }
-#elif USE_ACL && HAVE_ACL_GET_FILE && HAVE_ACL_FREE
- /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
-
- if (! S_ISLNK (sb->st_mode))
- {
- int ret;
-
- if (HAVE_ACL_EXTENDED_FILE)
- ret = acl_extended_file (name);
- else
- {
- acl_t acl = acl_get_file (name, ACL_TYPE_ACCESS);
- if (acl)
- {
- ret = (3 < acl_entries (acl));
- acl_free (acl);
- if (ret == 0 && S_ISDIR (sb->st_mode))
- {
- acl = acl_get_file (name, ACL_TYPE_DEFAULT);
- if (acl)
- {
- ret = (0 < acl_entries (acl));
- acl_free (acl);
- }
- else
- ret = -1;
- }
- }
- else
- ret = -1;
- }
- if (ret < 0)
- return (errno == ENOSYS || errno == ENOTSUP) ? 0 : -1;
- return ret;
- }
-#endif
-
- /* FIXME: Add support for AIX, Irix, and Tru64. Please see Samba's
- source/lib/sysacls.c file for fix-related ideas. */
-
- return 0;
-}
-