MFV r311899:
Sync libarchive with vendor. Vendor bugfixes: #691: Support for SCHILY.xattr extended attributes #854: Spelling fixes Multiple fixes in ACL code: - prefer acl_set_fd_np() to acl_set_fd() - if acl_set_fd_np() fails, do no fallback to acl_set_file() - do not warn if trying to write ACLs to a filesystem without ACL support - fix id handling in archive_acl_(from_to)_text*() for NFSv4 ACLs MFC after: 1 week X-MFC with: r310866
This commit is contained in:
commit
2dbf8c4a76
@ -786,7 +786,8 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
|
||||
} else if (tag == ARCHIVE_ENTRY_ACL_USER
|
||||
|| tag == ARCHIVE_ENTRY_ACL_GROUP) {
|
||||
append_id_w(wp, id);
|
||||
id = -1;
|
||||
if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
|
||||
id = -1;
|
||||
}
|
||||
/* Solaris style has no second colon after other and mask */
|
||||
if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
|
||||
@ -1042,7 +1043,8 @@ append_entry(char **p, const char *prefix, int type,
|
||||
} else if (tag == ARCHIVE_ENTRY_ACL_USER
|
||||
|| tag == ARCHIVE_ENTRY_ACL_GROUP) {
|
||||
append_id(p, id);
|
||||
id = -1;
|
||||
if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
|
||||
id = -1;
|
||||
}
|
||||
/* Solaris style has no second colon after other and mask */
|
||||
if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
|
||||
@ -1328,6 +1330,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text,
|
||||
tag == ARCHIVE_ENTRY_ACL_GROUP) {
|
||||
n = 1;
|
||||
name = field[1];
|
||||
isint_w(name.start, name.end, &id);
|
||||
} else
|
||||
n = 0;
|
||||
|
||||
@ -1799,6 +1802,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const char *text,
|
||||
tag == ARCHIVE_ENTRY_ACL_GROUP) {
|
||||
n = 1;
|
||||
name = field[1];
|
||||
isint(name.start, name.end, &id);
|
||||
} else
|
||||
n = 0;
|
||||
|
||||
|
@ -526,6 +526,11 @@ setup_acls(struct archive_read_disk *a,
|
||||
|
||||
/* Only directories can have default ACLs. */
|
||||
if (S_ISDIR(archive_entry_mode(entry))) {
|
||||
#if HAVE_ACL_GET_FD_NP
|
||||
if (*fd >= 0)
|
||||
acl = acl_get_fd_np(*fd, ACL_TYPE_DEFAULT);
|
||||
else
|
||||
#endif
|
||||
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
|
||||
if (acl != NULL) {
|
||||
r = translate_acl(a, entry, acl,
|
||||
@ -581,7 +586,10 @@ static struct {
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}
|
||||
};
|
||||
#endif
|
||||
static int
|
||||
|
@ -675,7 +675,7 @@ setup_suitable_read_buffer(struct archive_read_disk *a)
|
||||
asize = cf->min_xfer_size;
|
||||
|
||||
/* Increase a buffer size up to 64K bytes in
|
||||
* a proper incremant size. */
|
||||
* a proper increment size. */
|
||||
while (asize < 1024*64)
|
||||
asize += incr;
|
||||
/* Take a margin to adjust to the filesystem
|
||||
@ -1656,7 +1656,7 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
archive_set_error(&a->archive, errno, "statvfs failed");
|
||||
return (ARCHIVE_FAILED);
|
||||
} else if (xr == 1) {
|
||||
/* Usuall come here unless NetBSD supports _PC_REC_XFER_ALIGN
|
||||
/* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN
|
||||
* for pathconf() function. */
|
||||
t->current_filesystem->xfer_align = sfs.f_frsize;
|
||||
t->current_filesystem->max_xfer_size = -1;
|
||||
@ -1944,7 +1944,7 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
if (nm == -1)
|
||||
# endif /* _PC_NAME_MAX */
|
||||
/*
|
||||
* Some sysmtes (HP-UX or others?) incorrectly defined
|
||||
* Some systems (HP-UX or others?) incorrectly defined
|
||||
* NAME_MAX macro to be a smaller value.
|
||||
*/
|
||||
# if defined(NAME_MAX) && NAME_MAX >= 255
|
||||
|
@ -180,7 +180,7 @@ lz4_reader_bid(struct archive_read_filter_bidder *self,
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
BD = buffer[5];
|
||||
/* A block maximum size shuld be more than 3. */
|
||||
/* A block maximum size should be more than 3. */
|
||||
if (((BD & 0x70) >> 4) < 4)
|
||||
return (0);
|
||||
/* Reserved bits must be "0". */
|
||||
@ -417,7 +417,7 @@ lz4_filter_read_descriptor(struct archive_read_filter *self)
|
||||
/* Reserved bits must be zero. */
|
||||
if (bd & 0x8f)
|
||||
goto malformed_error;
|
||||
/* Get a maxinum block size. */
|
||||
/* Get a maximum block size. */
|
||||
switch (read_buf[1] >> 4) {
|
||||
case 4: /* 64 KB */
|
||||
state->flags.block_maximum_size = 64 * 1024;
|
||||
@ -627,7 +627,7 @@ lz4_filter_read_default_stream(struct archive_read_filter *self, const void **p)
|
||||
|
||||
if (state->stage == SELECT_STREAM) {
|
||||
state->stage = READ_DEFAULT_STREAM;
|
||||
/* First, read a desciprtor. */
|
||||
/* First, read a descriptor. */
|
||||
if((ret = lz4_filter_read_descriptor(self)) != ARCHIVE_OK)
|
||||
return (ret);
|
||||
state->stage = READ_DEFAULT_BLOCK;
|
||||
|
@ -436,7 +436,7 @@ lzop_filter_read(struct archive_read_filter *self, const void **p)
|
||||
}
|
||||
|
||||
/*
|
||||
* Drive lzo uncompresison.
|
||||
* Drive lzo uncompression.
|
||||
*/
|
||||
out_size = (lzo_uint)state->uncompressed_size;
|
||||
r = lzo1x_decompress_safe(b, (lzo_uint)state->compressed_size,
|
||||
|
@ -552,7 +552,7 @@ skip_sfx(struct archive_read *a, ssize_t bytes_avail)
|
||||
/*
|
||||
* If bytes_avail > SFX_MIN_ADDR we do not have to call
|
||||
* __archive_read_seek() at this time since we have
|
||||
* alredy had enough data.
|
||||
* already had enough data.
|
||||
*/
|
||||
if (bytes_avail > SFX_MIN_ADDR)
|
||||
__archive_read_consume(a, SFX_MIN_ADDR);
|
||||
@ -760,7 +760,7 @@ archive_read_format_7zip_read_header(struct archive_read *a,
|
||||
symsize += size;
|
||||
}
|
||||
if (symsize == 0) {
|
||||
/* If there is no synname, handle it as a regular
|
||||
/* If there is no symname, handle it as a regular
|
||||
* file. */
|
||||
zip_entry->mode &= ~AE_IFMT;
|
||||
zip_entry->mode |= AE_IFREG;
|
||||
@ -3288,7 +3288,7 @@ read_stream(struct archive_read *a, const void **buff, size_t size,
|
||||
return (r);
|
||||
|
||||
/*
|
||||
* Skip the bytes we alrady has skipped in skip_stream().
|
||||
* Skip the bytes we already has skipped in skip_stream().
|
||||
*/
|
||||
while (skip_bytes) {
|
||||
ssize_t skipped;
|
||||
@ -3506,7 +3506,7 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
||||
/* Allocate memory for the decorded data of a sub
|
||||
/* Allocate memory for the decoded data of a sub
|
||||
* stream. */
|
||||
b[i] = malloc((size_t)zip->folder_outbytes_remaining);
|
||||
if (b[i] == NULL) {
|
||||
@ -3591,7 +3591,7 @@ skip_stream(struct archive_read *a, size_t skip_bytes)
|
||||
if (zip->folder_index == 0) {
|
||||
/*
|
||||
* Optimization for a list mode.
|
||||
* Avoid unncecessary decoding operations.
|
||||
* Avoid unnecessary decoding operations.
|
||||
*/
|
||||
zip->si.ci.folders[zip->entry->folderIndex].skipped_bytes
|
||||
+= skip_bytes;
|
||||
|
@ -322,7 +322,7 @@ struct iso9660 {
|
||||
|
||||
struct archive_string pathname;
|
||||
char seenRockridge; /* Set true if RR extensions are used. */
|
||||
char seenSUSP; /* Set true if SUSP is beging used. */
|
||||
char seenSUSP; /* Set true if SUSP is being used. */
|
||||
char seenJoliet;
|
||||
|
||||
unsigned char suspOffset;
|
||||
|
@ -1711,7 +1711,7 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
|
||||
*/
|
||||
for (;len >= 8; len -= 8) {
|
||||
/* This if statement expects compiler optimization will
|
||||
* remove the stament which will not be executed. */
|
||||
* remove the statement which will not be executed. */
|
||||
#undef bswap16
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
|
||||
# define bswap16(x) _byteswap_ushort(x)
|
||||
|
@ -906,7 +906,7 @@ archive_read_format_rar_read_header(struct archive_read *a,
|
||||
sizeof(rar->reserved2));
|
||||
}
|
||||
|
||||
/* Main header is password encrytped, so we cannot read any
|
||||
/* Main header is password encrypted, so we cannot read any
|
||||
file names or any other info about files from the header. */
|
||||
if (rar->main_flags & MHD_PASSWORD)
|
||||
{
|
||||
|
@ -204,13 +204,14 @@ static int archive_read_format_tar_read_header(struct archive_read *,
|
||||
struct archive_entry *);
|
||||
static int checksum(struct archive_read *, const void *);
|
||||
static int pax_attribute(struct archive_read *, struct tar *,
|
||||
struct archive_entry *, const char *key, const char *value);
|
||||
struct archive_entry *, const char *key, const char *value,
|
||||
size_t value_length);
|
||||
static int pax_attribute_acl(struct archive_read *, struct tar *,
|
||||
struct archive_entry *, const char *, int);
|
||||
static int pax_attribute_xattr(struct archive_entry *, const char *,
|
||||
const char *);
|
||||
static int pax_header(struct archive_read *, struct tar *,
|
||||
struct archive_entry *, char *attr);
|
||||
struct archive_entry *, struct archive_string *);
|
||||
static void pax_time(const char *, int64_t *sec, long *nanos);
|
||||
static ssize_t readline(struct archive_read *, struct tar *, const char **,
|
||||
ssize_t limit, size_t *);
|
||||
@ -1483,7 +1484,7 @@ header_pax_extensions(struct archive_read *a, struct tar *tar,
|
||||
* and then skip any fields in the standard header that were
|
||||
* defined in the pax header.
|
||||
*/
|
||||
err2 = pax_header(a, tar, entry, tar->pax_header.s);
|
||||
err2 = pax_header(a, tar, entry, &tar->pax_header);
|
||||
err = err_combine(err, err2);
|
||||
tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
|
||||
return (err);
|
||||
@ -1564,16 +1565,17 @@ header_ustar(struct archive_read *a, struct tar *tar,
|
||||
*/
|
||||
static int
|
||||
pax_header(struct archive_read *a, struct tar *tar,
|
||||
struct archive_entry *entry, char *attr)
|
||||
struct archive_entry *entry, struct archive_string *in_as)
|
||||
{
|
||||
size_t attr_length, l, line_length;
|
||||
size_t attr_length, l, line_length, value_length;
|
||||
char *p;
|
||||
char *key, *value;
|
||||
struct archive_string *as;
|
||||
struct archive_string_conv *sconv;
|
||||
int err, err2;
|
||||
char *attr = in_as->s;
|
||||
|
||||
attr_length = strlen(attr);
|
||||
attr_length = in_as->length;
|
||||
tar->pax_hdrcharset_binary = 0;
|
||||
archive_string_empty(&(tar->entry_gname));
|
||||
archive_string_empty(&(tar->entry_linkpath));
|
||||
@ -1638,11 +1640,13 @@ pax_header(struct archive_read *a, struct tar *tar,
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
/* Identify null-terminated 'value' portion. */
|
||||
value = p + 1;
|
||||
|
||||
/* Some values may be binary data */
|
||||
value_length = attr + line_length - 1 - value;
|
||||
|
||||
/* Identify this attribute and set it in the entry. */
|
||||
err2 = pax_attribute(a, tar, entry, key, value);
|
||||
err2 = pax_attribute(a, tar, entry, key, value, value_length);
|
||||
if (err2 == ARCHIVE_FATAL)
|
||||
return (err2);
|
||||
err = err_combine(err, err2);
|
||||
@ -1763,6 +1767,20 @@ pax_attribute_xattr(struct archive_entry *entry,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pax_attribute_schily_xattr(struct archive_entry *entry,
|
||||
const char *name, const char *value, size_t value_length)
|
||||
{
|
||||
if (strlen(name) < 14 || (memcmp(name, "SCHILY.xattr.", 13)) != 0)
|
||||
return 1;
|
||||
|
||||
name += 13;
|
||||
|
||||
archive_entry_xattr_add_entry(entry, name, value, value_length);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pax_attribute_acl(struct archive_read *a, struct tar *tar,
|
||||
struct archive_entry *entry, const char *value, int type)
|
||||
@ -1824,7 +1842,7 @@ pax_attribute_acl(struct archive_read *a, struct tar *tar,
|
||||
*/
|
||||
static int
|
||||
pax_attribute(struct archive_read *a, struct tar *tar,
|
||||
struct archive_entry *entry, const char *key, const char *value)
|
||||
struct archive_entry *entry, const char *key, const char *value, size_t value_length)
|
||||
{
|
||||
int64_t s;
|
||||
long n;
|
||||
@ -1961,6 +1979,9 @@ pax_attribute(struct archive_read *a, struct tar *tar,
|
||||
} else if (strcmp(key, "SCHILY.realsize") == 0) {
|
||||
tar->realsize = tar_atol10(value, strlen(value));
|
||||
archive_entry_set_size(entry, tar->realsize);
|
||||
} else if (strncmp(key, "SCHILY.xattr.", 13) == 0) {
|
||||
pax_attribute_schily_xattr(entry, key, value,
|
||||
value_length);
|
||||
} else if (strcmp(key, "SUN.holesdata") == 0) {
|
||||
/* A Solaris extension for sparse. */
|
||||
r = solaris_sparse_parse(a, tar, entry, value);
|
||||
|
@ -88,7 +88,7 @@ typedef enum {
|
||||
WT_RVIS,
|
||||
/* conversion, unsupported */
|
||||
WT_CONV,
|
||||
/* continutation, unsupported at the moment */
|
||||
/* continuation, unsupported at the moment */
|
||||
WT_CONT,
|
||||
/* invalid type */
|
||||
LAST_WT
|
||||
@ -562,7 +562,7 @@ xstrpisotime(const char *s, char **endptr)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* massage TM to fulfill some of POSIX' contraints */
|
||||
/* massage TM to fulfill some of POSIX' constraints */
|
||||
tm.tm_year -= 1900;
|
||||
tm.tm_mon--;
|
||||
|
||||
|
@ -199,7 +199,7 @@ struct zip {
|
||||
struct trad_enc_ctx tctx;
|
||||
char tctx_valid;
|
||||
|
||||
/* WinZip AES decyption. */
|
||||
/* WinZip AES decryption. */
|
||||
/* Contexts used for AES decryption. */
|
||||
archive_crypto_ctx cctx;
|
||||
char cctx_valid;
|
||||
@ -242,7 +242,7 @@ trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
trad_enc_decypt_byte(struct trad_enc_ctx *ctx)
|
||||
trad_enc_decrypt_byte(struct trad_enc_ctx *ctx)
|
||||
{
|
||||
unsigned temp = ctx->keys[2] | 2;
|
||||
return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff;
|
||||
@ -257,7 +257,7 @@ trad_enc_decrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in,
|
||||
max = (unsigned)((in_len < out_len)? in_len: out_len);
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
uint8_t t = in[i] ^ trad_enc_decypt_byte(ctx);
|
||||
uint8_t t = in[i] ^ trad_enc_decrypt_byte(ctx);
|
||||
out[i] = t;
|
||||
trad_enc_update_keys(ctx, t);
|
||||
}
|
||||
@ -710,7 +710,7 @@ process_extra(struct archive_read *a, const char *p, size_t extra_length, struct
|
||||
break;
|
||||
}
|
||||
case 0x9901:
|
||||
/* WinZIp AES extra data field. */
|
||||
/* WinZip AES extra data field. */
|
||||
if (p[offset + 2] == 'A' && p[offset + 3] == 'E') {
|
||||
/* Vendor version. */
|
||||
zip_entry->aes_extra.vendor =
|
||||
@ -1518,7 +1518,7 @@ read_decryption_header(struct archive_read *a)
|
||||
case 0x6720:/* Blowfish */
|
||||
case 0x6721:/* Twofish */
|
||||
case 0x6801:/* RC4 */
|
||||
/* Suuported encryption algorithm. */
|
||||
/* Supported encryption algorithm. */
|
||||
break;
|
||||
default:
|
||||
archive_set_error(&a->archive,
|
||||
@ -1627,7 +1627,7 @@ read_decryption_header(struct archive_read *a)
|
||||
__archive_read_consume(a, 4);
|
||||
|
||||
/*return (ARCHIVE_OK);
|
||||
* This is not fully implemnted yet.*/
|
||||
* This is not fully implemented yet.*/
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
|
||||
"Encrypted file is unsupported");
|
||||
return (ARCHIVE_FAILED);
|
||||
@ -1709,7 +1709,7 @@ init_traditional_PKWARE_decryption(struct archive_read *a)
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize ctx for Traditional PKWARE Decyption.
|
||||
* Initialize ctx for Traditional PKWARE Decryption.
|
||||
*/
|
||||
r = trad_enc_init(&zip->tctx, passphrase, strlen(passphrase),
|
||||
p, ENC_HEADER_SIZE, &crcchk);
|
||||
|
@ -219,6 +219,12 @@ archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)
|
||||
return (as);
|
||||
}
|
||||
|
||||
struct archive_string *
|
||||
archive_array_append(struct archive_string *as, const char *p, size_t s)
|
||||
{
|
||||
return archive_string_append(as, p, s);
|
||||
}
|
||||
|
||||
void
|
||||
archive_string_concat(struct archive_string *dest, struct archive_string *src)
|
||||
{
|
||||
@ -597,7 +603,7 @@ archive_wstring_append_from_mbs(struct archive_wstring *dest,
|
||||
wcs = dest->s + dest->length;
|
||||
/*
|
||||
* We cannot use mbsrtowcs/mbstowcs here because those may convert
|
||||
* extra MBS when strlen(p) > len and one wide character consis of
|
||||
* extra MBS when strlen(p) > len and one wide character consists of
|
||||
* multi bytes.
|
||||
*/
|
||||
while (*mbs && mbs_length > 0) {
|
||||
@ -1248,7 +1254,7 @@ create_sconv_object(const char *fc, const char *tc,
|
||||
sc->cd = iconv_open(tc, fc);
|
||||
if (sc->cd == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) {
|
||||
/*
|
||||
* Unfortunaly, all of iconv implements do support
|
||||
* Unfortunately, all of iconv implements do support
|
||||
* "CP932" character-set, so we should use "SJIS"
|
||||
* instead if iconv_open failed.
|
||||
*/
|
||||
@ -1261,7 +1267,7 @@ create_sconv_object(const char *fc, const char *tc,
|
||||
/*
|
||||
* archive_mstring on Windows directly convert multi-bytes
|
||||
* into archive_wstring in order not to depend on locale
|
||||
* so that you can do a I18N programing. This will be
|
||||
* so that you can do a I18N programming. This will be
|
||||
* used only in archive_mstring_copy_mbs_len_l so far.
|
||||
*/
|
||||
if (flag & SCONV_FROM_CHARSET) {
|
||||
@ -1726,7 +1732,7 @@ archive_string_conversion_from_charset(struct archive *a, const char *charset,
|
||||
* in tar or zip files. But mbstowcs/wcstombs(CRT) usually use CP_ACP
|
||||
* unless you use setlocale(LC_ALL, ".OCP")(specify CP_OEMCP).
|
||||
* So we should make a string conversion between CP_ACP and CP_OEMCP
|
||||
* for compatibillty.
|
||||
* for compatibility.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
struct archive_string_conv *
|
||||
@ -2220,7 +2226,7 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p,
|
||||
|
||||
/*
|
||||
* If a character is ASCII, this just copies it. If not, this
|
||||
* assigns '?' charater instead but in UTF-8 locale this assigns
|
||||
* assigns '?' character instead but in UTF-8 locale this assigns
|
||||
* byte sequence 0xEF 0xBD 0xBD, which are code point U+FFFD,
|
||||
* a Replacement Character in Unicode.
|
||||
*/
|
||||
@ -2554,7 +2560,7 @@ utf16_to_unicode(uint32_t *pwc, const char *s, size_t n, int be)
|
||||
|
||||
/*
|
||||
* Surrogate pair values(0xd800 through 0xdfff) are only
|
||||
* used by UTF-16, so, after above culculation, the code
|
||||
* used by UTF-16, so, after above calculation, the code
|
||||
* must not be surrogate values, and Unicode has no codes
|
||||
* larger than 0x10ffff. Thus, those are not legal Unicode
|
||||
* values.
|
||||
@ -2903,7 +2909,7 @@ get_nfc(uint32_t uc, uint32_t uc2)
|
||||
/*
|
||||
* Normalize UTF-8/UTF-16BE characters to Form C and copy the result.
|
||||
*
|
||||
* TODO: Convert composition exclusions,which are never converted
|
||||
* TODO: Convert composition exclusions, which are never converted
|
||||
* from NFC,NFD,NFKC and NFKD, to Form C.
|
||||
*/
|
||||
static int
|
||||
@ -3437,7 +3443,7 @@ strncat_from_utf8_libarchive2(struct archive_string *as,
|
||||
}
|
||||
|
||||
/*
|
||||
* As libarchie 2.x, translates the UTF-8 characters into
|
||||
* As libarchive 2.x, translates the UTF-8 characters into
|
||||
* wide-characters in the assumption that WCS is Unicode.
|
||||
*/
|
||||
if (n < 0) {
|
||||
@ -3947,7 +3953,7 @@ archive_mstring_get_mbs_l(struct archive_mstring *aes,
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
/*
|
||||
* Internationalization programing on Windows must use Wide
|
||||
* Internationalization programming on Windows must use Wide
|
||||
* characters because Windows platform cannot make locale UTF-8.
|
||||
*/
|
||||
if (sc != NULL && (aes->aes_set & AES_SET_WCS) != 0) {
|
||||
@ -4079,7 +4085,7 @@ archive_mstring_copy_mbs_len_l(struct archive_mstring *aes,
|
||||
archive_string_empty(&(aes->aes_utf8));
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
/*
|
||||
* Internationalization programing on Windows must use Wide
|
||||
* Internationalization programming on Windows must use Wide
|
||||
* characters because Windows platform cannot make locale UTF-8.
|
||||
*/
|
||||
if (sc == NULL) {
|
||||
|
@ -81,6 +81,10 @@ archive_strappend_char(struct archive_string *, char);
|
||||
struct archive_wstring *
|
||||
archive_wstrappend_wchar(struct archive_wstring *, wchar_t);
|
||||
|
||||
/* Append a raw array to an archive_string, resizing as necessary */
|
||||
struct archive_string *
|
||||
archive_array_append(struct archive_string *, const char *, size_t);
|
||||
|
||||
/* Convert a Unicode string to current locale and append the result. */
|
||||
/* Returns -1 if conversion fails. */
|
||||
int
|
||||
|
@ -1009,7 +1009,7 @@ static const char u_decomposable_blocks[0x1D2+1] = {
|
||||
(((uc) > 0x1D244)?0:\
|
||||
ccc_val[ccc_val_index[ccc_index[(uc)>>8]][((uc)>>4)&0x0F]][(uc)&0x0F])
|
||||
|
||||
/* The table of the value of Canonical Cimbining Class */
|
||||
/* The table of the value of Canonical Combining Class */
|
||||
static const unsigned char ccc_val[][16] = {
|
||||
/* idx=0: XXXX0 - XXXXF */
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
|
@ -231,7 +231,7 @@ __archive_write_filter(struct archive_write_filter *f,
|
||||
if (length == 0)
|
||||
return(ARCHIVE_OK);
|
||||
if (f->write == NULL)
|
||||
/* If unset, a fatal error has already ocuured, so this filter
|
||||
/* If unset, a fatal error has already occurred, so this filter
|
||||
* didn't open. We cannot write anything. */
|
||||
return(ARCHIVE_FATAL);
|
||||
r = (f->write)(f, buff, length);
|
||||
|
@ -233,7 +233,7 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f,
|
||||
if (f->code == ARCHIVE_FILTER_XZ) {
|
||||
#ifdef HAVE_LZMA_STREAM_ENCODER_MT
|
||||
if (data->threads != 1) {
|
||||
bzero(&mt_options, sizeof(mt_options));
|
||||
memset(&mt_options, 0, sizeof(mt_options));
|
||||
mt_options.threads = data->threads;
|
||||
mt_options.timeout = 300;
|
||||
mt_options.filters = data->lzmafilters;
|
||||
|
@ -124,7 +124,10 @@ static struct {
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS},
|
||||
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -292,29 +295,41 @@ set_acl(struct archive *a, int fd, const char *name,
|
||||
}
|
||||
|
||||
/* Try restoring the ACL through 'fd' if we can. */
|
||||
#if HAVE_ACL_SET_FD
|
||||
if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
|
||||
ret = ARCHIVE_OK;
|
||||
else
|
||||
#else
|
||||
#if HAVE_ACL_SET_FD_NP || HAVE_ACL_SET_FD
|
||||
#if HAVE_ACL_SET_FD_NP
|
||||
if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
|
||||
ret = ARCHIVE_OK;
|
||||
else
|
||||
#endif
|
||||
if (fd >= 0) {
|
||||
if (acl_set_fd_np(fd, acl, acl_type) == 0)
|
||||
#else /* HAVE_ACL_SET_FD */
|
||||
if (fd >= 0 && acl_type == ACL_TYPE_ACCESS) {
|
||||
if (acl_set_fd(fd, acl) == 0)
|
||||
#endif
|
||||
ret = ARCHIVE_OK;
|
||||
else {
|
||||
if (errno == EOPNOTSUPP) {
|
||||
/* Filesystem doesn't support ACLs */
|
||||
ret = ARCHIVE_OK;
|
||||
} else {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to set %s acl on fd", tname);
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif /* HAVE_ACL_SET_FD_NP || HAVE_ACL_SET_FD */
|
||||
#if HAVE_ACL_SET_LINK_NP
|
||||
if (acl_set_link_np(name, acl_type, acl) != 0) {
|
||||
archive_set_error(a, errno, "Failed to set %s acl", tname);
|
||||
ret = ARCHIVE_WARN;
|
||||
}
|
||||
if (acl_set_link_np(name, acl_type, acl) != 0) {
|
||||
#else
|
||||
/* TODO: Skip this if 'name' is a symlink. */
|
||||
if (acl_set_file(name, acl_type, acl) != 0) {
|
||||
archive_set_error(a, errno, "Failed to set %s acl", tname);
|
||||
ret = ARCHIVE_WARN;
|
||||
}
|
||||
#endif
|
||||
if (errno == EOPNOTSUPP) {
|
||||
/* Filesystem doesn't support ACLs */
|
||||
ret = ARCHIVE_OK;
|
||||
} else {
|
||||
archive_set_error(a, errno, "Failed to set %s acl",
|
||||
tname);
|
||||
ret = ARCHIVE_WARN;
|
||||
}
|
||||
}
|
||||
exit_free:
|
||||
acl_free(acl);
|
||||
return (ret);
|
||||
|
@ -1358,7 +1358,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
|
||||
if (r < 0)
|
||||
return (r);
|
||||
|
||||
/* Write Nume size. */
|
||||
/* Write Name size. */
|
||||
r = enc_uint64(a, zip->total_bytes_entry_name+1);
|
||||
if (r < 0)
|
||||
return (r);
|
||||
|
@ -62,10 +62,17 @@ struct pax {
|
||||
struct sparse_block *sparse_tail;
|
||||
struct archive_string_conv *sconv_utf8;
|
||||
int opt_binary;
|
||||
|
||||
unsigned flags;
|
||||
#define WRITE_SCHILY_XATTR (1 << 0)
|
||||
#define WRITE_LIBARCHIVE_XATTR (1 << 1)
|
||||
};
|
||||
|
||||
static void add_pax_attr(struct archive_string *, const char *key,
|
||||
const char *value);
|
||||
static void add_pax_attr_binary(struct archive_string *,
|
||||
const char *key,
|
||||
const char *value, size_t value_len);
|
||||
static void add_pax_attr_int(struct archive_string *,
|
||||
const char *key, int64_t value);
|
||||
static void add_pax_attr_time(struct archive_string *,
|
||||
@ -136,6 +143,8 @@ archive_write_set_format_pax(struct archive *_a)
|
||||
"Can't allocate pax data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
pax->flags = WRITE_LIBARCHIVE_XATTR | WRITE_SCHILY_XATTR;
|
||||
|
||||
a->format_data = pax;
|
||||
a->format_name = "pax";
|
||||
a->format_options = archive_write_pax_options;
|
||||
@ -274,6 +283,17 @@ add_pax_attr_int(struct archive_string *as, const char *key, int64_t value)
|
||||
*/
|
||||
static void
|
||||
add_pax_attr(struct archive_string *as, const char *key, const char *value)
|
||||
{
|
||||
add_pax_attr_binary(as, key, value, strlen(value));
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a key/value attribute to the pax header. This function handles
|
||||
* binary values.
|
||||
*/
|
||||
static void
|
||||
add_pax_attr_binary(struct archive_string *as, const char *key,
|
||||
const char *value, size_t value_len)
|
||||
{
|
||||
int digits, i, len, next_ten;
|
||||
char tmp[1 + 3 * sizeof(int)]; /* < 3 base-10 digits per byte */
|
||||
@ -282,7 +302,7 @@ add_pax_attr(struct archive_string *as, const char *key, const char *value)
|
||||
* PAX attributes have the following layout:
|
||||
* <len> <space> <key> <=> <value> <nl>
|
||||
*/
|
||||
len = 1 + (int)strlen(key) + 1 + (int)strlen(value) + 1;
|
||||
len = 1 + (int)strlen(key) + 1 + (int)value_len + 1;
|
||||
|
||||
/*
|
||||
* The <len> field includes the length of the <len> field, so
|
||||
@ -313,21 +333,47 @@ add_pax_attr(struct archive_string *as, const char *key, const char *value)
|
||||
archive_strappend_char(as, ' ');
|
||||
archive_strcat(as, key);
|
||||
archive_strappend_char(as, '=');
|
||||
archive_strcat(as, value);
|
||||
archive_array_append(as, value, value_len);
|
||||
archive_strappend_char(as, '\n');
|
||||
}
|
||||
|
||||
static void
|
||||
archive_write_pax_header_xattr(struct pax *pax, const char *encoded_name,
|
||||
const void *value, size_t value_len)
|
||||
{
|
||||
struct archive_string s;
|
||||
char *encoded_value;
|
||||
|
||||
if (pax->flags & WRITE_LIBARCHIVE_XATTR) {
|
||||
encoded_value = base64_encode((const char *)value, value_len);
|
||||
|
||||
if (encoded_name != NULL && encoded_value != NULL) {
|
||||
archive_string_init(&s);
|
||||
archive_strcpy(&s, "LIBARCHIVE.xattr.");
|
||||
archive_strcat(&s, encoded_name);
|
||||
add_pax_attr(&(pax->pax_header), s.s, encoded_value);
|
||||
archive_string_free(&s);
|
||||
}
|
||||
free(encoded_value);
|
||||
}
|
||||
if (pax->flags & WRITE_SCHILY_XATTR) {
|
||||
archive_string_init(&s);
|
||||
archive_strcpy(&s, "SCHILY.xattr.");
|
||||
archive_strcat(&s, encoded_name);
|
||||
add_pax_attr_binary(&(pax->pax_header), s.s, value, value_len);
|
||||
archive_string_free(&s);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
archive_write_pax_header_xattrs(struct archive_write *a,
|
||||
struct pax *pax, struct archive_entry *entry)
|
||||
{
|
||||
struct archive_string s;
|
||||
int i = archive_entry_xattr_reset(entry);
|
||||
|
||||
while (i--) {
|
||||
const char *name;
|
||||
const void *value;
|
||||
char *encoded_value;
|
||||
char *url_encoded_name = NULL, *encoded_name = NULL;
|
||||
size_t size;
|
||||
int r;
|
||||
@ -348,16 +394,9 @@ archive_write_pax_header_xattrs(struct archive_write *a,
|
||||
}
|
||||
}
|
||||
|
||||
encoded_value = base64_encode((const char *)value, size);
|
||||
archive_write_pax_header_xattr(pax, encoded_name,
|
||||
value, size);
|
||||
|
||||
if (encoded_name != NULL && encoded_value != NULL) {
|
||||
archive_string_init(&s);
|
||||
archive_strcpy(&s, "LIBARCHIVE.xattr.");
|
||||
archive_strcat(&s, encoded_name);
|
||||
add_pax_attr(&(pax->pax_header), s.s, encoded_value);
|
||||
archive_string_free(&s);
|
||||
}
|
||||
free(encoded_value);
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
@ -2913,7 +2913,7 @@ compression_init_encoder_xz(struct archive *a,
|
||||
*strm = lzma_init_data;
|
||||
#ifdef HAVE_LZMA_STREAM_ENCODER_MT
|
||||
if (threads > 1) {
|
||||
bzero(&mt_options, sizeof(mt_options));
|
||||
memset(&mt_options, 0, sizeof(mt_options));
|
||||
mt_options.threads = threads;
|
||||
mt_options.timeout = 300;
|
||||
mt_options.filters = lzmafilters;
|
||||
|
@ -878,7 +878,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||
|| zip->entry_encryption == ENCRYPTION_WINZIP_AES256)) {
|
||||
|
||||
memcpy(e, "\001\231\007\000\001\000AE", 8);
|
||||
/* AES vendoer version AE-2 does not store a CRC.
|
||||
/* AES vendor version AE-2 does not store a CRC.
|
||||
* WinZip 11 uses AE-1, which does store the CRC,
|
||||
* but it does not store the CRC when the file size
|
||||
* is less than 20 bytes. So we simulate what
|
||||
@ -1013,7 +1013,7 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s)
|
||||
if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) {
|
||||
switch (zip->entry_encryption) {
|
||||
case ENCRYPTION_TRADITIONAL:
|
||||
/* Initialize traditoinal PKWARE encryption context. */
|
||||
/* Initialize traditional PKWARE encryption context. */
|
||||
if (!zip->tctx_valid) {
|
||||
ret = init_traditional_pkware_encryption(a);
|
||||
if (ret != ARCHIVE_OK)
|
||||
@ -1499,7 +1499,7 @@ trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
trad_enc_decypt_byte(struct trad_enc_ctx *ctx)
|
||||
trad_enc_decrypt_byte(struct trad_enc_ctx *ctx)
|
||||
{
|
||||
unsigned temp = ctx->keys[2] | 2;
|
||||
return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff;
|
||||
@ -1515,7 +1515,7 @@ trad_enc_encrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in,
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
uint8_t t = in[i];
|
||||
out[i] = t ^ trad_enc_decypt_byte(ctx);
|
||||
out[i] = t ^ trad_enc_decrypt_byte(ctx);
|
||||
trad_enc_update_keys(ctx, t);
|
||||
}
|
||||
return i;
|
||||
@ -1626,7 +1626,7 @@ init_winzip_aes_encryption(struct archive_write *a)
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
/* Set a passowrd verification value after the 'salt'. */
|
||||
/* Set a password verification value after the 'salt'. */
|
||||
salt[salt_len] = derived_key[key_len * 2];
|
||||
salt[salt_len + 1] = derived_key[key_len * 2 + 1];
|
||||
|
||||
|
@ -191,7 +191,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_set_callback3)
|
||||
/* Fist call, we should get "passCallBack" as a passphrase. */
|
||||
assertEqualString("passCallBack", __archive_read_next_passphrase(ar));
|
||||
__archive_read_reset_passphrase(ar);
|
||||
/* After reset passphrase, we should get "passCallBack"passphrase. */
|
||||
/* After reset passphrase, we should get "passCallBack" passphrase. */
|
||||
assertEqualString("passCallBack", __archive_read_next_passphrase(ar));
|
||||
/* Second call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
|
@ -40,7 +40,7 @@ static char archive_data[] = {
|
||||
};
|
||||
|
||||
/*
|
||||
* Compatibility: uudecode command ignores junk data placed ater the "end"
|
||||
* Compatibility: uudecode command ignores junk data placed after the "end"
|
||||
* marker.
|
||||
*/
|
||||
DEFINE_TEST(test_compat_uudecode)
|
||||
|
@ -27,7 +27,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
ecute the following to rebuild the data for this program:
|
||||
execute the following to rebuild the data for this program:
|
||||
tail -n +33 test_read_format_cpio_afio.c | /bin/sh
|
||||
|
||||
# How to make a sample data.
|
||||
|
@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
DEFINE_TEST(test_read_format_zip_traditional_encryption_data)
|
||||
{
|
||||
/* This file is password protected (Traditional PKWARE Enctypted).
|
||||
/* This file is password protected (Traditional PKWARE Encrypted).
|
||||
The headers are NOT encrypted. Password is "12345678". */
|
||||
const char *refname =
|
||||
"test_read_format_zip_traditional_encryption_data.zip";
|
||||
@ -36,7 +36,7 @@ DEFINE_TEST(test_read_format_zip_traditional_encryption_data)
|
||||
struct archive *a;
|
||||
char buff[512];
|
||||
|
||||
/* Check if running system has cryptographic functionarity. */
|
||||
/* Check if running system has cryptographic functionality. */
|
||||
assert((a = archive_write_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
|
||||
|
@ -33,7 +33,7 @@ test_winzip_aes(const char *refname, int need_libz)
|
||||
struct archive *a;
|
||||
char buff[512];
|
||||
|
||||
/* Check if running system has cryptographic functionarity. */
|
||||
/* Check if running system has cryptographic functionality. */
|
||||
assert((a = archive_write_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
|
||||
|
@ -34,7 +34,7 @@ DEFINE_TEST(test_read_format_zip_winzip_aes256_large)
|
||||
char buff[512];
|
||||
|
||||
|
||||
/* Check if running system has cryptographic functionarity. */
|
||||
/* Check if running system has cryptographic functionality. */
|
||||
assert((a = archive_write_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
|
||||
|
@ -0,0 +1,70 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 IBM Corporation
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This test case's code has been derived from test_entry.c
|
||||
*/
|
||||
#include "test.h"
|
||||
|
||||
DEFINE_TEST(test_schily_xattr_pax)
|
||||
{
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
const char *refname = "test_read_pax_schily_xattr.tar";
|
||||
const char *xname; /* For xattr tests. */
|
||||
const void *xval; /* For xattr tests. */
|
||||
size_t xsize; /* For xattr tests. */
|
||||
const char *string, *array;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||
|
||||
extract_reference_file(refname);
|
||||
assertEqualIntA(a, ARCHIVE_OK,
|
||||
archive_read_open_filename(a, refname, 10240));
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(2, archive_entry_xattr_count(ae));
|
||||
assertEqualInt(2, archive_entry_xattr_reset(ae));
|
||||
|
||||
assertEqualInt(0, archive_entry_xattr_next(ae, &xname, &xval, &xsize));
|
||||
assertEqualString(xname, "security.selinux");
|
||||
string = "system_u:object_r:unlabeled_t:s0";
|
||||
assertEqualString(xval, string);
|
||||
/* the xattr's value also contains the terminating \0 */
|
||||
assertEqualInt((int)xsize, strlen(string) + 1);
|
||||
|
||||
assertEqualInt(0, archive_entry_xattr_next(ae, &xname, &xval, &xsize));
|
||||
assertEqualString(xname, "security.ima");
|
||||
assertEqualInt((int)xsize, 265);
|
||||
/* we only compare the first 12 bytes */
|
||||
array = "\x03\x02\x04\xb0\xe9\xd6\x79\x01\x00\x2b\xad\x1e";
|
||||
assertEqualMem(xval, array, 12);
|
||||
|
||||
/* Close the archive. */
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
begin 644 test_schily_xattr_pax.tar
|
||||
M+B]087A(96%D97)S+C$U,C4O8V]N9F9I;&5S````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M`````````````#`P,#`V-#0`,#`P,#`P,``P,#`P,#`P`#`P,#`P,#`P-C0W
|
||||
M`#$R-S$R,C$P-3`V`#`Q,C4V-@`@>```````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M``````````````````````````````````````````!U<W1A<@`P,```````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M```````````````````````S,"!A=&EM93TQ-#8R,S`Y,S8Y+C<Q-#DW-3DP
|
||||
M.0HS,"!C=&EM93TQ-#8R,S`Y,S8Y+C<W.#DW-C(Q,PHR.38@4T-(24Q9+GAA
|
||||
M='1R+G-E8W5R:71Y+FEM83T#`@2PZ=9Y`0`KK1Z%635)4!FT,I"<49LTXR`'
|
||||
M@42;2R:POQ9`JQA=+16.AY^<_[XK597$><QT!GLCT8_IF@@:/Z<?]<HQ0T7I
|
||||
MO&87D9-4,L'!GUG'K%=]KEPC<<)&@`J)'T89MBPB7],R(#&7"#>W6X5O?Y6:
|
||||
M9^':P2MZR[4)$@W<NV(VUT&(R0R-_S>?)B6GX0U@<,0M%6YNMO%OG+IS%/.<
|
||||
M,"A(N&S.F9]=!*5=\).X."2$GUGJ,0C:@+G#$M_E8UQP,LU-G(8IKW^K^<8*
|
||||
M*3_.N0'%8.^$8S$`D9XOF+DK<<)U34U'_"O5/2<N#T*!'!4Z73X-X4W!/LCF
|
||||
M/,721A`CQF:PGDD/"C8W(%-#2$E,62YX871T<BYS96-U<FET>2YS96QI;G5X
|
||||
M/7-Y<W1E;5]U.F]B:F5C=%]R.G5N;&%B96QE9%]T.G,P``H`````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M`````````````````````````````````````````````"XO8V]N9F9I;&5S
|
||||
M````````````````````````````````````````````````````````````
|
||||
M```````````````````````````````````````````````````````````P
|
||||
M,#`P-C0T`#`P,#`P,#``,#`P,#`P,``P,#`P,#`P,#`T,0`Q,C<Q,C(Q,#4P
|
||||
M-@`P,3,P-S,`(#``````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````=7-T87(`,#!R;V]T````````````````
|
||||
M`````````````````````')O;W0`````````````````````````````````
|
||||
M````,#`P,#`P,``P,#`P,#`P````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````+V5T8R]D969A=6QT+VEM82UP;VQI8WDN:6YA8W1I=F4*````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
9````````````````````````````````````
|
||||
`
|
||||
end
|
@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* NOTE: On FreeBSD and Solaris, this test needs ZFS.
|
||||
* You may should perfom this test as
|
||||
* You may perform this test as
|
||||
* 'TMPDIR=<a directory on the ZFS> libarchive_test'.
|
||||
*/
|
||||
|
||||
|
@ -29,10 +29,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
You can contact the author at :
|
||||
- xxHash source repository : http://code.google.com/p/xxhash/
|
||||
*/
|
||||
#include "archive_platform.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "archive_platform.h"
|
||||
#include "archive_xxhash.h"
|
||||
|
||||
#ifdef HAVE_LIBLZ4
|
||||
@ -60,7 +61,7 @@ You can contact the author at :
|
||||
** By default, xxHash library provides endian-independent Hash values, based on little-endian convention.
|
||||
** Results are therefore identical for little-endian and big-endian CPU.
|
||||
** This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format.
|
||||
** Should endian-independance be of no importance for your application, you may set the #define below to 1.
|
||||
** Should endian-independence be of no importance for your application, you may set the #define below to 1.
|
||||
** It will improve speed for Big-endian CPU.
|
||||
** This option has no impact on Little_Endian CPU.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user