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.
Brad King [Fri, 24 Feb 2017 12:26:35 +0000 (07:26 -0500)]
Define bcrypt macro not available in Win 7 SDK
VS 2010 comes with the Win 7 SDK and its bcrypt.h does not define the
`BCRYPT_HASH_REUSABLE_FLAG` macro. Provide the definition locally if
it is not available.
Martin Matuska [Fri, 24 Feb 2017 01:33:40 +0000 (02:33 +0100)]
Do not archive NFSv4 ACLs on Mac OS X by default.
This avoids wrtiting ACLs to tar files twice. Preferred method is
via copyfile(3) (tar option --mac-metadata). If user wants to create
archives with portable NFSv4 ACLs only (SCHILY.acl.ace header with no
GUID data) the --acls and --no-mac-metadata options must be specified
on the command line.
In the manual page be more specific which types of ACLs are stored
with --acls and --mac-metadata options.
Martin Matuska [Thu, 23 Feb 2017 21:56:40 +0000 (22:56 +0100)]
tar: add new options to allow fine-tuning of --preserve-permissions
Allow enabling and disabling reading or writing of:
Access Control Lists (--acls, --no-acls)
Extended file flags (--fflags, --no-fflags)
Extended attributes (--xattrs, --no-xattrs)
Mac OS X metadata in AppleDouble (--mac-metadata, --no-mac-metadata)
Make --disable-copyfile an alias to --no-mac-metadata.
Martin Matuska [Sat, 18 Feb 2017 21:38:38 +0000 (22:38 +0100)]
disk read: improve path handling for acls, xattrs and mac_metadata
- Do not execute pathname code at all if we have a fd. The only exception
is setup_acls() for directory entries where default ACLs can be
retrieved only with acl_get_file() - e.g. on Linux.
- Do not fail if tree_enter_working_dir() fails. Fallback to
archive_entry_pathname() instead and try with path-based functions.
- Do not fail if open_on_current_dir() fails. Try with path-based
functions.
- Pass pathname to setup_xattr() to avoid execution of duplicate code.
Martin Matuska [Sat, 18 Feb 2017 01:36:20 +0000 (02:36 +0100)]
disk read: rework handling of paths for acls, xattrs and mac_metadata
If path is read from archive_entry_sourcepath(), always enter tree
working dir. If path is read from archive_entry_pathname(), don't.
This prevents reading acls, xattrs or mac_metadata from wrong files
or not at all if no fd is provided (e.g. default ACLs on Linux can
be read only from a pathname).
Martin Matuska [Wed, 15 Feb 2017 19:43:54 +0000 (20:43 +0100)]
New archive_acl_to_text() style flag: ARCHIVE_ENTRY_ACL_STYLE_COMPACT
- outputs NFSv4 permission and flags fields without minus characters
Use new compact format as default for the SCHILY.acl.ace pax header
Tim Kientzle [Sun, 12 Feb 2017 20:39:45 +0000 (12:39 -0800)]
Zip reader: Guard against 64-bit overflow for file sizes and offsets
We use `uint64_t` consistently when parsing values from the archive
but then assign them to `int64_t` variables. This can result in
nonsensical negative file sizes or offsets in some cases.
Martin Matuska [Sun, 5 Feb 2017 01:29:14 +0000 (02:29 +0100)]
WARC reader: additonal sanity checks
- only WARC versions 0.12 to 1.0 are supported
- do not probe for unsupported types
- do not accept spaces inside URI
- verify that URI is CRLF terminated
Martin Matuska [Sun, 29 Jan 2017 14:51:02 +0000 (15:51 +0100)]
Add NFSv4 ACL support for Mac OS X
Mac OS X supports user and group NFSv4-style ACLs only (extended ACLs).
File-mode ACLs (owner@, group@ and everyone@) are not supported.
Behavior on Mac OS X:
- libarchive does not store GUID of Mac OS X extended ACLs. Only
uid or gid (and the corresponding user or group name) are stored.
- When extracting an archive entry that has mac_metadata, NFSv4 ACLs
are not written to disk (mac_metadata already contains ACLs)
- When writing ACLs to disk from an archive entry with NFSv4 ACLs
owner@, group@ and everyone@ ACLs are ignored. User and group ids
are converted to a GUID (this may lead to a fabricated GUID if
the user or group ID is not present on the system)
- When reading ACL from disk and there is at least one user or group
extended ACL entry, owner@, group@ and everyone@ entries mirroring
the file mode are added to the end of the entry's ACL.
Martin Matuska [Wed, 18 Jan 2017 23:40:36 +0000 (00:40 +0100)]
Replace archive_acl_count() with archive_acl_types() where possible
Report all types of ACLs in archive_entry_strmode()
Simplify archive_write_disk_set_acls()
Martin Matuska [Tue, 17 Jan 2017 14:04:43 +0000 (15:04 +0100)]
Use HAVE_ACL_TYPE_NFS4 instead of checking against system constant
Verify ACL types in test_acl_platform_nfs4.c
Add missing inheritance flag to test_acl_platform_nfs4.c
Ngie Cooper [Tue, 13 Dec 2016 08:11:51 +0000 (00:11 -0800)]
- Don't check for `mine` being NULL; it's already been dereferenced
- Don't leak `fd`; close when done
- Remove useless frees (one would just involve freeing a NULL pointer;
the other would involve freeing memory which is free'd elsewhere)
Martin Matuska [Sun, 15 Jan 2017 22:51:46 +0000 (23:51 +0100)]
Rework sun_acl_is_trivial() once again
Make the NFSv4 ACL part more readable
Declare constants as constants
ACE_DELETE_CHILD for write perms was introduced by illumos in
illumos/illumos-gate@d316fffc9c361532a482208561bbb614dac7f916
The best solution is to treat both types of write perms as trivial
Martin Matuska [Sun, 15 Jan 2017 00:44:34 +0000 (01:44 +0100)]
Support extracting NFSv4 ACLs from Solaris tar archives
Fix read of default ACLs from Solaris tar archives
Update Solaris tar ACL test to test all ACL types