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
Stefan Berger [Fri, 6 May 2016 20:24:27 +0000 (16:24 -0400)]
Write xattr as LIBARCHIVE.xattr and/or SCHILY.xattr
Introduce flags to write extended attributes either with the prefix
LIBARCHIVE.xattr or SCHIL.xattr. For the existing bsdtar formats
'pax' and 'posix' we now choose to write both. This enables backwards
compatibility and allow us to exchange tar files carrying extended
attributes with GNU tar.
Stefan Berger [Fri, 6 May 2016 18:34:01 +0000 (14:34 -0400)]
Introduce add_pax_attr_binary and have add_pax_attr call it
To prepare for being able to write binary values in the PAX extended
header, introduce add_pax_attr_binary and have add_pax_attr call it
by determining the length of the string being passed.
Stefan Berger [Fri, 6 May 2016 19:20:30 +0000 (15:20 -0400)]
Introduce archive_array_append to append a raw array to an archive_string
Introduce archive_array_append to append a raw array to an archive_string.
We need this for binary values in the PAX header.
We can append arbitray data to the archive_string since its string append
operations simply append at the end pointer rather than walking the string
and appending at the zero byte.
Stefan Berger [Mon, 25 Apr 2016 14:41:01 +0000 (10:41 -0400)]
Add support for extracting SCHIL.xattr extended attributes
This patch adds support for extracting SCHIL.xattr extended attributes
found in the PAX extended header. Since some of the attributes found
there can be binary data, we extend the parser for support of binary data.
One example for an attribute with binary data is SCHILY.xattr.security.ima,
which contains a digital signature.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>