The LZX decoder flattens the Huffman tree into a table, but wanted to
limit it to 1k elements to reduce L1 pressure. Since the logic for
filling was flawed and performance argument points more to a bad index
logic, remove the tree logic.
Issue #901: Sparse files with long name get renamed.
The original ustar header has a 100 character limit for the file name.
With the POSIX interchange format, an additional header attribute
contains the full path and libarchive tries to cut it to something
sensible. The GNU sparse file extension on the other hand also likes to
mangle the ustar header field to include a marker and contains yet
another attribute for the original path. If the name was truncated
earlier, this attribute would get the incorrect truncated name.
Martin Matuska [Wed, 29 Mar 2017 21:16:02 +0000 (23:16 +0200)]
Report names of extended attributes that could not be restored
Remove xattr namespace limitations for AIX and Darwin
On Linux, skip all known ACL extended attributes and obsolete xfsroot
Mike Frysinger [Thu, 23 Mar 2017 06:26:52 +0000 (02:26 -0400)]
constify variables more
A bunch of constant variables/tables are missing const markings.
Adding them allows moving more data to the read only sections, and
ends up shrinking writable data a bit by 1k on x86_64/Linux. Not
much, but still nice.
Martin Matuska [Thu, 23 Mar 2017 14:27:59 +0000 (15:27 +0100)]
Improve extended attribute support
Mac OS X changes:
- add support for extended file attributes via sys/xattr.h
- when extracting an archive entry that has mac_metadata and
mac_metadata is requested to be extracted, extended attributes
are restored only from mac_metadata.
- by default, extended attributes are stored both in mac_metadata and
SCHILY.xattr/LIBARCHIVE.xattr. This is subject to review and change.
To match behavior on other platforms, store extended attributes on
FreeBSD with extattr_set_link() if no fd is provided.
Detection of extended attributes support in configure stage has been
rewritten.
Added xattr platform test to libarchive and xattrs option test to bsdtar.
Martin Matuska [Wed, 15 Mar 2017 22:27:48 +0000 (23:27 +0100)]
Add NFSv4 ACL support for Linux via librichacl
Richacls are interpreted as NFSv4 ACLs and stored in archive_acl (Richacl
flags and masks are not stored). Analog to mac_metadata, NFSv4 ACLs do not
get extracted when the extraction of extended attributes is enabled and the
"trusted.richacl" extended attribute is present.
RichACL masks and are calculated from file mode on extraction.
mac_metadata acl check has been moved in the code to be together with the
richacl check.
Martin Matuska [Mon, 13 Mar 2017 14:49:38 +0000 (15:49 +0100)]
Move platform-specific ACL code to individual source files.
This makes the code much more readable and eases the addition of new
ACL implementatons in the future.
Additional changes:
- most of ACL detection is now done at configure stage
- configuration now reports what ACL was detected
- NFSv4 ACL tests now test INHERIT_ONLY and NO_PROPAGATE_INHERIT
Tim Kientzle [Sat, 11 Mar 2017 23:30:38 +0000 (15:30 -0800)]
Break out the library version functions into a separate source file.
This breaks a static dependency on libbz2. Before this,
any use of libarchive that ended up linking archive_util.c would
require libbz2. (And since archive_util.c contains a bunch of
very core functions, this is pretty much everybody.)
Now you only require libbz2 if you request library version information
or actually use some other feature that involves bzip2 support.
Note that most of the libraries provide version information via
compile-time macros -- libbz2 only provides such information via
a function call, which is why this issue only arises with libbz2.
In particular, the libbz2 version reports the version that we
are currently linked against; the other library versions report
the version we were compiled with (which may not be the same as
what we are currently using).
Tim Kientzle [Sat, 11 Mar 2017 23:13:23 +0000 (15:13 -0800)]
OSS-Fuzz Issue 806: integer overflow in mtree_atol10
Rework the mtree_atol10 integer parser so it can parse
INT64_MIN without overflowing the intermediate value.
While here, make this function behave a little more predictably for
too-large input: It now always advances the pointer to the first
non-digit character.
Martin Matuska [Mon, 6 Mar 2017 23:50:12 +0000 (00:50 +0100)]
Darwin ACL: avoid using mbr_identifier_to_uuid()
Use mbr_uid_to_uuid() and mbr_gid_to_uuid() for backwards compatibility
instead. These functions have been introduced together with membership.h.
Martin Matuska [Thu, 2 Mar 2017 13:19:38 +0000 (14:19 +0100)]
New tar test: test_option_acls
Add sunacl_get() and setTestAcl() to common test code
Test for membership.h on Mac OS X and make it a requirement for ACLs
Phillip Berndt [Mon, 20 Feb 2017 16:45:56 +0000 (17:45 +0100)]
seekable zip backend: Accept files with valid ZIP64 EOCD headers
Previously, a ZIP64 file needed to have a valid classic EOCD header.
This is not the case at least for archives generated by PHPZipStreamer.
This commit allows for a bit more than necessary: While PHPZipStreamer
sets the classic EOCD header to all -1's, the bidding function now
succeeds also if the EOCD header values have arbitrary values, as long
as the ZIP64 EOCD header seems plausible. This simplifies the logic and
should not do any harm in practice.