Beispiel #1
0
/*
 * XXX TODO: What about ACL types other than ACCESS and DEFAULT?
 */
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
                            struct archive_acl *abstract_acl)
{
    int		 ret;

    if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) > 0) {
        ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_ACCESS,
                      ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
        if (ret != ARCHIVE_OK)
            return (ret);
        ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT,
                      ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
        return (ret);
#ifdef ACL_TYPE_NFS4
    } else if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0) {
        ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_NFS4,
                      ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
        return (ret);
#endif
    } else
        return ARCHIVE_OK;
}
Beispiel #2
0
/*
 * Return a count of entries matching "want_type".
 */
int
archive_entry_acl_count(struct archive_entry *entry, int want_type)
{
	return archive_acl_count(&entry->acl, want_type);
}