diff options
author | Martin Matuska <martin@matuska.org> | 2017-01-10 21:50:37 +0100 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2017-01-10 22:03:23 +0100 |
commit | f082a5b42f4f07c39d11285f383e6e733f43c79d (patch) | |
tree | dba4a7aa0c86ea45c70558cbe870f58296187257 /libarchive/archive_read_disk_entry_from_file.c | |
parent | 85fb5122964927c714b79746d2854b6766291287 (diff) | |
download | libarchive-f082a5b42f4f07c39d11285f383e6e733f43c79d.tar.gz |
Make acl_perm_map[] and acl_inherit_map[] more readable
Fix missing acl_inherit_map[] in archive_write_disk_acl.c
Add comments to translate_acl()
Diffstat (limited to 'libarchive/archive_read_disk_entry_from_file.c')
-rw-r--r-- | libarchive/archive_read_disk_entry_from_file.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index e8bf07e9..7daa3933 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -575,14 +575,14 @@ setup_acls(struct archive_read_disk *a, return (ARCHIVE_OK); } -#if HAVE_SUN_ACL /* - * Translate Solaris system NFSv4 ACL into libarchive internal structure. + * Translate system ACL permissions into libarchive internal structure */ static struct { int archive_perm; int platform_perm; } acl_perm_map[] = { +#if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE}, {ARCHIVE_ENTRY_ACL_READ_DATA, ACE_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACE_LIST_DIRECTORY}, @@ -600,32 +600,11 @@ static struct { {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACE_WRITE_ACL}, {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACE_WRITE_OWNER}, {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACE_SYNCHRONIZE} -}; - -static struct { - int archive_inherit; - int platform_inherit; -} acl_inherit_map[] = { - {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE}, - {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACE_DIRECTORY_INHERIT_ACE}, - {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACE_NO_PROPAGATE_INHERIT_ACE}, - {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACE_INHERIT_ONLY_ACE}, - {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACE_SUCCESSFUL_ACCESS_ACE_FLAG}, - {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACE_FAILED_ACCESS_ACE_FLAG}, - {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACE_INHERITED_ACE} -}; -#else /* !HAVE_SUN_ACL */ -/* - * Translate FreeBSD system ACL into libarchive internal structure. - */ -static struct { - int archive_perm; - int platform_perm; -} acl_perm_map[] = { +#else /* POSIX.1e ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, -#ifdef ACL_TYPE_NFS4 +#ifdef ACL_TYPE_NFS4 /* FreeBSD NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, @@ -643,13 +622,26 @@ static struct { {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER}, {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} #endif +#endif /* !HAVE_SUN_ACL */ }; -#ifdef ACL_TYPE_NFS4 +#if defined(ACL_TYPE_NFS4) || HAVE_SUN_ACL +/* + * Translate system NFSv4 inheritance flags into libarchive internal structure + */ static struct { int archive_inherit; int platform_inherit; } acl_inherit_map[] = { +#if HAVE_SUN_ACL + {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE}, + {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACE_DIRECTORY_INHERIT_ACE}, + {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACE_NO_PROPAGATE_INHERIT_ACE}, + {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACE_INHERIT_ONLY_ACE}, + {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACE_SUCCESSFUL_ACCESS_ACE_FLAG}, + {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACE_FAILED_ACCESS_ACE_FLAG}, + {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACE_INHERITED_ACE} +#else /* !HAVE_SUN_ACL */ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, @@ -657,11 +649,14 @@ static struct { {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED} -}; -#endif #endif /* !HAVE_SUN_ACL */ +}; +#endif /* defined(ACL_TYPE_NFS4) || HAVE_SUN_ACL */ #if HAVE_SUN_ACL +/* + * Translate Solaris POSIX.1e and NFSv4 ACLs into libarchive internal ACL + */ static int translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t *acl, int default_entry_acl_type) @@ -792,6 +787,10 @@ translate_acl(struct archive_read_disk *a, return (ARCHIVE_OK); } #else /* !HAVE_SUN_ACL */ +/* + * Translate POSIX.1e (Linux) and FreeBSD (both POSIX.1e and NFSv4) + * ACLs into libarchive internal structure + */ static int translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t acl, int default_entry_acl_type) |