aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2017-02-15 20:00:36 +0000
committerMartin Matuska <mm@FreeBSD.org>2017-02-15 20:00:36 +0000
commitb2ee1181b4555230a015f1b8f27a1e7ec3c2bb6e (patch)
tree1a62c74f48b604d604af29dda6510f2fe638c54b
parent638a0d360a635fb7bb0ada38ef0b3a3bfb16bafc (diff)
downloadsrc-b2ee1181b4555230a015f1b8f27a1e7ec3c2bb6e.tar.gz
src-b2ee1181b4555230a015f1b8f27a1e7ec3c2bb6e.zip
Update vendor/libarchive to git 0edabbad1f44641c64fe9d0cbaed27ed93ab38c2
Vendor changes: Make SCHILY.acl.ace header more compact (NFSv4 ACLs) Vendor bugfixes: zip reader integer parsing fix (OSS-Fuzz 556) spelling fixes (issue #863)
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=313781
-rw-r--r--libarchive/archive_acl.c173
-rw-r--r--libarchive/archive_entry.h5
-rw-r--r--libarchive/archive_entry_acl.39
-rw-r--r--libarchive/archive_read_disk_entry_from_file.c14
-rw-r--r--libarchive/archive_read_support_format_zip.c64
-rw-r--r--libarchive/archive_write_disk_acl.c14
-rw-r--r--libarchive/archive_write_set_format_pax.c3
-rw-r--r--libarchive/test/test_acl_pax_nfs4.tar.uu44
-rw-r--r--libarchive/test/test_acl_platform_posix1e.c2
-rw-r--r--libarchive/test/test_acl_text.c13
10 files changed, 188 insertions, 153 deletions
diff --git a/libarchive/archive_acl.c b/libarchive/archive_acl.c
index 1e9ddbb24119..b8b6b636453e 100644
--- a/libarchive/archive_acl.c
+++ b/libarchive/archive_acl.c
@@ -83,6 +83,50 @@ static void append_entry(char **p, const char *prefix, int type,
int tag, int flags, const char *name, int perm, int id);
static void append_id(char **p, int id);
+static const struct {
+ const int perm;
+ const char c;
+ const wchar_t wc;
+} nfsv4_acl_perm_map[] = {
+ { ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, 'r',
+ L'r' },
+ { ARCHIVE_ENTRY_ACL_WRITE_DATA | ARCHIVE_ENTRY_ACL_ADD_FILE, 'w',
+ L'w' },
+ { ARCHIVE_ENTRY_ACL_EXECUTE, 'x', L'x' },
+ { ARCHIVE_ENTRY_ACL_APPEND_DATA | ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY,
+ 'p', L'p' },
+ { ARCHIVE_ENTRY_ACL_DELETE, 'd', L'd' },
+ { ARCHIVE_ENTRY_ACL_DELETE_CHILD, 'D', L'D' },
+ { ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, 'a', L'a' },
+ { ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, 'A', L'A' },
+ { ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, 'R', L'R' },
+ { ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, 'W', L'W' },
+ { ARCHIVE_ENTRY_ACL_READ_ACL, 'c', L'c' },
+ { ARCHIVE_ENTRY_ACL_WRITE_ACL, 'C', L'C' },
+ { ARCHIVE_ENTRY_ACL_WRITE_OWNER, 'o', L'o' },
+ { ARCHIVE_ENTRY_ACL_SYNCHRONIZE, 's', L's' }
+};
+
+static const int nfsv4_acl_perm_map_size = (int)(sizeof(nfsv4_acl_perm_map) /
+ sizeof(nfsv4_acl_perm_map[0]));
+
+static const struct {
+ const int perm;
+ const char c;
+ const wchar_t wc;
+} nfsv4_acl_flag_map[] = {
+ { ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, 'f', L'f' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, 'd', L'd' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, 'i', L'i' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, 'n', L'n' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, 'S', L'S' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, 'F', L'F' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, 'I', L'I' }
+};
+
+static const int nfsv4_acl_flag_map_size = (int)(sizeof(nfsv4_acl_flag_map) /
+ sizeof(nfsv4_acl_flag_map[0]));
+
void
archive_acl_clear(struct archive_acl *acl)
{
@@ -741,6 +785,8 @@ static void
append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
int tag, int flags, const wchar_t *wname, int perm, int id)
{
+ int i;
+
if (prefix != NULL) {
wcscpy(*wp, prefix);
*wp += wcslen(*wp);
@@ -810,46 +856,20 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
*(*wp)++ = (perm & 0222) ? L'w' : L'-';
*(*wp)++ = (perm & 0111) ? L'x' : L'-';
} else {
- /* NFS4 ACL perms */
- *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA |
- ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? L'r' : L'-';
- *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA |
- ARCHIVE_ENTRY_ACL_ADD_FILE)) ? L'w' : L'-';
- *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_EXECUTE) ? L'x' : L'-';
- *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA |
- ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? L'p' : L'-';
- *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? L'd' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? L'D' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? L'a' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? L'A' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? L'R' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? L'W' : L'-';
- *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_READ_ACL) ? L'c' : L'-';
- *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_WRITE_ACL) ? L'C' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? L'o' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? L's' : L'-';
+ /* NFSv4 ACL perms */
+ for (i = 0; i < nfsv4_acl_perm_map_size; i++) {
+ if (perm & nfsv4_acl_perm_map[i].perm)
+ *(*wp)++ = nfsv4_acl_perm_map[i].wc;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*wp)++ = L'-';
+ }
*(*wp)++ = L':';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? L'f' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? L'd' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? L'i' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? L'n' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? L'S' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? L'F' : L'-';
- *(*wp)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? L'I' : L'-';
+ for (i = 0; i < nfsv4_acl_flag_map_size; i++) {
+ if (perm & nfsv4_acl_flag_map[i].perm)
+ *(*wp)++ = nfsv4_acl_flag_map[i].wc;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*wp)++ = L'-';
+ }
*(*wp)++ = L':';
switch (type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
@@ -998,6 +1018,8 @@ static void
append_entry(char **p, const char *prefix, int type,
int tag, int flags, const char *name, int perm, int id)
{
+ int i;
+
if (prefix != NULL) {
strcpy(*p, prefix);
*p += strlen(*p);
@@ -1067,47 +1089,20 @@ append_entry(char **p, const char *prefix, int type,
*(*p)++ = (perm & 0222) ? 'w' : '-';
*(*p)++ = (perm & 0111) ? 'x' : '-';
} else {
- /* NFS4 ACL perms */
- *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA |
- ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? 'r' : '-';
- *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA |
- ARCHIVE_ENTRY_ACL_ADD_FILE)) ? 'w' : '-';
- *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_EXECUTE)) ? 'x' : '-';
- *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA |
- ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? 'p' : '-';
- *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? 'd' : '-';
- *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? 'D' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? 'a' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? 'A' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? 'R' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? 'W' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_READ_ACL) ? 'c' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_ACL) ? 'C' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? 'o' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? 's' : '-';
+ /* NFSv4 ACL perms */
+ for (i = 0; i < nfsv4_acl_perm_map_size; i++) {
+ if (perm & nfsv4_acl_perm_map[i].perm)
+ *(*p)++ = nfsv4_acl_perm_map[i].c;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*p)++ = '-';
+ }
*(*p)++ = ':';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? 'f' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? 'd' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? 'i' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? 'n' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? 'S' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? 'F' : '-';
- *(*p)++ = (perm &
- ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? 'I' : '-';
+ for (i = 0; i < nfsv4_acl_flag_map_size; i++) {
+ if (perm & nfsv4_acl_flag_map[i].perm)
+ *(*p)++ = nfsv4_acl_flag_map[i].c;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*p)++ = '-';
+ }
*(*p)++ = ':';
switch (type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
@@ -1467,11 +1462,8 @@ ismode_w(const wchar_t *start, const wchar_t *end, int *permset)
static int
is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, int *permset)
{
- const wchar_t *p;
+ const wchar_t *p = start;
- if (start >= end)
- return (0);
- p = start;
while (p < end) {
switch (*p++) {
case L'r':
@@ -1533,11 +1525,8 @@ is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, int *permset)
static int
is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, int *permset)
{
- const wchar_t *p;
+ const wchar_t *p = start;
- if (start >= end)
- return (0);
- p = start;
while (p < end) {
switch(*p++) {
case L'f':
@@ -1945,11 +1934,8 @@ ismode(const char *start, const char *end, int *permset)
static int
is_nfs4_perms(const char *start, const char *end, int *permset)
{
- const char *p;
+ const char *p = start;
- if (start >= end)
- return (0);
- p = start;
while (p < end) {
switch (*p++) {
case 'r':
@@ -2011,11 +1997,8 @@ is_nfs4_perms(const char *start, const char *end, int *permset)
static int
is_nfs4_flags(const char *start, const char *end, int *permset)
{
- const char *p;
+ const char *p = start;
- if (start >= end)
- return (0);
- p = start;
while (p < end) {
switch(*p++) {
case 'f':
diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h
index 9f1955bdbb99..ca77b37810f2 100644
--- a/libarchive/archive_entry.h
+++ b/libarchive/archive_entry.h
@@ -509,6 +509,10 @@ __LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type
* ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and
* "mask" entries.
*
+ * Flags only for archive entries with NFSv4 ACL:
+ * ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for
+ * unset permissions and flags in NFSv4 ACL permission and flag fields
+ *
* Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL:
* ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
* each ACL entry.
@@ -519,6 +523,7 @@ __LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002
#define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004
#define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008
+#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010
__LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *,
ssize_t * /* len */, int /* flags */);
diff --git a/libarchive/archive_entry_acl.3 b/libarchive/archive_entry_acl.3
index 93707d1ff054..c5115f7274d3 100644
--- a/libarchive/archive_entry_acl.3
+++ b/libarchive/archive_entry_acl.3
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 27, 2016
+.Dd February 15, 2017
.Dt ARCHIVE_ENTRY_ACL 3
.Os
.Sh NAME
@@ -390,6 +390,13 @@ Prefix each default ACL entry with the word
The mask and other ACLs don not contain a double colon.
.El
.Pp
+The following flags are effecive only on NFSv4 ACL:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_COMPACT
+Do not output minus characters for unset permissions and flags in NFSv4 ACL
+permission and flag fields.
+.El
+.Pp
The following flags are effective on both POSIX.1e and NFSv4 ACL:
.Bl -tag -offset indent -compact -width ARCHIV
.It Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c
index 8fb969a65434..b9cd8da9017f 100644
--- a/libarchive/archive_read_disk_entry_from_file.c
+++ b/libarchive/archive_read_disk_entry_from_file.c
@@ -618,9 +618,9 @@ setup_acls(struct archive_read_disk *a,
/*
* Translate system ACL permissions into libarchive internal structure
*/
-static struct {
- int archive_perm;
- int platform_perm;
+static const struct {
+ const int archive_perm;
+ const int platform_perm;
} acl_perm_map[] = {
#if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */
{ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE},
@@ -687,9 +687,9 @@ static struct {
/*
* Translate system NFSv4 inheritance flags into libarchive internal structure
*/
-static struct {
- int archive_inherit;
- int platform_inherit;
+static const struct {
+ const int archive_inherit;
+ const int platform_inherit;
} acl_inherit_map[] = {
#if HAVE_SUN_ACL /* Solaris ACL inheritance flags */
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE},
@@ -882,7 +882,7 @@ sun_acl_is_trivial(acl_t *acl, mode_t mode, int *trivialp)
/*
* POSIX.1e ACLs marked with ACL_IS_TRIVIAL are compatible with
* FreeBSD acl_is_trivial_np(). On Solaris they have 4 entries,
- * incuding mask.
+ * including mask.
*/
if (acl->acl_type == ACLENT_T) {
if (acl->acl_cnt == 4)
diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c
index c8a9c148d97b..08bcf1f537cc 100644
--- a/libarchive/archive_read_support_format_zip.c
+++ b/libarchive/archive_read_support_format_zip.c
@@ -452,26 +452,38 @@ process_extra(struct archive_read *a, const char *p, size_t extra_length, struct
/* Zip64 extended information extra field. */
zip_entry->flags |= LA_USED_ZIP64;
if (zip_entry->uncompressed_size == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->uncompressed_size =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit uncompressed size");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->uncompressed_size = t;
offset += 8;
datasize -= 8;
}
if (zip_entry->compressed_size == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->compressed_size =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit compressed size");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->compressed_size = t;
offset += 8;
datasize -= 8;
}
if (zip_entry->local_header_offset == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->local_header_offset =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit local header offset");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->local_header_offset = t;
offset += 8;
datasize -= 8;
}
@@ -1156,11 +1168,18 @@ zip_read_data_none(struct archive_read *a, const void **_buff,
|| (zip->hctx_valid
&& zip->entry->aes_extra.vendor == AES_VENDOR_AE_2))) {
if (zip->entry->flags & LA_USED_ZIP64) {
+ uint64_t compressed, uncompressed;
zip->entry->crc32 = archive_le32dec(p + 4);
- zip->entry->compressed_size =
- archive_le64dec(p + 8);
- zip->entry->uncompressed_size =
- archive_le64dec(p + 16);
+ compressed = archive_le64dec(p + 8);
+ uncompressed = archive_le64dec(p + 16);
+ if (compressed > INT64_MAX || uncompressed > INT64_MAX) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Overflow of 64-bit file sizes");
+ return ARCHIVE_FAILED;
+ }
+ zip->entry->compressed_size = compressed;
+ zip->entry->uncompressed_size = uncompressed;
zip->unconsumed = 24;
} else {
zip->entry->crc32 = archive_le32dec(p + 4);
@@ -1437,9 +1456,18 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
zip->unconsumed = 4;
}
if (zip->entry->flags & LA_USED_ZIP64) {
+ uint64_t compressed, uncompressed;
zip->entry->crc32 = archive_le32dec(p);
- zip->entry->compressed_size = archive_le64dec(p + 4);
- zip->entry->uncompressed_size = archive_le64dec(p + 12);
+ compressed = archive_le64dec(p + 4);
+ uncompressed = archive_le64dec(p + 12);
+ if (compressed > INT64_MAX || uncompressed > INT64_MAX) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Overflow of 64-bit file sizes");
+ return ARCHIVE_FAILED;
+ }
+ zip->entry->compressed_size = compressed;
+ zip->entry->uncompressed_size = uncompressed;
zip->unconsumed += 20;
} else {
zip->entry->crc32 = archive_le32dec(p);
diff --git a/libarchive/archive_write_disk_acl.c b/libarchive/archive_write_disk_acl.c
index 311aebf0331f..144ab7e72e1b 100644
--- a/libarchive/archive_write_disk_acl.c
+++ b/libarchive/archive_write_disk_acl.c
@@ -101,7 +101,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT,
"default");
#endif /* !HAVE_SUN_ACL */
- /* Simultaeous POSIX.1e and NFSv4 is not supported */
+ /* Simultaneous POSIX.1e and NFSv4 is not supported */
return (ret);
}
#endif /* !HAVE_DARWIN_ACL */
@@ -119,9 +119,9 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
/*
* Translate system ACL permissions into libarchive internal structure
*/
-static struct {
- int archive_perm;
- int platform_perm;
+static const struct {
+ const int archive_perm;
+ const int platform_perm;
} acl_perm_map[] = {
#if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */
{ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE},
@@ -188,9 +188,9 @@ static struct {
/*
* Translate system NFSv4 inheritance flags into libarchive internal structure
*/
-static struct {
- int archive_inherit;
- int platform_inherit;
+static const struct {
+ const int archive_inherit;
+ const int platform_inherit;
} acl_inherit_map[] = {
#if HAVE_SUN_ACL /* Solaris NFSv4 inheritance flags */
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE},
diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c
index cb0e5c31598c..6a301ac2d196 100644
--- a/libarchive/archive_write_set_format_pax.c
+++ b/libarchive/archive_write_set_format_pax.c
@@ -1166,7 +1166,8 @@ archive_write_pax_header(struct archive_write *a,
if ((acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
- ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA);
+ ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA |
+ ARCHIVE_ENTRY_ACL_STYLE_COMPACT);
if (ret == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
}
diff --git a/libarchive/test/test_acl_pax_nfs4.tar.uu b/libarchive/test/test_acl_pax_nfs4.tar.uu
index 6a41557ff01a..ffc5cc279f31 100644
--- a/libarchive/test/test_acl_pax_nfs4.tar.uu
+++ b/libarchive/test/test_acl_pax_nfs4.tar.uu
@@ -1,8 +1,8 @@
begin 644 test_acl_pax_nfs4.tar
M4&%X2&5A9&5R+V9I;&4`````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M`````````````#`P,#<W-R``,#`P,#`P(``P,#`P,#`@`#`P,#`P,#`P,C`R
-M(#`P,#`P,#`P,#`P(#`Q,C`P,0`@>```````````````````````````````
+M`````````````#`P,#<W-R``,#`P,#`P(``P,#`P,#`@`#`P,#`P,#`P,3,R
+M(#`P,#`P,#`P,#`P(#`Q,C`P,P`@>```````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!U<W1A<@`P,```````
M````````````````````````````````````````````````````````````
@@ -10,10 +10,10 @@ M```````````````````P,#`P,#`@`#`P,#`P,"``````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M```````````````````````Q,S`@4T-(24Q9+F%C;"YA8V4];W=N97)`.G)W
-M>'`M+6%!4E=C0V]S.BTM+2TM+2TZ86QL;W<L9W)O=7!`.G)W+7`M+6$M4BUC
-M+2US.BTM+2TM+2TZ86QL;W<L979E<GEO;F5`.G(M+2TM+6$M4BUC+2US.BTM
-M+2TM+2TZ86QL;W<*````````````````````````````````````````````
+M```````````````````````Y,"!30TA)3%DN86-L+F%C93UO=VYE<D`Z<G=X
+M<&%!4E=C0V]S.CIA;&QO=RQG<F]U<$`Z<G=P85)C<SHZ86QL;W<L979E<GEO
+M;F5`.G)A4F-S.CIA;&QO=PH`````````````````````````````````````
+M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
@@ -36,7 +36,7 @@ M````````````````````````````````````````````````````````````
M````````4&%X2&5A9&5R+V9I;&4`````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````#`P,#<W-R``,#`P,#`P(``P,#`P,#`@`#`P,#`P
-M,#`P-#`V(#`P,#`P,#`P,#`P(#`Q,C`P-P`@>```````````````````````
+M,#`P,C4V(#`P,#`P,#`P,#`P(#`Q,C`Q,@`@>```````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````!U<W1A<@`P
M,```````````````````````````````````````````````````````````
@@ -44,13 +44,13 @@ M```````````````````````````P,#`P,#`@`#`P,#`P,"``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M```````````````````````````````R-C(@4T-(24Q9+F%C;"YA8V4];W=N
-M97)`.G)W+7`M+6%!4E=C0V]S.BTM+2TM+2TZ86QL;W<L=7-E<CIU<V5R-S<Z
-M<BTM+2TM82U2+6,M+7,Z+2TM+2TM23IA;&QO=SHW-RQU<V5R.G5S97(W.#IR
-M=W@M+2TM+2TM+2TM+3HM+2TM+2TM.F1E;GDZ-S@L9W)O=7!`.G)W+7`M+6$M
-M4BUC+2US.BTM+2TM+2TZ86QL;W<L9W)O=7`Z9W)O=7`W.#HM=RUP+2TM02U7
-M+4-O+3HM+2TM+2TM.F1E;GDZ-S@L979E<GEO;F5`.G(M+2TM+6$M4BUC+2US
-M.BTM+2TM+2TZ86QL;W<*````````````````````````````````````````
+M```````````````````````````````Q-S0@4T-(24Q9+F%C;"YA8V4];W=N
+M97)`.G)W<&%!4E=C0V]S.CIA;&QO=RQU<V5R.G5S97(W-SIR85)C<SI).F%L
+M;&]W.C<W+'5S97(Z=7-E<C<X.G)W>#HZ9&5N>3HW."QG<F]U<$`Z<G=P85)C
+M<SHZ86QL;W<L9W)O=7`Z9W)O=7`W.#IW<$%70V\Z.F1E;GDZ-S@L979E<GEO
+M;F5`.G)A4F-S.CIA;&QO=PH`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
@@ -70,7 +70,7 @@ M````````````````````````````````````````````````````````````
M````````````````4&%X2&5A9&5R+V9I;&4`````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````#`P,#<W-R``,#`P,#`P(``P,#`P,#`@
-M`#`P,#`P,#`P-#$P(#`P,#`P,#`P,#`P(#`Q,C`P,@`@>```````````````
+M`#`P,#`P,#`P,C8R(#`P,#`P,#`P,#`P(#`Q,C`P-P`@>```````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````````````!U
M<W1A<@`P,```````````````````````````````````````````````````
@@ -78,13 +78,13 @@ M```````````````````````````````````P,#`P,#`@`#`P,#`P,"``````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M```````````````````````````````````````R-C0@4T-(24Q9+F%C;"YA
-M8V4];W=N97)`.G)W>'`M+6%!4E=C0V]S.BTM+2TM+2TZ86QL;W<L=7-E<CIU
-M<V5R-S<Z<G<M<"TM82U2+6,M;W,Z+2TM+2TM+3IA;&QO=SHW-RQU<V5R.G5S
-M97(W-SHM=RUP+2TM+2TM+2TM+3HM+2TM4RTM.F%U9&ET.C<W+&=R;W5P0#IR
-M=RUP+2UA+5(M8RTM<SHM+2TM+2TM.F%L;&]W+&=R;W5P.F=R;W5P-S@Z<BTM
-M+2TM82U2+6,M+2TZ+2TM+2U&+3IA;&%R;3HW."QE=F5R>6]N94`Z<BTM+2TM
-M82U2+6,M+7,Z+2TM+2TM+3IA;&QO=PH`````````````````````````````
+M```````````````````````````````````````Q-S@@4T-(24Q9+F%C;"YA
+M8V4];W=N97)`.G)W>'!A05)78T-O<SHZ86QL;W<L=7-E<CIU<V5R-S<Z<G=P
+M85)C;W,Z.F%L;&]W.C<W+'5S97(Z=7-E<C<W.G=P.E,Z875D:70Z-S<L9W)O
+M=7!`.G)W<&%28W,Z.F%L;&]W+&=R;W5P.F=R;W5P-S@Z<F%28SI&.F%L87)M
+M.C<X+&5V97)Y;VYE0#IR85)C<SHZ86QL;W<*````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
diff --git a/libarchive/test/test_acl_platform_posix1e.c b/libarchive/test/test_acl_platform_posix1e.c
index f3e1722f711d..1d55a33eb951 100644
--- a/libarchive/test/test_acl_platform_posix1e.c
+++ b/libarchive/test/test_acl_platform_posix1e.c
@@ -472,7 +472,7 @@ DEFINE_TEST(test_acl_platform_posix1e_read)
return;
}
#if HAVE_SUN_ACL
- /* Check if Solars filesystem supports POSIX.1e ACLs */
+ /* Check if Solaris filesystem supports POSIX.1e ACLs */
n = facl_get(fd, 0, &acl);
if (n != 0)
close(fd);
diff --git a/libarchive/test/test_acl_text.c b/libarchive/test/test_acl_text.c
index 23d991e40338..f3d2b10edcfe 100644
--- a/libarchive/test/test_acl_text.c
+++ b/libarchive/test/test_acl_text.c
@@ -221,7 +221,14 @@ const char* acltext[] = {
"group:group78:r-----a-R-c---:------I:allow:78\n"
"owner@:rwxp--aARWcCo-:-------:allow\n"
"group@:rw-p--a-R-c---:-------:allow\n"
- "everyone@:r-----a-R-c--s:-------:allow"
+ "everyone@:r-----a-R-c--s:-------:allow",
+
+ "user:user77:rwpaRco::allow:77\n"
+ "user:user101:wpdD:fdin:deny:101\n"
+ "group:group78:raRc:I:allow:78\n"
+ "owner@:rwxpaARWcCo::allow\n"
+ "group@:rwpaRc::allow\n"
+ "everyone@:raRcs::allow"
};
static wchar_t *
@@ -458,5 +465,9 @@ DEFINE_TEST(test_acl_to_text)
/* NFSv4 ACLs like "getfacl -i" on FreeBSD */
compare_acl_text(ae, ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID, acltext[10]);
+ /* NFSv4 ACLs like "getfacl -i" on FreeBSD with stripped minus chars */
+ compare_acl_text(ae, ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
+ ARCHIVE_ENTRY_ACL_STYLE_COMPACT, acltext[11]);
+
archive_entry_free(ae);
}