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>
Peter Wu [Fri, 23 Dec 2016 11:45:43 +0000 (12:45 +0100)]
Issue #822: Try harder to detect directories in zip archives
Assume that anything with a trailing slash is a directory. This avoids
creating regular files when a directory is expected and could occur
when the External File Attributes (EFA) field in the Central Directory
contains bogus values:
- Jar file: observed to have OS MS-DOS (0) and EFA 0.
- dex2jar-2.0.zip: observed to have OS Unix (3), but EFA 0xffff0010.
After this patch, bsdtar tv still shows mode drwsrwsrwt, but at least
it successfully creates a directory instead of a regular file.
A test case has been added for the first case (based on
test_read_format_zip_nofiletype).
Ngie Cooper [Sun, 11 Dec 2016 02:32:11 +0000 (18:32 -0800)]
Fix memory management issues
1. Assert that `f` isn't NULL to strengthen the guarantee that
it's valid.
2. Assert that `rawimage` isn't NULL to strengthen the guarantee
that it's valid.
3. Do not leak `tmp`
4. Free `rawimage` in all instances; NULL out the value to avoid
double-free'ing it by accident
Ngie Cooper [Sun, 11 Dec 2016 02:17:01 +0000 (18:17 -0800)]
- Only allocate `mine` when level == 1 to clarify its lifetime and
leak the value less often.
- Only free mine->copy_buff when mine != NULL to avoid segfaults if
memory_read_close(..) is called with client_data == NULL.
This should either address or mitigate the issue reported with Coverity
(CID # 1331663)
Ngie Cooper [Sun, 11 Dec 2016 01:59:03 +0000 (17:59 -0800)]
Fix several coverity issues with test_read_append_filter_wrong_program
1. Ignore errors from fsetpos to mute complaint from Coverity
2. Make sure the first dup2 succeeds to quell complaints from Coverity
about negative values being passed into the subsequent dup2 call.
3. Unconditionally close fd [3]. Although it's unlikely for freopen to
fail, it can happen.. closing fd shouldn't be contingent on freopen's
success.
Ngie Cooper [Sun, 11 Dec 2016 00:15:18 +0000 (16:15 -0800)]
Increase the size of buff by 1 and adjust the readlink(2) call to
subtract the buffer len by 1 to account for the needed space for a
NUL terminator, as readlink isn't guaranteed to provide one