- Update libarchive to 2.8.4
- Add support for extracting xar and rpm archives - Add libarchive_fe subdir (common code for tar and cpio) Approved by: kientzle MFC after: 2 weeks
This commit is contained in:
parent
d9a362862c
commit
38abb26b5a
@ -13,6 +13,9 @@ DPADD+= ${LIBLZMA}
|
||||
LDADD+= -llzma
|
||||
CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
|
||||
|
||||
DPADD+= ${LIBBSDXML}
|
||||
LDADD+= -lbsdxml
|
||||
|
||||
# FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
|
||||
# It has no real relation to the libarchive version number.
|
||||
SHLIB_MAJOR= 5
|
||||
@ -56,6 +59,7 @@ SRCS= archive_check_magic.c \
|
||||
archive_read_support_compression_gzip.c \
|
||||
archive_read_support_compression_none.c \
|
||||
archive_read_support_compression_program.c \
|
||||
archive_read_support_compression_rpm.c \
|
||||
archive_read_support_compression_uu.c \
|
||||
archive_read_support_compression_xz.c \
|
||||
archive_read_support_format_all.c \
|
||||
@ -66,6 +70,7 @@ SRCS= archive_check_magic.c \
|
||||
archive_read_support_format_mtree.c \
|
||||
archive_read_support_format_raw.c \
|
||||
archive_read_support_format_tar.c \
|
||||
archive_read_support_format_xar.c \
|
||||
archive_read_support_format_zip.c \
|
||||
archive_string.c \
|
||||
archive_string_sprintf.c \
|
||||
|
@ -21,6 +21,7 @@ Currently, the library automatically detects and reads the following:
|
||||
* gzip compression
|
||||
* bzip2 compression
|
||||
* compress/LZW compression
|
||||
* lzma and xz compression
|
||||
* GNU tar format (including GNU long filenames, long link names, and
|
||||
sparse files)
|
||||
* Solaris 9 extended tar format (including ACLs)
|
||||
@ -30,18 +31,26 @@ Currently, the library automatically detects and reads the following:
|
||||
* POSIX octet-oriented cpio
|
||||
* SVR4 ASCII cpio
|
||||
* Binary cpio (big-endian or little-endian)
|
||||
* ISO9660 CD-ROM images (with optional Rockridge extensions)
|
||||
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
|
||||
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
||||
* GNU and BSD 'ar' archives
|
||||
* 'mtree' format
|
||||
|
||||
The library can write:
|
||||
* gzip compression
|
||||
* bzip2 compression
|
||||
* compress/LZW compression
|
||||
* lzma and xz compression
|
||||
* POSIX ustar
|
||||
* POSIX pax interchange format
|
||||
* "restricted" pax format, which will create ustar archives except for
|
||||
entries that require pax extensions (for long filenames, ACLs, etc).
|
||||
* POSIX octet-oriented cpio
|
||||
* SVR4 "newc" cpio
|
||||
* shar archives
|
||||
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
||||
* GNU and BSD 'ar' archives
|
||||
* 'mtree' format
|
||||
|
||||
Notes:
|
||||
* This is a heavily stream-oriented system. There is no direct
|
||||
|
@ -52,7 +52,9 @@
|
||||
/* These should match the types used in 'struct stat' */
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define __LA_INT64_T __int64
|
||||
# if defined(_WIN64)
|
||||
# if defined(_SSIZE_T_DEFINED)
|
||||
# define __LA_SSIZE_T ssize_t
|
||||
# elif defined(_WIN64)
|
||||
# define __LA_SSIZE_T __int64
|
||||
# else
|
||||
# define __LA_SSIZE_T long
|
||||
@ -127,13 +129,13 @@ extern "C" {
|
||||
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
|
||||
* #endif
|
||||
*/
|
||||
#define ARCHIVE_VERSION_NUMBER 2007901
|
||||
#define ARCHIVE_VERSION_NUMBER 2008004
|
||||
__LA_DECL int archive_version_number(void);
|
||||
|
||||
/*
|
||||
* Textual name/version of the library, useful for version displays.
|
||||
*/
|
||||
#define ARCHIVE_VERSION_STRING "libarchive 2.7.901a"
|
||||
#define ARCHIVE_VERSION_STRING "libarchive 2.8.4"
|
||||
__LA_DECL const char * archive_version_string(void);
|
||||
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
@ -319,6 +321,7 @@ __LA_DECL int archive_read_support_compression_program_signature
|
||||
(struct archive *, const char *,
|
||||
const void * /* match */, size_t);
|
||||
|
||||
__LA_DECL int archive_read_support_compression_rpm(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_uu(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_xz(struct archive *);
|
||||
|
||||
@ -331,6 +334,7 @@ __LA_DECL int archive_read_support_format_iso9660(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_mtree(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_raw(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_tar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_xar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_zip(struct archive *);
|
||||
|
||||
|
||||
|
@ -29,6 +29,10 @@
|
||||
#error This header is only to be used internally to libarchive.
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hash function support in various Operating Systems:
|
||||
*
|
||||
@ -41,43 +45,71 @@
|
||||
* - OpenBSD 4.4 and earlier have SHA2 in libc with _ after algorithm name
|
||||
*
|
||||
* DragonFly and FreeBSD (XXX not used yet):
|
||||
* - MD5 in libmd: without _ after algorithm name
|
||||
* - SHA{1,256,512} in libmd: with _ after algorithm name (conflicts w/OpenSSL!)
|
||||
* - MD5 and SHA1 in libmd: without _ after algorithm name
|
||||
* - SHA256: with _ after algorithm name
|
||||
*
|
||||
* Mac OS X (10.4 and later):
|
||||
* - MD5, SHA1 and SHA2 in libSystem: with CC_ prefix and _ after algorithm name
|
||||
*
|
||||
* OpenSSL:
|
||||
* - MD5, SHA1, SHA2, SHA{256,384,512} in libcrypto: with _ after algorithm name
|
||||
* - MD5, SHA1 and SHA2 in libcrypto: with _ after algorithm name
|
||||
*
|
||||
* Windows:
|
||||
* - MD5, SHA1 and SHA2 in archive_windows.c: without algorithm name
|
||||
* and with __la_ prefix.
|
||||
*/
|
||||
#if defined(ARCHIVE_HASH_MD5_WIN) ||\
|
||||
defined(ARCHIVE_HASH_SHA1_WIN) || defined(ARCHIVE_HASH_SHA256_WIN) ||\
|
||||
defined(ARCHIVE_HASH_SHA384_WIN) || defined(ARCHIVE_HASH_SHA512_WIN)
|
||||
#include <wincrypt.h>
|
||||
typedef struct {
|
||||
int valid;
|
||||
HCRYPTPROV cryptProv;
|
||||
HCRYPTHASH hash;
|
||||
} Digest_CTX;
|
||||
extern void __la_hash_Init(Digest_CTX *, ALG_ID);
|
||||
extern void __la_hash_Final(unsigned char *, size_t, Digest_CTX *);
|
||||
extern void __la_hash_Update(Digest_CTX *, const unsigned char *, size_t);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MD5_H) && defined(HAVE_MD5INIT)
|
||||
#if defined(ARCHIVE_HASH_MD5_LIBC)
|
||||
# include <md5.h>
|
||||
# define ARCHIVE_HAS_MD5
|
||||
typedef MD5_CTX archive_md5_ctx;
|
||||
# define archive_md5_init(ctx) MD5Init(ctx)
|
||||
# define archive_md5_final(ctx, buf) MD5Final(buf, ctx)
|
||||
# define archive_md5_update(ctx, buf, n) MD5Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_MD5_H)
|
||||
#elif defined(ARCHIVE_HASH_MD5_LIBSYSTEM)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define ARCHIVE_HAS_MD5
|
||||
typedef CC_MD5_CTX archive_md5_ctx;
|
||||
# define archive_md5_init(ctx) CC_MD5_Init(ctx)
|
||||
# define archive_md5_final(ctx, buf) CC_MD5_Final(buf, ctx)
|
||||
# define archive_md5_update(ctx, buf, n) CC_MD5_Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_MD5_OPENSSL)
|
||||
# include <openssl/md5.h>
|
||||
# define ARCHIVE_HAS_MD5
|
||||
typedef MD5_CTX archive_md5_ctx;
|
||||
# define archive_md5_init(ctx) MD5_Init(ctx)
|
||||
# define archive_md5_final(ctx, buf) MD5_Final(buf, ctx)
|
||||
# define archive_md5_update(ctx, buf, n) MD5_Update(ctx, buf, n)
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_MD5)
|
||||
#elif defined(ARCHIVE_HASH_MD5_WIN)
|
||||
# define ARCHIVE_HAS_MD5
|
||||
typedef MD5_CTX archive_md5_ctx;
|
||||
# define archive_md5_init(ctx) MD5_Init(ctx)
|
||||
# define archive_md5_final(ctx, buf) MD5_Final(buf, ctx)
|
||||
# define archive_md5_update(ctx, buf, n) MD5_Update(ctx, buf, n)
|
||||
# define MD5_DIGEST_LENGTH 16
|
||||
typedef Digest_CTX archive_md5_ctx;
|
||||
# define archive_md5_init(ctx) __la_hash_Init(ctx, CALG_MD5)
|
||||
# define archive_md5_final(ctx, buf) __la_hash_Final(buf, MD5_DIGEST_LENGTH, ctx)
|
||||
# define archive_md5_update(ctx, buf, n) __la_hash_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_RMD160_H) && defined(HAVE_RMD160INIT)
|
||||
#if defined(ARCHIVE_HASH_RMD160_LIBC)
|
||||
# include <rmd160.h>
|
||||
# define ARCHIVE_HAS_RMD160
|
||||
typedef RMD160_CTX archive_rmd160_ctx;
|
||||
# define archive_rmd160_init(ctx) RMD160Init(ctx)
|
||||
# define archive_rmd160_final(ctx, buf) RMD160Final(buf, ctx)
|
||||
# define archive_rmd160_update(ctx, buf, n) RMD160Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_RIPEMD_H)
|
||||
#elif defined(ARCHIVE_HASH_RMD160_OPENSSL)
|
||||
# include <openssl/ripemd.h>
|
||||
# define ARCHIVE_HAS_RMD160
|
||||
typedef RIPEMD160_CTX archive_rmd160_ctx;
|
||||
@ -86,111 +118,164 @@ typedef RIPEMD160_CTX archive_rmd160_ctx;
|
||||
# define archive_rmd160_update(ctx, buf, n) RIPEMD160_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SHA1_H) && defined(HAVE_SHA1INIT)
|
||||
#if defined(ARCHIVE_HASH_SHA1_LIBC)
|
||||
# include <sha1.h>
|
||||
# define ARCHIVE_HAS_SHA1
|
||||
typedef SHA1_CTX archive_sha1_ctx;
|
||||
# define archive_sha1_init(ctx) SHA1Init(ctx)
|
||||
# define archive_sha1_final(ctx, buf) SHA1Final(buf, ctx)
|
||||
# define archive_sha1_update(ctx, buf, n) SHA1Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_SHA_H)
|
||||
#elif defined(ARCHIVE_HASH_SHA1_LIBSYSTEM)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define ARCHIVE_HAS_SHA1
|
||||
typedef CC_SHA1_CTX archive_sha1_ctx;
|
||||
# define archive_sha1_init(ctx) CC_SHA1_Init(ctx)
|
||||
# define archive_sha1_final(ctx, buf) CC_SHA1_Final(buf, ctx)
|
||||
# define archive_sha1_update(ctx, buf, n) CC_SHA1_Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA1_OPENSSL)
|
||||
# include <openssl/sha.h>
|
||||
# define ARCHIVE_HAS_SHA1
|
||||
typedef SHA_CTX archive_sha1_ctx;
|
||||
# define archive_sha1_init(ctx) SHA1_Init(ctx)
|
||||
# define archive_sha1_final(ctx, buf) SHA1_Final(buf, ctx)
|
||||
# define archive_sha1_update(ctx, buf, n) SHA1_Update(ctx, buf, n)
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA1)
|
||||
#elif defined(ARCHIVE_HASH_SHA1_WIN)
|
||||
# define ARCHIVE_HAS_SHA1
|
||||
typedef SHA1_CTX archive_sha1_ctx;
|
||||
# define archive_sha1_init(ctx) SHA1_Init(ctx)
|
||||
# define archive_sha1_final(ctx, buf) SHA1_Final(buf, ctx)
|
||||
# define archive_sha1_update(ctx, buf, n) SHA1_Update(ctx, buf, n)
|
||||
# define SHA1_DIGEST_LENGTH 20
|
||||
typedef Digest_CTX archive_sha1_ctx;
|
||||
# define archive_sha1_init(ctx) __la_hash_Init(ctx, CALG_SHA1)
|
||||
# define archive_sha1_final(ctx, buf) __la_hash_Final(buf, SHA1_DIGEST_LENGTH, ctx)
|
||||
# define archive_sha1_update(ctx, buf, n) __la_hash_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SHA2_H) && defined(HAVE_SHA256_INIT)
|
||||
#if defined(ARCHIVE_HASH_SHA256_LIBC)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef SHA256_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) SHA256_Init(ctx)
|
||||
# define archive_sha256_final(ctx, buf) SHA256_Final(buf, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) SHA256_Update(ctx, buf, n)
|
||||
#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA256INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA256_LIBC2)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef SHA256_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) SHA256Init(ctx)
|
||||
# define archive_sha256_final(ctx, buf) SHA256Final(buf, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) SHA256Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA256_INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA256_LIBC3)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef SHA2_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) SHA256Init(ctx)
|
||||
# define archive_sha256_final(ctx, buf) SHA256Final(buf, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) SHA256Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA256_LIBSYSTEM)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef CC_SHA256_CTX archive_shs256_ctx;
|
||||
# define archive_shs256_init(ctx) CC_SHA256_Init(ctx)
|
||||
# define archive_shs256_final(ctx, buf) CC_SHA256_Final(buf, ctx)
|
||||
# define archive_shs256_update(ctx, buf, n) CC_SHA256_Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA256_OPENSSL)
|
||||
# include <openssl/sha.h>
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef SHA256_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) SHA256_Init(ctx)
|
||||
# define archive_sha256_final(ctx, buf) SHA256_Final(buf, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) SHA256_Update(ctx, buf, n)
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_256)
|
||||
#elif defined(ARCHIVE_HASH_SHA256_WIN)
|
||||
# define ARCHIVE_HAS_SHA256
|
||||
typedef SHA256_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) SHA256_Init(ctx)
|
||||
# define archive_sha256_final(ctx, buf) SHA256_Final(buf, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) SHA256_Update(ctx, buf, n)
|
||||
# define SHA256_DIGEST_LENGTH 32
|
||||
typedef Digest_CTX archive_sha256_ctx;
|
||||
# define archive_sha256_init(ctx) __la_hash_Init(ctx, CALG_SHA_256)
|
||||
# define archive_sha256_final(ctx, buf) __la_hash_Final(buf, SHA256_DIGEST_LENGTH, ctx)
|
||||
# define archive_sha256_update(ctx, buf, n) __la_hash_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SHA2_H) && defined(HAVE_SHA384_INIT)
|
||||
#if defined(ARCHIVE_HASH_SHA384_LIBC)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef SHA384_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) SHA384_Init(ctx)
|
||||
# define archive_sha384_final(ctx, buf) SHA384_Final(buf, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) SHA384_Update(ctx, buf, n)
|
||||
#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA384INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA384_LIBC2)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef SHA384_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) SHA384Init(ctx)
|
||||
# define archive_sha384_final(ctx, buf) SHA384Final(buf, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) SHA384Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA384_INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA384_LIBC3)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef SHA2_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) SHA384Init(ctx)
|
||||
# define archive_sha384_final(ctx, buf) SHA384Final(buf, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) SHA384Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA384_LIBSYSTEM)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef CC_SHA512_CTX archive_shs384_ctx;
|
||||
# define archive_shs384_init(ctx) CC_SHA384_Init(ctx)
|
||||
# define archive_shs384_final(ctx, buf) CC_SHA384_Final(buf, ctx)
|
||||
# define archive_shs384_update(ctx, buf, n) CC_SHA384_Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA384_OPENSSL)
|
||||
# include <openssl/sha.h>
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef SHA512_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) SHA384_Init(ctx)
|
||||
# define archive_sha384_final(ctx, buf) SHA384_Final(buf, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) SHA384_Update(ctx, buf, n)
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_384)
|
||||
#elif defined(ARCHIVE_HASH_SHA384_WIN)
|
||||
# define ARCHIVE_HAS_SHA384
|
||||
typedef SHA512_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) SHA384_Init(ctx)
|
||||
# define archive_sha384_final(ctx, buf) SHA384_Final(buf, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) SHA384_Update(ctx, buf, n)
|
||||
# define SHA384_DIGEST_LENGTH 48
|
||||
typedef Digest_CTX archive_sha384_ctx;
|
||||
# define archive_sha384_init(ctx) __la_hash_Init(ctx, CALG_SHA_384)
|
||||
# define archive_sha384_final(ctx, buf) __la_hash_Final(buf, SHA384_DIGEST_LENGTH, ctx)
|
||||
# define archive_sha384_update(ctx, buf, n) __la_hash_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SHA2_H) && defined(HAVE_SHA512_INIT)
|
||||
#if defined(ARCHIVE_HASH_SHA512_LIBC)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef SHA512_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) SHA512_Init(ctx)
|
||||
# define archive_sha512_final(ctx, buf) SHA512_Final(buf, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) SHA512_Update(ctx, buf, n)
|
||||
#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA512INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA512_LIBC2)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef SHA512_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) SHA512Init(ctx)
|
||||
# define archive_sha512_final(ctx, buf) SHA512Final(buf, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) SHA512Update(ctx, buf, n)
|
||||
#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA512_INIT)
|
||||
#elif defined(ARCHIVE_HASH_SHA512_LIBC3)
|
||||
# include <sha2.h>
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef SHA2_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) SHA512Init(ctx)
|
||||
# define archive_sha512_final(ctx, buf) SHA512Final(buf, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) SHA512Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA512_LIBSYSTEM)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef CC_SHA512_CTX archive_shs512_ctx;
|
||||
# define archive_shs512_init(ctx) CC_SHA512_Init(ctx)
|
||||
# define archive_shs512_final(ctx, buf) CC_SHA512_Final(buf, ctx)
|
||||
# define archive_shs512_update(ctx, buf, n) CC_SHA512_Update(ctx, buf, n)
|
||||
#elif defined(ARCHIVE_HASH_SHA512_OPENSSL)
|
||||
# include <openssl/sha.h>
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef SHA512_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) SHA512_Init(ctx)
|
||||
# define archive_sha512_final(ctx, buf) SHA512_Final(buf, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) SHA512_Update(ctx, buf, n)
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_512)
|
||||
#elif defined(ARCHIVE_HASH_SHA512_WIN)
|
||||
# define ARCHIVE_HAS_SHA512
|
||||
typedef SHA512_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) SHA512_Init(ctx)
|
||||
# define archive_sha512_final(ctx, buf) SHA512_Final(buf, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) SHA512_Update(ctx, buf, n)
|
||||
# define SHA512_DIGEST_LENGTH 64
|
||||
typedef Digest_CTX archive_sha512_ctx;
|
||||
# define archive_sha512_init(ctx) __la_hash_Init(ctx, CALG_SHA_512)
|
||||
# define archive_sha512_final(ctx, buf) __la_hash_Final(buf, SHA512_DIGEST_LENGTH, ctx)
|
||||
# define archive_sha512_update(ctx, buf, n) __la_hash_Update(ctx, buf, n)
|
||||
#endif
|
||||
|
@ -597,7 +597,7 @@ list_archive(const char *name)
|
||||
archive_read_support_format_all(a);
|
||||
archive_read_open(a, mydata, myopen, myread, myclose);
|
||||
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
|
||||
printf("%s\\n",archive_entry_pathname(entry));
|
||||
printf("%s\en",archive_entry_pathname(entry));
|
||||
archive_read_data_skip(a);
|
||||
}
|
||||
archive_read_free(a);
|
||||
|
@ -208,6 +208,12 @@ setup_acls_posix1e(struct archive_read_disk *a,
|
||||
#if HAVE_ACL_GET_LINK_NP
|
||||
else if (!a->follow_symlinks)
|
||||
acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
|
||||
#else
|
||||
else if ((!a->follow_symlinks)
|
||||
&& (archive_entry_filetype(entry) == AE_IFLNK))
|
||||
/* We can't get the ACL of a symlink, so we assume it can't
|
||||
have one. */
|
||||
acl = NULL;
|
||||
#endif
|
||||
else
|
||||
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
|
||||
@ -419,7 +425,8 @@ setup_xattrs(struct archive_read_disk *a,
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE
|
||||
#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE && \
|
||||
HAVE_DECL_EXTATTR_NAMESPACE_USER
|
||||
|
||||
/*
|
||||
* FreeBSD extattr interface.
|
||||
@ -430,11 +437,11 @@ setup_xattrs(struct archive_read_disk *a,
|
||||
* to not include the system extattrs that hold ACLs; we handle
|
||||
* those separately.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
setup_xattr(struct archive_read_disk *a, struct archive_entry *entry,
|
||||
int namespace, const char *name, const char *fullname, int fd);
|
||||
|
||||
int
|
||||
static int
|
||||
setup_xattr(struct archive_read_disk *a, struct archive_entry *entry,
|
||||
int namespace, const char *name, const char *fullname, int fd)
|
||||
{
|
||||
|
@ -182,6 +182,7 @@ lookup_uname(void *data, uid_t uid)
|
||||
&lookup_uname_helper, (id_t)uid));
|
||||
}
|
||||
|
||||
#if HAVE_GETPWUID_R
|
||||
static const char *
|
||||
lookup_uname_helper(struct name_cache *cache, id_t id)
|
||||
{
|
||||
@ -222,6 +223,20 @@ lookup_uname_helper(struct name_cache *cache, id_t id)
|
||||
|
||||
return strdup(result->pw_name);
|
||||
}
|
||||
#else
|
||||
static const char *
|
||||
lookup_uname_helper(struct name_cache *cache, id_t id)
|
||||
{
|
||||
struct passwd *result;
|
||||
|
||||
result = getpwuid((uid_t)id);
|
||||
|
||||
if (result == NULL)
|
||||
return (NULL);
|
||||
|
||||
return strdup(result->pw_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
lookup_gname(void *data, gid_t gid)
|
||||
@ -231,6 +246,7 @@ lookup_gname(void *data, gid_t gid)
|
||||
&lookup_gname_helper, (id_t)gid));
|
||||
}
|
||||
|
||||
#if HAVE_GETGRGID_R
|
||||
static const char *
|
||||
lookup_gname_helper(struct name_cache *cache, id_t id)
|
||||
{
|
||||
@ -269,4 +285,19 @@ lookup_gname_helper(struct name_cache *cache, id_t id)
|
||||
|
||||
return strdup(result->gr_name);
|
||||
}
|
||||
#else
|
||||
static const char *
|
||||
lookup_gname_helper(struct name_cache *cache, id_t id)
|
||||
{
|
||||
struct group *result;
|
||||
|
||||
result = getgrgid((gid_t)id);
|
||||
|
||||
if (result == NULL)
|
||||
return (NULL);
|
||||
|
||||
return strdup(result->gr_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! (_WIN32 && !__CYGWIN__) */
|
||||
|
@ -46,6 +46,8 @@ archive_read_support_compression_all(struct archive *a)
|
||||
archive_read_support_compression_xz(a);
|
||||
/* The decode code doesn't use an outside library. */
|
||||
archive_read_support_compression_uu(a);
|
||||
/* The decode code doesn't use an outside library. */
|
||||
archive_read_support_compression_rpm(a);
|
||||
|
||||
/* Note: We always return ARCHIVE_OK here, even if some of the
|
||||
* above return ARCHIVE_WARN. The intent here is to enable
|
||||
|
@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "archive_private.h"
|
||||
#include "archive_read_private.h"
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
|
||||
struct private_data {
|
||||
bz_stream stream;
|
||||
char *out_block;
|
||||
@ -86,7 +86,7 @@ archive_read_support_compression_bzip2(struct archive *_a)
|
||||
reader->init = bzip2_reader_init;
|
||||
reader->options = NULL;
|
||||
reader->free = bzip2_reader_free;
|
||||
#if HAVE_BZLIB_H
|
||||
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
|
||||
return (ARCHIVE_OK);
|
||||
#else
|
||||
archive_set_error(_a, ARCHIVE_ERRNO_MISC,
|
||||
@ -146,7 +146,7 @@ bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_fi
|
||||
return (bits_checked);
|
||||
}
|
||||
|
||||
#ifndef HAVE_BZLIB_H
|
||||
#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
|
||||
|
||||
/*
|
||||
* If we don't have the library on this system, we can't actually do the
|
||||
|
288
lib/libarchive/archive_read_support_compression_rpm.c
Normal file
288
lib/libarchive/archive_read_support_compression_rpm.c
Normal file
@ -0,0 +1,288 @@
|
||||
/*-
|
||||
* Copyright (c) 2009 Michihiro NAKAJIMA
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "archive_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "archive.h"
|
||||
#include "archive_endian.h"
|
||||
#include "archive_private.h"
|
||||
#include "archive_read_private.h"
|
||||
|
||||
struct rpm {
|
||||
int64_t total_in;
|
||||
size_t hpos;
|
||||
size_t hlen;
|
||||
unsigned char header[16];
|
||||
enum {
|
||||
ST_LEAD, /* Skipping 'Lead' section. */
|
||||
ST_HEADER, /* Reading 'Header' section;
|
||||
* first 16 bytes. */
|
||||
ST_HEADER_DATA, /* Skipping 'Header' section. */
|
||||
ST_PADDING, /* Skipping padding data after the
|
||||
* 'Header' section. */
|
||||
ST_ARCHIVE /* Reading 'Archive' section. */
|
||||
} state;
|
||||
int first_header;
|
||||
};
|
||||
#define RPM_LEAD_SIZE 96 /* Size of 'Lead' section. */
|
||||
|
||||
static int rpm_bidder_bid(struct archive_read_filter_bidder *,
|
||||
struct archive_read_filter *);
|
||||
static int rpm_bidder_init(struct archive_read_filter *);
|
||||
|
||||
static ssize_t rpm_filter_read(struct archive_read_filter *,
|
||||
const void **);
|
||||
static int rpm_filter_close(struct archive_read_filter *);
|
||||
|
||||
int
|
||||
archive_read_support_compression_rpm(struct archive *_a)
|
||||
{
|
||||
struct archive_read *a = (struct archive_read *)_a;
|
||||
struct archive_read_filter_bidder *bidder;
|
||||
|
||||
bidder = __archive_read_get_bidder(a);
|
||||
archive_clear_error(_a);
|
||||
if (bidder == NULL)
|
||||
return (ARCHIVE_FATAL);
|
||||
|
||||
bidder->data = NULL;
|
||||
bidder->bid = rpm_bidder_bid;
|
||||
bidder->init = rpm_bidder_init;
|
||||
bidder->options = NULL;
|
||||
bidder->free = NULL;
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
rpm_bidder_bid(struct archive_read_filter_bidder *self,
|
||||
struct archive_read_filter *filter)
|
||||
{
|
||||
const unsigned char *b;
|
||||
ssize_t avail;
|
||||
int bits_checked;
|
||||
|
||||
(void)self; /* UNUSED */
|
||||
|
||||
b = __archive_read_filter_ahead(filter, 8, &avail);
|
||||
if (b == NULL)
|
||||
return (0);
|
||||
|
||||
bits_checked = 0;
|
||||
/*
|
||||
* Verify Header Magic Bytes : 0xed 0xab 0xee 0xdb
|
||||
*/
|
||||
if (b[0] != 0xed)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
if (b[1] != 0xab)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
if (b[2] != 0xee)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
if (b[3] != 0xdb)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
/*
|
||||
* Check major version.
|
||||
*/
|
||||
if (b[4] != 3 && b[4] != 4)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
/*
|
||||
* Check package type; binary or source.
|
||||
*/
|
||||
if (b[6] != 0)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
if (b[7] != 0 && b[7] != 1)
|
||||
return (0);
|
||||
bits_checked += 8;
|
||||
|
||||
return (bits_checked);
|
||||
}
|
||||
|
||||
static int
|
||||
rpm_bidder_init(struct archive_read_filter *self)
|
||||
{
|
||||
struct rpm *rpm;
|
||||
|
||||
self->code = ARCHIVE_COMPRESSION_RPM;
|
||||
self->name = "rpm";
|
||||
self->read = rpm_filter_read;
|
||||
self->skip = NULL; /* not supported */
|
||||
self->close = rpm_filter_close;
|
||||
|
||||
rpm = (struct rpm *)calloc(sizeof(*rpm), 1);
|
||||
if (rpm == NULL) {
|
||||
archive_set_error(&self->archive->archive, ENOMEM,
|
||||
"Can't allocate data for rpm");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
||||
self->data = rpm;
|
||||
rpm->state = ST_LEAD;
|
||||
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
rpm_filter_read(struct archive_read_filter *self, const void **buff)
|
||||
{
|
||||
struct rpm *rpm;
|
||||
const unsigned char *b;
|
||||
ssize_t avail_in, total;
|
||||
size_t used, n;
|
||||
uint32_t section;
|
||||
uint32_t bytes;
|
||||
|
||||
rpm = (struct rpm *)self->data;
|
||||
*buff = NULL;
|
||||
total = avail_in = 0;
|
||||
b = NULL;
|
||||
used = 0;
|
||||
do {
|
||||
if (b == NULL) {
|
||||
b = __archive_read_filter_ahead(self->upstream, 1,
|
||||
&avail_in);
|
||||
if (b == NULL) {
|
||||
if (avail_in < 0)
|
||||
return (ARCHIVE_FATAL);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (rpm->state) {
|
||||
case ST_LEAD:
|
||||
if (rpm->total_in + avail_in < RPM_LEAD_SIZE)
|
||||
used += avail_in;
|
||||
else {
|
||||
n = RPM_LEAD_SIZE - rpm->total_in;
|
||||
used += n;
|
||||
b += n;
|
||||
rpm->state = ST_HEADER;
|
||||
rpm->hpos = 0;
|
||||
rpm->hlen = 0;
|
||||
rpm->first_header = 1;
|
||||
}
|
||||
break;
|
||||
case ST_HEADER:
|
||||
n = 16 - rpm->hpos;
|
||||
if (n > avail_in - used)
|
||||
n = avail_in - used;
|
||||
memcpy(rpm->header+rpm->hpos, b, n);
|
||||
b += n;
|
||||
used += n;
|
||||
rpm->hpos += n;
|
||||
|
||||
if (rpm->hpos == 16) {
|
||||
if (rpm->header[0] != 0x8e ||
|
||||
rpm->header[1] != 0xad ||
|
||||
rpm->header[2] != 0xe8 ||
|
||||
rpm->header[3] != 0x01) {
|
||||
if (rpm->first_header) {
|
||||
archive_set_error(
|
||||
&self->archive->archive,
|
||||
ARCHIVE_ERRNO_FILE_FORMAT,
|
||||
"Unrecoginized rpm header");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
rpm->state = ST_ARCHIVE;
|
||||
*buff = rpm->header;
|
||||
total = rpm->hpos;
|
||||
break;
|
||||
}
|
||||
/* Calculate 'Header' length. */
|
||||
section = archive_be32dec(rpm->header+8);
|
||||
bytes = archive_be32dec(rpm->header+12);
|
||||
rpm->hlen = 16 + section * 16 + bytes;
|
||||
rpm->state = ST_HEADER_DATA;
|
||||
rpm->first_header = 0;
|
||||
}
|
||||
break;
|
||||
case ST_HEADER_DATA:
|
||||
n = rpm->hlen - rpm->hpos;
|
||||
if (n > avail_in - used)
|
||||
n = avail_in - used;
|
||||
b += n;
|
||||
used += n;
|
||||
rpm->hpos += n;
|
||||
if (rpm->hpos == rpm->hlen)
|
||||
rpm->state = ST_PADDING;
|
||||
break;
|
||||
case ST_PADDING:
|
||||
while (used < (size_t)avail_in) {
|
||||
if (*b != 0) {
|
||||
/* Read next header. */
|
||||
rpm->state = ST_HEADER;
|
||||
rpm->hpos = 0;
|
||||
rpm->hlen = 0;
|
||||
break;
|
||||
}
|
||||
b++;
|
||||
used++;
|
||||
}
|
||||
break;
|
||||
case ST_ARCHIVE:
|
||||
*buff = b;
|
||||
total = avail_in;
|
||||
used = avail_in;
|
||||
break;
|
||||
}
|
||||
if (used == (size_t)avail_in) {
|
||||
rpm->total_in += used;
|
||||
__archive_read_filter_consume(self->upstream, used);
|
||||
b = NULL;
|
||||
used = 0;
|
||||
}
|
||||
} while (total == 0 && avail_in > 0);
|
||||
|
||||
if (used > 0 && b != NULL) {
|
||||
rpm->total_in += used;
|
||||
__archive_read_filter_consume(self->upstream, used);
|
||||
}
|
||||
return (total);
|
||||
}
|
||||
|
||||
static int
|
||||
rpm_filter_close(struct archive_read_filter *self)
|
||||
{
|
||||
struct rpm *rpm;
|
||||
|
||||
rpm = (struct rpm *)self->data;
|
||||
free(rpm);
|
||||
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ uudecode_bidder_bid(struct archive_read_filter_bidder *self,
|
||||
--len;
|
||||
}
|
||||
b += nl;
|
||||
|
||||
|
||||
if (avail >= 5 && memcmp(b, "====\n", 5) == 0)
|
||||
return (firstline+40);
|
||||
if (avail >= 6 && memcmp(b, "====\r\n", 6) == 0)
|
||||
|
@ -37,6 +37,7 @@ archive_read_support_format_all(struct archive *a)
|
||||
archive_read_support_format_iso9660(a);
|
||||
archive_read_support_format_mtree(a);
|
||||
archive_read_support_format_tar(a);
|
||||
archive_read_support_format_xar(a);
|
||||
archive_read_support_format_zip(a);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ process_add_entry(struct archive_read *a, struct mtree *mtree,
|
||||
line = next;
|
||||
next = line + strcspn(line, " \t\r\n");
|
||||
eq = strchr(line, '=');
|
||||
if (eq > next)
|
||||
if (eq == NULL || eq > next)
|
||||
len = next - line;
|
||||
else
|
||||
len = eq - line;
|
||||
|
3151
lib/libarchive/archive_read_support_format_xar.c
Normal file
3151
lib/libarchive/archive_read_support_format_xar.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -2477,7 +2477,7 @@ set_xattrs(struct archive_write_disk *a)
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
#elif HAVE_EXTATTR_SET_FILE
|
||||
#elif HAVE_EXTATTR_SET_FILE && HAVE_DECL_EXTATTR_NAMESPACE_USER
|
||||
/*
|
||||
* Restore extended attributes - FreeBSD implementation
|
||||
*/
|
||||
|
@ -117,6 +117,7 @@ lookup_gid(void *private_data, const char *gname, gid_t gid)
|
||||
/* Note: If strdup fails, that's okay; we just won't cache. */
|
||||
b->hash = h;
|
||||
#if HAVE_GRP_H
|
||||
# if HAVE_GETGRNAM_R
|
||||
{
|
||||
char _buffer[128];
|
||||
size_t bufsize = 128;
|
||||
@ -143,6 +144,15 @@ lookup_gid(void *private_data, const char *gname, gid_t gid)
|
||||
if (buffer != _buffer)
|
||||
free(buffer);
|
||||
}
|
||||
# else /* HAVE_GETGRNAM_R */
|
||||
{
|
||||
struct group *result;
|
||||
|
||||
result = getgrnam(gname);
|
||||
if (result != NULL)
|
||||
gid = result->gr_gid;
|
||||
}
|
||||
# endif /* HAVE_GETGRNAM_R */
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__)
|
||||
/* TODO: do a gname->gid lookup for Windows. */
|
||||
#else
|
||||
@ -177,6 +187,7 @@ lookup_uid(void *private_data, const char *uname, uid_t uid)
|
||||
/* Note: If strdup fails, that's okay; we just won't cache. */
|
||||
b->hash = h;
|
||||
#if HAVE_PWD_H
|
||||
# if HAVE_GETPWNAM_R
|
||||
{
|
||||
char _buffer[128];
|
||||
size_t bufsize = 128;
|
||||
@ -203,6 +214,15 @@ lookup_uid(void *private_data, const char *uname, uid_t uid)
|
||||
if (buffer != _buffer)
|
||||
free(buffer);
|
||||
}
|
||||
# else /* HAVE_GETPWNAM_R */
|
||||
{
|
||||
struct passwd *result;
|
||||
|
||||
result = getpwnam(uname);
|
||||
if (result != NULL)
|
||||
uid = result->pw_uid;
|
||||
}
|
||||
#endif /* HAVE_GETPWNAM_R */
|
||||
#elif defined(_WIN32) && !defined(__CYGWIN__)
|
||||
/* TODO: do a uname->uid lookup for Windows. */
|
||||
#else
|
||||
|
@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "archive_private.h"
|
||||
#include "archive_write_private.h"
|
||||
|
||||
#ifndef HAVE_BZLIB_H
|
||||
#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
|
||||
int
|
||||
archive_write_set_compression_bzip2(struct archive *a)
|
||||
{
|
||||
@ -405,4 +405,4 @@ drive_compressor(struct archive_write *a, struct private_data *state, int finish
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_BZLIB_H */
|
||||
#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */
|
||||
|
@ -70,6 +70,7 @@
|
||||
#define HAVE_BSDXML_H 1
|
||||
#define HAVE_CHFLAGS 1
|
||||
#define HAVE_CHOWN 1
|
||||
#define HAVE_DECL_EXTATTR_NAMESPACE_USER 1
|
||||
#define HAVE_DECL_INT64_MAX 1
|
||||
#define HAVE_DECL_INT64_MIN 1
|
||||
#define HAVE_DECL_SIZE_MAX 1
|
||||
@ -92,7 +93,9 @@
|
||||
#define HAVE_FTRUNCATE 1
|
||||
#define HAVE_FUTIMES 1
|
||||
#define HAVE_GETEUID 1
|
||||
#define HAVE_GETGRGID_R 1
|
||||
#define HAVE_GETPID 1
|
||||
#define HAVE_GETPWUID_R 1
|
||||
#define HAVE_GRP_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LCHFLAGS 1
|
||||
@ -149,6 +152,7 @@
|
||||
#define HAVE_UTIME_H 1
|
||||
#define HAVE_VFORK 1
|
||||
#define HAVE_WCHAR_H 1
|
||||
#define HAVE_WCSCMP 1
|
||||
#define HAVE_WCSCPY 1
|
||||
#define HAVE_WCSLEN 1
|
||||
#define HAVE_WCTOMB 1
|
||||
@ -162,3 +166,18 @@
|
||||
#define intmax_t int64_t
|
||||
#define uintmax_t uint64_t
|
||||
#endif
|
||||
|
||||
/* FreeBSD defines for archive_hash.h */
|
||||
#ifdef WITH_OPENSSL
|
||||
#define ARCHIVE_HASH_MD5_OPENSSL 1
|
||||
#define ARCHIVE_HASH_RMD160_OPENSSL 1
|
||||
#define ARCHIVE_HASH_SHA1_OPENSSL
|
||||
#define ARCHIVE_HASH_SHA256_OPENSSL 1
|
||||
#define ARCHIVE_HASH_SHA384_OPENSSL 1
|
||||
#define ARCHIVE_HASH_SHA512_OPENSSL 1
|
||||
#else
|
||||
#define ARCHIVE_HASH_MD5_LIBC 1
|
||||
#define ARCHIVE_HASH_SHA1_LIBC 1
|
||||
#define ARCHIVE_HASH_SHA256_LIBC 1
|
||||
#define ARCHIVE_HASH_SHA512_LIBC 1
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#if defined(HAVE_POLL)
|
||||
#if defined(HAVE_POLL) && (defined(HAVE_POLL_H) || defined(HAVE_SYS_POLL_H))
|
||||
# if defined(HAVE_POLL_H)
|
||||
# include <poll.h>
|
||||
# elif defined(HAVE_SYS_POLL_H)
|
||||
@ -121,7 +121,7 @@ __archive_create_child(const char *path, int *child_stdin, int *child_stdout)
|
||||
void
|
||||
__archive_check_child(int in, int out)
|
||||
{
|
||||
#if defined(HAVE_POLL)
|
||||
#if defined(HAVE_POLL) && (defined(HAVE_POLL_H) || defined(HAVE_SYS_POLL_H))
|
||||
struct pollfd fds[2];
|
||||
int idx;
|
||||
|
||||
|
74
lib/libarchive/libarchive_fe/err.c
Normal file
74
lib/libarchive/libarchive_fe/err.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*-
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "lafe_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "err.h"
|
||||
|
||||
const char *lafe_progname;
|
||||
|
||||
static void
|
||||
lafe_vwarnc(int code, const char *fmt, va_list ap)
|
||||
{
|
||||
fprintf(stderr, "%s: ", lafe_progname);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
if (code != 0)
|
||||
fprintf(stderr, ": %s", strerror(code));
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
lafe_warnc(int code, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
lafe_vwarnc(code, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
lafe_errc(int eval, int code, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
lafe_vwarnc(code, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(eval);
|
||||
}
|
43
lib/libarchive/libarchive_fe/err.h
Normal file
43
lib/libarchive/libarchive_fe/err.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* Copyright (c) 2009 Joerg Sonnenberger
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef LAFE_ERR_H
|
||||
#define LAFE_ERR_H
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2 || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
|
||||
#define __LA_DEAD __attribute__((__noreturn__))
|
||||
#else
|
||||
#define __LA_DEAD
|
||||
#endif
|
||||
|
||||
extern const char *lafe_progname;
|
||||
|
||||
void lafe_warnc(int code, const char *fmt, ...);
|
||||
void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD;
|
||||
|
||||
#endif
|
55
lib/libarchive/libarchive_fe/lafe_platform.h
Normal file
55
lib/libarchive/libarchive_fe/lafe_platform.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header is the first thing included in any of the libarchive_fe
|
||||
* source files. As far as possible, platform-specific issues should
|
||||
* be dealt with here and not within individual source files.
|
||||
*/
|
||||
|
||||
#ifndef LAFE_PLATFORM_H_INCLUDED
|
||||
#define LAFE_PLATFORM_H_INCLUDED
|
||||
|
||||
#if defined(PLATFORM_CONFIG_H)
|
||||
/* Use hand-built config.h in environments that need it. */
|
||||
#include PLATFORM_CONFIG_H
|
||||
#else
|
||||
/* Read config.h or die trying. */
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Get a real definition for __FBSDID if we can */
|
||||
#if HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/* If not, define it so as to avoid dangling semicolons. */
|
||||
#ifndef __FBSDID
|
||||
#define __FBSDID(a) struct _undefined_hack
|
||||
#endif
|
||||
|
||||
#endif
|
171
lib/libarchive/libarchive_fe/line_reader.c
Normal file
171
lib/libarchive/libarchive_fe/line_reader.c
Normal file
@ -0,0 +1,171 @@
|
||||
/*-
|
||||
* Copyright (c) 2008 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
|
||||
* in this position and unchanged.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "lafe_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "err.h"
|
||||
#include "line_reader.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__)
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read lines from file and do something with each one. If option_null
|
||||
* is set, lines are terminated with zero bytes; otherwise, they're
|
||||
* terminated with newlines.
|
||||
*
|
||||
* This uses a self-sizing buffer to handle arbitrarily-long lines.
|
||||
*/
|
||||
struct lafe_line_reader {
|
||||
FILE *f;
|
||||
char *buff, *buff_end, *line_start, *line_end, *p;
|
||||
char *pathname;
|
||||
size_t buff_length;
|
||||
int nullSeparator; /* Lines separated by null, not CR/CRLF/etc. */
|
||||
int ret;
|
||||
};
|
||||
|
||||
struct lafe_line_reader *
|
||||
lafe_line_reader(const char *pathname, int nullSeparator)
|
||||
{
|
||||
struct lafe_line_reader *lr;
|
||||
|
||||
lr = calloc(1, sizeof(*lr));
|
||||
if (lr == NULL)
|
||||
lafe_errc(1, ENOMEM, "Can't open %s", pathname);
|
||||
|
||||
lr->nullSeparator = nullSeparator;
|
||||
lr->pathname = strdup(pathname);
|
||||
|
||||
if (strcmp(pathname, "-") == 0)
|
||||
lr->f = stdin;
|
||||
else
|
||||
lr->f = fopen(pathname, "r");
|
||||
if (lr->f == NULL)
|
||||
lafe_errc(1, errno, "Couldn't open %s", pathname);
|
||||
lr->buff_length = 8192;
|
||||
lr->buff = malloc(lr->buff_length);
|
||||
if (lr->buff == NULL)
|
||||
lafe_errc(1, ENOMEM, "Can't read %s", pathname);
|
||||
lr->line_start = lr->line_end = lr->buff_end = lr->buff;
|
||||
|
||||
return (lr);
|
||||
}
|
||||
|
||||
const char *
|
||||
lafe_line_reader_next(struct lafe_line_reader *lr)
|
||||
{
|
||||
size_t bytes_wanted, bytes_read, new_buff_size;
|
||||
char *line_start, *p;
|
||||
|
||||
for (;;) {
|
||||
/* If there's a line in the buffer, return it immediately. */
|
||||
while (lr->line_end < lr->buff_end) {
|
||||
if (lr->nullSeparator) {
|
||||
if (*lr->line_end == '\0') {
|
||||
line_start = lr->line_start;
|
||||
lr->line_start = lr->line_end + 1;
|
||||
lr->line_end = lr->line_start;
|
||||
return (line_start);
|
||||
}
|
||||
} else if (*lr->line_end == '\x0a' || *lr->line_end == '\x0d') {
|
||||
*lr->line_end = '\0';
|
||||
line_start = lr->line_start;
|
||||
lr->line_start = lr->line_end + 1;
|
||||
lr->line_end = lr->line_start;
|
||||
if (line_start[0] != '\0')
|
||||
return (line_start);
|
||||
}
|
||||
lr->line_end++;
|
||||
}
|
||||
|
||||
/* If we're at end-of-file, process the final data. */
|
||||
if (lr->f == NULL) {
|
||||
/* If there's more text, return one last line. */
|
||||
if (lr->line_end > lr->line_start) {
|
||||
*lr->line_end = '\0';
|
||||
line_start = lr->line_start;
|
||||
lr->line_start = lr->line_end + 1;
|
||||
lr->line_end = lr->line_start;
|
||||
return (line_start);
|
||||
}
|
||||
/* Otherwise, we're done. */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Buffer only has part of a line. */
|
||||
if (lr->line_start > lr->buff) {
|
||||
/* Move a leftover fractional line to the beginning. */
|
||||
memmove(lr->buff, lr->line_start,
|
||||
lr->buff_end - lr->line_start);
|
||||
lr->buff_end -= lr->line_start - lr->buff;
|
||||
lr->line_end -= lr->line_start - lr->buff;
|
||||
lr->line_start = lr->buff;
|
||||
} else {
|
||||
/* Line is too big; enlarge the buffer. */
|
||||
new_buff_size = lr->buff_length * 2;
|
||||
if (new_buff_size <= lr->buff_length)
|
||||
lafe_errc(1, ENOMEM,
|
||||
"Line too long in %s", lr->pathname);
|
||||
lr->buff_length = new_buff_size;
|
||||
p = realloc(lr->buff, new_buff_size);
|
||||
if (p == NULL)
|
||||
lafe_errc(1, ENOMEM,
|
||||
"Line too long in %s", lr->pathname);
|
||||
lr->buff_end = p + (lr->buff_end - lr->buff);
|
||||
lr->line_end = p + (lr->line_end - lr->buff);
|
||||
lr->line_start = lr->buff = p;
|
||||
}
|
||||
|
||||
/* Get some more data into the buffer. */
|
||||
bytes_wanted = lr->buff + lr->buff_length - lr->buff_end;
|
||||
bytes_read = fread(lr->buff_end, 1, bytes_wanted, lr->f);
|
||||
lr->buff_end += bytes_read;
|
||||
|
||||
if (ferror(lr->f))
|
||||
lafe_errc(1, errno, "Can't read %s", lr->pathname);
|
||||
if (feof(lr->f)) {
|
||||
if (lr->f != stdin)
|
||||
fclose(lr->f);
|
||||
lr->f = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lafe_line_reader_free(struct lafe_line_reader *lr)
|
||||
{
|
||||
free(lr->buff);
|
||||
free(lr->pathname);
|
||||
free(lr);
|
||||
}
|
37
lib/libarchive/libarchive_fe/line_reader.h
Normal file
37
lib/libarchive/libarchive_fe/line_reader.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*-
|
||||
* Copyright (c) 2009 Joerg Sonnenberger
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef LAFE_LINE_READER_H
|
||||
#define LAFE_LINE_READER_H
|
||||
|
||||
struct lafe_line_reader;
|
||||
|
||||
struct lafe_line_reader *lafe_line_reader(const char *, int nullSeparator);
|
||||
const char *lafe_line_reader_next(struct lafe_line_reader *);
|
||||
void lafe_line_reader_free(struct lafe_line_reader *);
|
||||
|
||||
#endif
|
281
lib/libarchive/libarchive_fe/matching.c
Normal file
281
lib/libarchive/libarchive_fe/matching.c
Normal file
@ -0,0 +1,281 @@
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "lafe_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "err.h"
|
||||
#include "line_reader.h"
|
||||
#include "matching.h"
|
||||
#include "pathmatch.h"
|
||||
|
||||
struct match {
|
||||
struct match *next;
|
||||
int matches;
|
||||
char pattern[1];
|
||||
};
|
||||
|
||||
struct lafe_matching {
|
||||
struct match *exclusions;
|
||||
int exclusions_count;
|
||||
struct match *inclusions;
|
||||
int inclusions_count;
|
||||
int inclusions_unmatched_count;
|
||||
};
|
||||
|
||||
static void add_pattern(struct match **list, const char *pattern);
|
||||
static void initialize_matching(struct lafe_matching **);
|
||||
static int match_exclusion(struct match *, const char *pathname);
|
||||
static int match_inclusion(struct match *, const char *pathname);
|
||||
|
||||
/*
|
||||
* The matching logic here needs to be re-thought. I started out to
|
||||
* try to mimic gtar's matching logic, but it's not entirely
|
||||
* consistent. In particular 'tar -t' and 'tar -x' interpret patterns
|
||||
* on the command line as anchored, but --exclude doesn't.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Utility functions to manage exclusion/inclusion patterns
|
||||
*/
|
||||
|
||||
int
|
||||
lafe_exclude(struct lafe_matching **matching, const char *pattern)
|
||||
{
|
||||
|
||||
if (*matching == NULL)
|
||||
initialize_matching(matching);
|
||||
add_pattern(&((*matching)->exclusions), pattern);
|
||||
(*matching)->exclusions_count++;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
lafe_exclude_from_file(struct lafe_matching **matching, const char *pathname)
|
||||
{
|
||||
struct lafe_line_reader *lr;
|
||||
const char *p;
|
||||
int ret = 0;
|
||||
|
||||
lr = lafe_line_reader(pathname, 0);
|
||||
while ((p = lafe_line_reader_next(lr)) != NULL) {
|
||||
if (lafe_exclude(matching, p) != 0)
|
||||
ret = -1;
|
||||
}
|
||||
lafe_line_reader_free(lr);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
lafe_include(struct lafe_matching **matching, const char *pattern)
|
||||
{
|
||||
|
||||
if (*matching == NULL)
|
||||
initialize_matching(matching);
|
||||
add_pattern(&((*matching)->inclusions), pattern);
|
||||
(*matching)->inclusions_count++;
|
||||
(*matching)->inclusions_unmatched_count++;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
lafe_include_from_file(struct lafe_matching **matching, const char *pathname,
|
||||
int nullSeparator)
|
||||
{
|
||||
struct lafe_line_reader *lr;
|
||||
const char *p;
|
||||
int ret = 0;
|
||||
|
||||
lr = lafe_line_reader(pathname, nullSeparator);
|
||||
while ((p = lafe_line_reader_next(lr)) != NULL) {
|
||||
if (lafe_include(matching, p) != 0)
|
||||
ret = -1;
|
||||
}
|
||||
lafe_line_reader_free(lr);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static void
|
||||
add_pattern(struct match **list, const char *pattern)
|
||||
{
|
||||
struct match *match;
|
||||
size_t len;
|
||||
|
||||
len = strlen(pattern);
|
||||
match = malloc(sizeof(*match) + len + 1);
|
||||
if (match == NULL)
|
||||
lafe_errc(1, errno, "Out of memory");
|
||||
strcpy(match->pattern, pattern);
|
||||
/* Both "foo/" and "foo" should match "foo/bar". */
|
||||
if (len && match->pattern[len - 1] == '/')
|
||||
match->pattern[strlen(match->pattern)-1] = '\0';
|
||||
match->next = *list;
|
||||
*list = match;
|
||||
match->matches = 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
lafe_excluded(struct lafe_matching *matching, const char *pathname)
|
||||
{
|
||||
struct match *match;
|
||||
struct match *matched;
|
||||
|
||||
if (matching == NULL)
|
||||
return (0);
|
||||
|
||||
/* Mark off any unmatched inclusions. */
|
||||
/* In particular, if a filename does appear in the archive and
|
||||
* is explicitly included and excluded, then we don't report
|
||||
* it as missing even though we don't extract it.
|
||||
*/
|
||||
matched = NULL;
|
||||
for (match = matching->inclusions; match != NULL; match = match->next){
|
||||
if (match->matches == 0
|
||||
&& match_inclusion(match, pathname)) {
|
||||
matching->inclusions_unmatched_count--;
|
||||
match->matches++;
|
||||
matched = match;
|
||||
}
|
||||
}
|
||||
|
||||
/* Exclusions take priority */
|
||||
for (match = matching->exclusions; match != NULL; match = match->next){
|
||||
if (match_exclusion(match, pathname))
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* It's not excluded and we found an inclusion above, so it's included. */
|
||||
if (matched != NULL)
|
||||
return (0);
|
||||
|
||||
|
||||
/* We didn't find an unmatched inclusion, check the remaining ones. */
|
||||
for (match = matching->inclusions; match != NULL; match = match->next){
|
||||
/* We looked at previously-unmatched inclusions already. */
|
||||
if (match->matches > 0
|
||||
&& match_inclusion(match, pathname)) {
|
||||
match->matches++;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* If there were inclusions, default is to exclude. */
|
||||
if (matching->inclusions != NULL)
|
||||
return (1);
|
||||
|
||||
/* No explicit inclusions, default is to match. */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a little odd, but it matches the default behavior of
|
||||
* gtar. In particular, 'a*b' will match 'foo/a1111/222b/bar'
|
||||
*
|
||||
*/
|
||||
static int
|
||||
match_exclusion(struct match *match, const char *pathname)
|
||||
{
|
||||
return (lafe_pathmatch(match->pattern,
|
||||
pathname,
|
||||
PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END));
|
||||
}
|
||||
|
||||
/*
|
||||
* Again, mimic gtar: inclusions are always anchored (have to match
|
||||
* the beginning of the path) even though exclusions are not anchored.
|
||||
*/
|
||||
static int
|
||||
match_inclusion(struct match *match, const char *pathname)
|
||||
{
|
||||
return (lafe_pathmatch(match->pattern, pathname, PATHMATCH_NO_ANCHOR_END));
|
||||
}
|
||||
|
||||
void
|
||||
lafe_cleanup_exclusions(struct lafe_matching **matching)
|
||||
{
|
||||
struct match *p, *q;
|
||||
|
||||
if (*matching == NULL)
|
||||
return;
|
||||
|
||||
for (p = (*matching)->inclusions; p != NULL; ) {
|
||||
q = p;
|
||||
p = p->next;
|
||||
free(q);
|
||||
}
|
||||
|
||||
for (p = (*matching)->exclusions; p != NULL; ) {
|
||||
q = p;
|
||||
p = p->next;
|
||||
free(q);
|
||||
}
|
||||
|
||||
free(*matching);
|
||||
*matching = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
initialize_matching(struct lafe_matching **matching)
|
||||
{
|
||||
*matching = calloc(sizeof(**matching), 1);
|
||||
if (*matching == NULL)
|
||||
lafe_errc(1, errno, "No memory");
|
||||
}
|
||||
|
||||
int
|
||||
lafe_unmatched_inclusions(struct lafe_matching *matching)
|
||||
{
|
||||
|
||||
if (matching == NULL)
|
||||
return (0);
|
||||
return (matching->inclusions_unmatched_count);
|
||||
}
|
||||
|
||||
int
|
||||
lafe_unmatched_inclusions_warn(struct lafe_matching *matching, const char *msg)
|
||||
{
|
||||
struct match *p;
|
||||
|
||||
if (matching == NULL)
|
||||
return (0);
|
||||
|
||||
for (p = matching->inclusions; p != NULL; p = p->next) {
|
||||
if (p->matches == 0)
|
||||
lafe_warnc(0, "%s: %s", p->pattern, msg);
|
||||
}
|
||||
|
||||
return (matching->inclusions_unmatched_count);
|
||||
}
|
46
lib/libarchive/libarchive_fe/matching.h
Normal file
46
lib/libarchive/libarchive_fe/matching.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*-
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef MATCHING_H
|
||||
#define MATCHING_H
|
||||
|
||||
struct lafe_matching;
|
||||
|
||||
int lafe_exclude(struct lafe_matching **matching, const char *pattern);
|
||||
int lafe_exclude_from_file(struct lafe_matching **matching,
|
||||
const char *pathname);
|
||||
int lafe_include(struct lafe_matching **matching, const char *pattern);
|
||||
int lafe_include_from_file(struct lafe_matching **matching,
|
||||
const char *pathname, int nullSeparator);
|
||||
|
||||
int lafe_excluded(struct lafe_matching *, const char *pathname);
|
||||
void lafe_cleanup_exclusions(struct lafe_matching **);
|
||||
int lafe_unmatched_inclusions(struct lafe_matching *);
|
||||
int lafe_unmatched_inclusions_warn(struct lafe_matching *, const char *msg);
|
||||
|
||||
#endif
|
255
lib/libarchive/libarchive_fe/pathmatch.c
Normal file
255
lib/libarchive/libarchive_fe/pathmatch.c
Normal file
@ -0,0 +1,255 @@
|
||||
/*-
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "lafe_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "pathmatch.h"
|
||||
|
||||
/*
|
||||
* Check whether a character 'c' is matched by a list specification [...]:
|
||||
* * Leading '!' or '^' negates the class.
|
||||
* * <char>-<char> is a range of characters
|
||||
* * \<char> removes any special meaning for <char>
|
||||
*
|
||||
* Some interesting boundary cases:
|
||||
* a-d-e is one range (a-d) followed by two single characters - and e.
|
||||
* \a-\d is same as a-d
|
||||
* a\-d is three single characters: a, d, -
|
||||
* Trailing - is not special (so [a-] is two characters a and -).
|
||||
* Initial - is not special ([a-] is same as [-a] is same as [\\-a])
|
||||
* This function never sees a trailing \.
|
||||
* [] always fails
|
||||
* [!] always succeeds
|
||||
*/
|
||||
static int
|
||||
pm_list(const char *start, const char *end, const char c, int flags)
|
||||
{
|
||||
const char *p = start;
|
||||
char rangeStart = '\0', nextRangeStart;
|
||||
int match = 1, nomatch = 0;
|
||||
|
||||
/* This will be used soon... */
|
||||
(void)flags; /* UNUSED */
|
||||
|
||||
/* If this is a negated class, return success for nomatch. */
|
||||
if ((*p == '!' || *p == '^') && p < end) {
|
||||
match = 0;
|
||||
nomatch = 1;
|
||||
++p;
|
||||
}
|
||||
|
||||
while (p < end) {
|
||||
nextRangeStart = '\0';
|
||||
switch (*p) {
|
||||
case '-':
|
||||
/* Trailing or initial '-' is not special. */
|
||||
if ((rangeStart == '\0') || (p == end - 1)) {
|
||||
if (*p == c)
|
||||
return (match);
|
||||
} else {
|
||||
char rangeEnd = *++p;
|
||||
if (rangeEnd == '\\')
|
||||
rangeEnd = *++p;
|
||||
if ((rangeStart <= c) && (c <= rangeEnd))
|
||||
return (match);
|
||||
}
|
||||
break;
|
||||
case '\\':
|
||||
++p;
|
||||
/* Fall through */
|
||||
default:
|
||||
if (*p == c)
|
||||
return (match);
|
||||
nextRangeStart = *p; /* Possible start of range. */
|
||||
}
|
||||
rangeStart = nextRangeStart;
|
||||
++p;
|
||||
}
|
||||
return (nomatch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If s is pointing to "./", ".//", "./././" or the like, skip it.
|
||||
*/
|
||||
static const char *
|
||||
pm_slashskip(const char *s) {
|
||||
while ((*s == '/')
|
||||
|| (s[0] == '.' && s[1] == '/')
|
||||
|| (s[0] == '.' && s[1] == '\0'))
|
||||
++s;
|
||||
return (s);
|
||||
}
|
||||
|
||||
static int
|
||||
pm(const char *p, const char *s, int flags)
|
||||
{
|
||||
const char *end;
|
||||
|
||||
/*
|
||||
* Ignore leading './', './/', '././', etc.
|
||||
*/
|
||||
if (s[0] == '.' && s[1] == '/')
|
||||
s = pm_slashskip(s + 1);
|
||||
if (p[0] == '.' && p[1] == '/')
|
||||
p = pm_slashskip(p + 1);
|
||||
|
||||
for (;;) {
|
||||
switch (*p) {
|
||||
case '\0':
|
||||
if (s[0] == '/') {
|
||||
if (flags & PATHMATCH_NO_ANCHOR_END)
|
||||
return (1);
|
||||
/* "dir" == "dir/" == "dir/." */
|
||||
s = pm_slashskip(s);
|
||||
}
|
||||
return (*s == '\0');
|
||||
case '?':
|
||||
/* ? always succeds, unless we hit end of 's' */
|
||||
if (*s == '\0')
|
||||
return (0);
|
||||
break;
|
||||
case '*':
|
||||
/* "*" == "**" == "***" ... */
|
||||
while (*p == '*')
|
||||
++p;
|
||||
/* Trailing '*' always succeeds. */
|
||||
if (*p == '\0')
|
||||
return (1);
|
||||
while (*s) {
|
||||
if (lafe_pathmatch(p, s, flags))
|
||||
return (1);
|
||||
++s;
|
||||
}
|
||||
return (0);
|
||||
case '[':
|
||||
/*
|
||||
* Find the end of the [...] character class,
|
||||
* ignoring \] that might occur within the class.
|
||||
*/
|
||||
end = p + 1;
|
||||
while (*end != '\0' && *end != ']') {
|
||||
if (*end == '\\' && end[1] != '\0')
|
||||
++end;
|
||||
++end;
|
||||
}
|
||||
if (*end == ']') {
|
||||
/* We found [...], try to match it. */
|
||||
if (!pm_list(p + 1, end, *s, flags))
|
||||
return (0);
|
||||
p = end; /* Jump to trailing ']' char. */
|
||||
break;
|
||||
} else
|
||||
/* No final ']', so just match '['. */
|
||||
if (*p != *s)
|
||||
return (0);
|
||||
break;
|
||||
case '\\':
|
||||
/* Trailing '\\' matches itself. */
|
||||
if (p[1] == '\0') {
|
||||
if (*s != '\\')
|
||||
return (0);
|
||||
} else {
|
||||
++p;
|
||||
if (*p != *s)
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
if (*s != '/' && *s != '\0')
|
||||
return (0);
|
||||
/* Note: pattern "/\./" won't match "/";
|
||||
* pm_slashskip() correctly stops at backslash. */
|
||||
p = pm_slashskip(p);
|
||||
s = pm_slashskip(s);
|
||||
if (*p == '\0' && (flags & PATHMATCH_NO_ANCHOR_END))
|
||||
return (1);
|
||||
--p; /* Counteract the increment below. */
|
||||
--s;
|
||||
break;
|
||||
case '$':
|
||||
/* '$' is special only at end of pattern and only
|
||||
* if PATHMATCH_NO_ANCHOR_END is specified. */
|
||||
if (p[1] == '\0' && (flags & PATHMATCH_NO_ANCHOR_END)){
|
||||
/* "dir" == "dir/" == "dir/." */
|
||||
return (*pm_slashskip(s) == '\0');
|
||||
}
|
||||
/* Otherwise, '$' is not special. */
|
||||
/* FALL THROUGH */
|
||||
default:
|
||||
if (*p != *s)
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
++p;
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
/* Main entry point. */
|
||||
int
|
||||
lafe_pathmatch(const char *p, const char *s, int flags)
|
||||
{
|
||||
/* Empty pattern only matches the empty string. */
|
||||
if (p == NULL || *p == '\0')
|
||||
return (s == NULL || *s == '\0');
|
||||
|
||||
/* Leading '^' anchors the start of the pattern. */
|
||||
if (*p == '^') {
|
||||
++p;
|
||||
flags &= ~PATHMATCH_NO_ANCHOR_START;
|
||||
}
|
||||
|
||||
if (*p == '/' && *s != '/')
|
||||
return (0);
|
||||
|
||||
/* Certain patterns and file names anchor implicitly. */
|
||||
if (*p == '*' || *p == '/' || *p == '/') {
|
||||
while (*p == '/')
|
||||
++p;
|
||||
while (*s == '/')
|
||||
++s;
|
||||
return (pm(p, s, flags));
|
||||
}
|
||||
|
||||
/* If start is unanchored, try to match start of each path element. */
|
||||
if (flags & PATHMATCH_NO_ANCHOR_START) {
|
||||
for ( ; s != NULL; s = strchr(s, '/')) {
|
||||
if (*s == '/')
|
||||
s++;
|
||||
if (pm(p, s, flags))
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Default: Match from beginning. */
|
||||
return (pm(p, s, flags));
|
||||
}
|
42
lib/libarchive/libarchive_fe/pathmatch.h
Normal file
42
lib/libarchive/libarchive_fe/pathmatch.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*-
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef LAFE_PATHMATCH_H
|
||||
#define LAFE_PATHMATCH_H
|
||||
|
||||
/* Don't anchor at beginning unless the pattern starts with "^" */
|
||||
#define PATHMATCH_NO_ANCHOR_START 1
|
||||
/* Don't anchor at end unless the pattern ends with "$" */
|
||||
#define PATHMATCH_NO_ANCHOR_END 2
|
||||
|
||||
/* Note that "^" and "$" are not special unless you set the corresponding
|
||||
* flag above. */
|
||||
|
||||
int lafe_pathmatch(const char *p, const char *s, int flags);
|
||||
|
||||
#endif
|
@ -45,6 +45,8 @@ TESTS= \
|
||||
test_read_format_cpio_odc.c \
|
||||
test_read_format_cpio_svr4_gzip.c \
|
||||
test_read_format_cpio_svr4c_Z.c \
|
||||
test_read_format_cpio_svr4_bzip2_rpm.c \
|
||||
test_read_format_cpio_svr4_gzip_rpm.c \
|
||||
test_read_format_empty.c \
|
||||
test_read_format_gtar_gz.c \
|
||||
test_read_format_gtar_lzma.c \
|
||||
@ -69,6 +71,7 @@ TESTS= \
|
||||
test_read_format_tlz.c \
|
||||
test_read_format_txz.c \
|
||||
test_read_format_tz.c \
|
||||
test_read_format_xar.c \
|
||||
test_read_format_zip.c \
|
||||
test_read_large.c \
|
||||
test_read_pax_truncated.c \
|
||||
|
@ -346,7 +346,7 @@ failure_finish(void *extra)
|
||||
if (dump_on_failure) {
|
||||
fprintf(stderr,
|
||||
" *** forcing core dump so failure can be debugged ***\n");
|
||||
*(char *)(NULL) = 0;
|
||||
abort();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -485,6 +485,22 @@ wcsdump(const char *e, const wchar_t *w)
|
||||
logprintf("\"\n");
|
||||
}
|
||||
|
||||
#ifndef HAVE_WCSCMP
|
||||
static int
|
||||
wcscmp(const wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
|
||||
while (*s1 == *s2++) {
|
||||
if (*s1++ == L'\0')
|
||||
return 0;
|
||||
}
|
||||
if (*s1 > *--s2)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Verify that two wide strings are equal, dump them if not. */
|
||||
int
|
||||
assertion_equal_wstring(const char *file, int line,
|
||||
|
@ -43,16 +43,13 @@ struct read_memory_data {
|
||||
unsigned char *end;
|
||||
size_t read_size;
|
||||
size_t copy_buff_size;
|
||||
size_t copy_buff_offset;
|
||||
char *copy_buff;
|
||||
};
|
||||
|
||||
static int memory_read_close(struct archive *, void *);
|
||||
static int memory_read_open(struct archive *, void *);
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
static ssize_t memory_read_skip(struct archive *, void *, size_t request);
|
||||
#else
|
||||
static off_t memory_read_skip(struct archive *, void *, off_t request);
|
||||
#endif
|
||||
static ssize_t memory_read(struct archive *, void *, const void **buff);
|
||||
static int read_open_memory_internal(struct archive *a, void *buff,
|
||||
size_t size, size_t read_size, int fullapi);
|
||||
@ -89,8 +86,10 @@ read_open_memory_internal(struct archive *a, void *buff,
|
||||
mine->buffer = (unsigned char *)buff;
|
||||
mine->end = mine->buffer + size;
|
||||
mine->read_size = read_size;
|
||||
mine->copy_buff_size = read_size + 64;
|
||||
mine->copy_buff_offset = 32;
|
||||
mine->copy_buff_size = read_size + mine->copy_buff_offset * 2;
|
||||
mine->copy_buff = malloc(mine->copy_buff_size);
|
||||
memset(mine->copy_buff, 0xA5, mine->copy_buff_size);
|
||||
if (fullapi)
|
||||
return (archive_read_open2(a, mine, memory_read_open,
|
||||
memory_read, memory_read_skip, memory_read_close));
|
||||
@ -126,9 +125,10 @@ memory_read(struct archive *a, void *client_data, const void **buff)
|
||||
size = mine->end - mine->buffer;
|
||||
if (size > mine->read_size)
|
||||
size = mine->read_size;
|
||||
memset(mine->copy_buff, 0xA5, mine->copy_buff_size);
|
||||
memcpy(mine->copy_buff, mine->buffer, size);
|
||||
*buff = mine->copy_buff;
|
||||
else
|
||||
memset(mine->copy_buff, 0xA5, mine->copy_buff_size);
|
||||
memcpy(mine->copy_buff + mine->copy_buff_offset, mine->buffer, size);
|
||||
*buff = mine->copy_buff + mine->copy_buff_offset;
|
||||
|
||||
mine->buffer += size;
|
||||
return ((ssize_t)size);
|
||||
@ -137,13 +137,8 @@ memory_read(struct archive *a, void *client_data, const void **buff)
|
||||
/*
|
||||
* How mean can a skip() routine be? Let's try to find out.
|
||||
*/
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
static ssize_t
|
||||
memory_read_skip(struct archive *a, void *client_data, size_t skip)
|
||||
#else
|
||||
static off_t
|
||||
memory_read_skip(struct archive *a, void *client_data, off_t skip)
|
||||
#endif
|
||||
{
|
||||
struct read_memory_data *mine = (struct read_memory_data *)client_data;
|
||||
|
||||
|
@ -48,9 +48,6 @@
|
||||
#include <sys/types.h> /* Windows requires this before sys/stat.h */
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef USE_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif
|
||||
#if HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
@ -299,3 +296,7 @@ int read_open_memory2(struct archive *, void *, size_t, size_t);
|
||||
assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
|
||||
#define assertEqualStringA(a,v1,v2) \
|
||||
assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
|
||||
|
||||
#ifdef USE_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif
|
||||
|
@ -27,6 +27,16 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifndef HAVE_WCSCPY
|
||||
static wchar_t * wcscpy(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
wchar_t *dest = s1;
|
||||
while ((*s1 = *s2) != L'\0')
|
||||
++s1, ++s2;
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Most of these tests are system-independent, though a few depend on
|
||||
* features of the local system. Such tests are conditionalized on
|
||||
@ -866,6 +876,7 @@ DEFINE_TEST(test_entry)
|
||||
assert(NULL == archive_entry_symlink_w(e));
|
||||
}
|
||||
|
||||
#if HAVE_WCSCPY
|
||||
l = 0x12345678L;
|
||||
wc = (wchar_t)l; /* Wide character too big for UTF-8. */
|
||||
if (NULL == setlocale(LC_ALL, "C") || (long)wc != l) {
|
||||
@ -885,6 +896,7 @@ DEFINE_TEST(test_entry)
|
||||
failure("Converting wide characters from Unicode should fail.");
|
||||
assertEqualString(NULL, archive_entry_pathname(e));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Release the experimental entry. */
|
||||
archive_entry_free(e);
|
||||
|
@ -62,6 +62,7 @@ static struct {
|
||||
{0, "test_compat_zip_1.zip"},
|
||||
{0, "test_read_format_ar.ar"},
|
||||
{0, "test_read_format_cpio_bin_be.cpio"},
|
||||
{0, "test_read_format_cpio_svr4_gzip_rpm.rpm"}, /* Test RPM unwrapper */
|
||||
{0, "test_read_format_gtar_sparse_1_17_posix10_modified.tar"},
|
||||
{0, "test_read_format_mtree.mtree"},
|
||||
{0, "test_read_format_tar_empty_filename.tar"},
|
||||
@ -111,8 +112,10 @@ DEFINE_TEST(test_fuzz)
|
||||
assert(size > 0);
|
||||
failure("Internal buffer is not big enough for "
|
||||
"uncompressed test file: %s", filename);
|
||||
if (!assert(size < buffsize))
|
||||
if (!assert(size < buffsize)) {
|
||||
free(rawimage);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
rawimage = slurpfile(&size, filename);
|
||||
if (!assert(rawimage != NULL))
|
||||
@ -152,8 +155,8 @@ DEFINE_TEST(test_fuzz)
|
||||
continue;
|
||||
}
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
}
|
||||
archive_read_finish(a);
|
||||
}
|
||||
free(image);
|
||||
free(rawimage);
|
||||
|
@ -225,9 +225,11 @@ test_pax_filename_encoding_3(void)
|
||||
* setlocale() does not set the default encoding for CP_ACP. */
|
||||
entry = archive_entry_new();
|
||||
if (archive_entry_update_pathname_utf8(entry, badname_utf8)) {
|
||||
archive_entry_free(entry);
|
||||
skipping("Cannot test conversion failures.");
|
||||
return;
|
||||
}
|
||||
archive_entry_free(entry);
|
||||
|
||||
assert((a = archive_write_new()) != NULL);
|
||||
assertEqualIntA(a, 0, archive_write_set_format_pax(a));
|
||||
|
@ -69,7 +69,7 @@ DEFINE_TEST(test_read_data_large)
|
||||
archive_entry_set_size(ae, sizeof(buff2));
|
||||
assertA(0 == archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
assertA(sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
|
||||
assertA((int)sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
|
||||
|
||||
/* Close out the archive. */
|
||||
assertA(0 == archive_write_close(a));
|
||||
|
128
lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
Normal file
128
lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* Copyright (c) 2009 Michihiro NAKAJIMA
|
||||
* 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.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
Execute the following command to rebuild the data for this program:
|
||||
tail -n +32 test_read_format_cpio_svr4_bzip2_rpm.c | /bin/sh
|
||||
|
||||
F=test_read_format_cpio_svr4_bzip2_rpm.rpm
|
||||
NAME=rpmsample
|
||||
TMPRPM=/tmp/rpm
|
||||
rm -rf ${TMPRPM}
|
||||
mkdir -p ${TMPRPM}/BUILD
|
||||
mkdir -p ${TMPRPM}/RPMS
|
||||
mkdir -p ${TMPRPM}/SOURCES
|
||||
mkdir -p ${TMPRPM}/SPECS
|
||||
mkdir -p ${TMPRPM}/SRPMS
|
||||
echo "hello" > ${TMPRPM}/BUILD/file1
|
||||
echo "hello" > ${TMPRPM}/BUILD/file2
|
||||
echo "hello" > ${TMPRPM}/BUILD/file3
|
||||
cat > ${TMPRPM}/SPECS/${NAME}.spec <<END
|
||||
##
|
||||
%define _topdir ${TMPRPM}
|
||||
%define _binary_payload w9.bzdio
|
||||
|
||||
Summary: Sample data of RPM filter of libarchive
|
||||
Name: ${NAME}
|
||||
Version: 1.0.0
|
||||
Release: 1
|
||||
License: BSD
|
||||
URL: http://code.google.com/p/libarchive
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%install
|
||||
rm -rf \$RPM_BUILD_ROOT
|
||||
|
||||
mkdir -p \$RPM_BUILD_ROOT%{_sysconfdir}
|
||||
install -m 644 file1 \$RPM_BUILD_ROOT%{_sysconfdir}/file1
|
||||
install -m 644 file2 \$RPM_BUILD_ROOT%{_sysconfdir}/file2
|
||||
install -m 644 file3 \$RPM_BUILD_ROOT%{_sysconfdir}/file3
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file1
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file2
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file3
|
||||
|
||||
%files
|
||||
%{_sysconfdir}/file1
|
||||
%{_sysconfdir}/file2
|
||||
%{_sysconfdir}/file3
|
||||
|
||||
%description
|
||||
Sample data.
|
||||
END
|
||||
#
|
||||
rpmbuild -bb ${TMPRPM}/SPECS/${NAME}.spec
|
||||
uuencode ${F} < ${TMPRPM}/RPMS/noarch/${NAME}-1.0.0-1.noarch.rpm > ${F}.uu
|
||||
|
||||
rm -rf ${TMPRPM}
|
||||
exit 1
|
||||
*/
|
||||
|
||||
DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
const char *name = "test_read_format_cpio_svr4_bzip2_rpm.rpm";
|
||||
int r;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
r = archive_read_support_compression_bzip2(a);
|
||||
if (r == ARCHIVE_WARN) {
|
||||
skipping("bzip2 reading not fully supported on this platform");
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
return;
|
||||
}
|
||||
assertEqualIntA(a, ARCHIVE_OK, r);
|
||||
assertEqualIntA(a, ARCHIVE_OK,
|
||||
archive_read_support_compression_rpm(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||
extract_reference_file(name);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file1", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file2", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file3", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
|
||||
/* Verify the end-of-archive. */
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
/* Verify that the format detection worked. */
|
||||
assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2);
|
||||
assertEqualString(archive_compression_name(a), "bzip2");
|
||||
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
$FreeBSD$
|
||||
|
||||
begin 644 test_read_format_cpio_svr4_bzip2_rpm.rpm
|
||||
M[:ONVP,``````7)P;7-A;7!L92TQ+C`N,"TQ````````````````````````
|
||||
M```````````````````````````````````````````!``4`````````````
|
||||
M````````CJWH`0`````````%````5````#X````'````1````!````$-````
|
||||
M!@`````````!```#Z`````0````L`````0```^P````'````,````!````/O
|
||||
M````!````$`````!,F4X-3)F-39E,#,W83EE.61A9C<W8V(Q,&0P8S4T-65E
|
||||
M9&8S-6$U8@````````:<A,!!LG.$S/]SK-(FA0BH6@```@@````^````!___
|
||||
M_[`````0`````(ZMZ`$`````````,0```NP````_````!P```MP````0````
|
||||
M9`````@``````````0```^@````&`````@````$```/I````!@````P````!
|
||||
M```#Z@````8````2`````0```^P````)````%`````$```/M````"0```#P`
|
||||
M```!```#[@````0```!,`````0```^\````&````4`````$```/Q````!```
|
||||
M`%P````!```#]@````8```!@`````0```_@````)````9`````$```/\````
|
||||
M!@```'`````!```#_0````8```"4`````0```_X````&````F@````$```0$
|
||||
M````!````*0````#```$!@````,```"P`````P``!`D````#````M@````,`
|
||||
M``0*````!````+P````#```$"P````@```#(`````P``!`P````(```!*P``
|
||||
M``,```0-````!````3`````#```$#P````@```$\`````P``!!`````(```!
|
||||
M2P````,```04````!@```5H````!```$%0````0```%T`````P``!!<````(
|
||||
M```!@`````$```08````!````8P````#```$&0````@```&8`````P``!!H`
|
||||
M```(```!Z@````,```0H````!@```@`````!```$1P````0```((`````P``
|
||||
M!$@````$```"%`````,```1)````"````B`````#```$6`````0```(D````
|
||||
M`0``!%D````(```"*`````$```1<````!````C`````#```$70````@```(\
|
||||
M`````P``!%X````(```"3@````$```1B````!@```E0````!```$9`````8`
|
||||
M``)S`````0``!&4````&```">`````$```1F````!@```GX````!```$;```
|
||||
M``8```*``````0``!'0````$```"E`````,```1U````!````J`````#```$
|
||||
M=@````@```*L`````P``!'<````$```"Q`````,```1X````!````M`````#
|
||||
M0P!R<&US86UP;&4`,2XP+C``,0!386UP;&4@9&%T82!O9B!24$T@9FEL=&5R
|
||||
M(&]F(&QI8F%R8VAI=F4`4V%M<&QE(&1A=&$N`````$L)MWQC=64M9&5S:W1O
|
||||
M<``````20E-$`%5N<W!E8VEF:65D`&AT='`Z+R]C;V1E+F=O;V=L92YC;VTO
|
||||
M<"]L:6)A<F-H:79E`&QI;G5X`&YO87)C:``````````&````!@````:!I(&D
|
||||
M@:0``````````5&!``%1@0`!48%B,3DT-F%C.3(T.3)D,C,T-V,V,C,U8C1D
|
||||
M,C8Q,3$X-`!B,3DT-F%C.3(T.3)D,C,T-V,V,C,U8C1D,C8Q,3$X-`!B,3DT
|
||||
M-F%C.3(T.3)D,C,T-V,V,C,U8C1D,C8Q,3$X-```````````````````````
|
||||
M`')O;W0`<F]O=`!R;V]T`')O;W0`<F]O=`!R;V]T`')P;7-A;7!L92TQ+C`N
|
||||
M,"TQ+G-R8RYR<&T`________________<G!M<V%M<&QE`````0``2@$``$H!
|
||||
M``!*<G!M;&EB*$-O;7!R97-S961&:6QE3F%M97,I`')P;6QI8BA087EL;V%D
|
||||
M1FEL97-(879E4')E9FEX*0!R<&UL:6(H4&%Y;&]A9$ES0GII<#(I`#,N,"XT
|
||||
M+3$`-"XP+3$`,RXP+C4M,0`T+C<N,```````"`$```@!```(`0``*H<``"J(
|
||||
M```JB0`````````(,2XP+C`M,0````````````````!F:6QE,0!F:6QE,@!F
|
||||
M:6QE,P`O971C+P`M3S(@+6<@+6UA<F-H/6DS.#8@+6UT=6YE/6DV.#8`8W!I
|
||||
M;P!B>FEP,@`Y`&YO87)C:"UR<&TM;&EN=7@`````````````````````````
|
||||
M`0````$````!`$%30TE)('1E>'0`9&ER96-T;W)Y````````````````````
|
||||
M````````````````````/P````?___SP````$$)::#DQ05DF4UFX89DX``!=
|
||||
M?X!,$`@`*`'_X"(D%``[9(0`(`"2B/50T#0#0`](9!%(C1,0&GJ`R`M@PQRG
|
||||
M<PN0PPC]8&X[2P=KHS%0Q<^=89M6CI5L`O2\("`W!K-V.;*M63U;6ES%CQI6
|
||||
E4,1$DE)B@G&.7I5?NT46(XB0/D,B!$Z-!A_B[DBG"A(7##,G````
|
||||
`
|
||||
end
|
128
lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
Normal file
128
lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* Copyright (c) 2009 Michihiro NAKAJIMA
|
||||
* 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.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
Execute the following command to rebuild the data for this program:
|
||||
tail -n +32 test_read_format_cpio_svr4_gzip_rpm.c | /bin/sh
|
||||
|
||||
F=test_read_format_cpio_svr4_gzip_rpm.rpm
|
||||
NAME=rpmsample
|
||||
TMPRPM=/tmp/rpm
|
||||
rm -rf ${TMPRPM}
|
||||
mkdir -p ${TMPRPM}/BUILD
|
||||
mkdir -p ${TMPRPM}/RPMS
|
||||
mkdir -p ${TMPRPM}/SOURCES
|
||||
mkdir -p ${TMPRPM}/SPECS
|
||||
mkdir -p ${TMPRPM}/SRPMS
|
||||
echo "hello" > ${TMPRPM}/BUILD/file1
|
||||
echo "hello" > ${TMPRPM}/BUILD/file2
|
||||
echo "hello" > ${TMPRPM}/BUILD/file3
|
||||
cat > ${TMPRPM}/SPECS/${NAME}.spec <<END
|
||||
##
|
||||
%define _topdir ${TMPRPM}
|
||||
%define _binary_payload w9.gzdio
|
||||
|
||||
Summary: Sample data of RPM filter of libarchive
|
||||
Name: ${NAME}
|
||||
Version: 1.0.0
|
||||
Release: 1
|
||||
License: BSD
|
||||
URL: http://code.google.com/p/libarchive
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%install
|
||||
rm -rf \$RPM_BUILD_ROOT
|
||||
|
||||
mkdir -p \$RPM_BUILD_ROOT%{_sysconfdir}
|
||||
install -m 644 file1 \$RPM_BUILD_ROOT%{_sysconfdir}/file1
|
||||
install -m 644 file2 \$RPM_BUILD_ROOT%{_sysconfdir}/file2
|
||||
install -m 644 file3 \$RPM_BUILD_ROOT%{_sysconfdir}/file3
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file1
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file2
|
||||
TZ=utc touch -afm -t 197001020000.01 \$RPM_BUILD_ROOT%{_sysconfdir}/file3
|
||||
|
||||
%files
|
||||
%{_sysconfdir}/file1
|
||||
%{_sysconfdir}/file2
|
||||
%{_sysconfdir}/file3
|
||||
|
||||
%description
|
||||
Sample data.
|
||||
END
|
||||
#
|
||||
rpmbuild -bb ${TMPRPM}/SPECS/${NAME}.spec
|
||||
uuencode ${F} < ${TMPRPM}/RPMS/noarch/${NAME}-1.0.0-1.noarch.rpm > ${F}.uu
|
||||
|
||||
rm -rf ${TMPRPM}
|
||||
exit 1
|
||||
*/
|
||||
|
||||
DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
const char *name = "test_read_format_cpio_svr4_gzip_rpm.rpm";
|
||||
int r;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
r = archive_read_support_compression_gzip(a);
|
||||
if (r == ARCHIVE_WARN) {
|
||||
skipping("gzip reading not fully supported on this platform");
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
return;
|
||||
}
|
||||
assertEqualIntA(a, ARCHIVE_OK, r);
|
||||
assertEqualIntA(a, ARCHIVE_OK,
|
||||
archive_read_support_compression_rpm(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||
extract_reference_file(name);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file1", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file2", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("./etc/file3", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
|
||||
/* Verify the end-of-archive. */
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
/* Verify that the format detection worked. */
|
||||
assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP);
|
||||
assertEqualString(archive_compression_name(a), "gzip");
|
||||
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
$FreeBSD$
|
||||
|
||||
begin 644 test_read_format_cpio_svr4_gzip_rpm.rpm
|
||||
M[:ONVP,``````7)P;7-A;7!L92TQ+C`N,"TQ````````````````````````
|
||||
M```````````````````````````````````````````!``4`````````````
|
||||
M````````CJWH`0`````````%````5````#X````'````1````!````$-````
|
||||
M!@`````````!```#Z`````0````L`````0```^P````'````,````!````/O
|
||||
M````!````$`````!9&9E8V,W,#4T,C@X,V1D-&8P-6%E.#4Y,S<S,&1F,V)D
|
||||
M,#$Q,S0V80````````9=A5.[L^@5U91731!5GLHZC0```@@````^````!___
|
||||
M_[`````0`````(ZMZ`$`````````,0```L0````_````!P```K0````0````
|
||||
M9`````@``````````0```^@````&`````@````$```/I````!@````P````!
|
||||
M```#Z@````8````2`````0```^P````)````%`````$```/M````"0```#P`
|
||||
M```!```#[@````0```!,`````0```^\````&````4`````$```/Q````!```
|
||||
M`%P````!```#]@````8```!@`````0```_@````)````9`````$```/\````
|
||||
M!@```'`````!```#_0````8```"4`````0```_X````&````F@````$```0$
|
||||
M````!````*0````#```$!@````,```"P`````P``!`D````#````M@````,`
|
||||
M``0*````!````+P````#```$"P````@```#(`````P``!`P````(```!*P``
|
||||
M``,```0-````!````3`````#```$#P````@```$\`````P``!!`````(```!
|
||||
M2P````,```04````!@```5H````!```$%0````0```%T`````P``!!<````(
|
||||
M```!@`````$```08````!````8P````"```$&0````@```&4`````@``!!H`
|
||||
M```(```!SP````(```0H````!@```=T````!```$1P````0```'D`````P``
|
||||
M!$@````$```!\`````,```1)````"````?P````#```$6`````0```(`````
|
||||
M`0``!%D````(```"!`````$```1<````!````@P````#```$70````@```(8
|
||||
M`````P``!%X````(```"*@````$```1B````!@```C`````!```$9`````8`
|
||||
M``)/`````0``!&4````&```"5`````$```1F````!@```ED````!```$;```
|
||||
M``8```);`````0``!'0````$```";`````,```1U````!````G@````#```$
|
||||
M=@````@```*$`````P``!'<````$```"G`````,```1X````!````J@````#
|
||||
M0P!R<&US86UP;&4`,2XP+C``,0!386UP;&4@9&%T82!O9B!24$T@9FEL=&5R
|
||||
M(&]F(&QI8F%R8VAI=F4`4V%M<&QE(&1A=&$N`````$L)MAUC=64M9&5S:W1O
|
||||
M<``````20E-$`%5N<W!E8VEF:65D`&AT='`Z+R]C;V1E+F=O;V=L92YC;VTO
|
||||
M<"]L:6)A<F-H:79E`&QI;G5X`&YO87)C:``````````&````!@````:!I(&D
|
||||
M@:0``````````5&!``%1@0`!48%B,3DT-F%C.3(T.3)D,C,T-V,V,C,U8C1D
|
||||
M,C8Q,3$X-`!B,3DT-F%C.3(T.3)D,C,T-V,V,C,U8C1D,C8Q,3$X-`!B,3DT
|
||||
M-F%C.3(T.3)D,C,T-V,V,C,U8C1D,C8Q,3$X-```````````````````````
|
||||
M`')O;W0`<F]O=`!R;V]T`')O;W0`<F]O=`!R;V]T`')P;7-A;7!L92TQ+C`N
|
||||
M,"TQ+G-R8RYR<&T`________________<G!M<V%M<&QE`````0``2@$``$IR
|
||||
M<&UL:6(H0V]M<')E<W-E9$9I;&5.86UE<RD`<G!M;&EB*%!A>6QO861&:6QE
|
||||
M<TAA=F50<F5F:7@I`#,N,"XT+3$`-"XP+3$`-"XW+C``````"`$```@!```(
|
||||
M`0``*H<``"J(```JB0`````````(,2XP+C`M,0````````````````!F:6QE
|
||||
M,0!F:6QE,@!F:6QE,P`O971C+P`M3S(@+6<@+6UA<F-H/6DS.#8@+6UT=6YE
|
||||
M/6DV.#8`8W!I;P!G>FEP`#D`;F]A<F-H+7)P;2UL:6YU>```````````````
|
||||
M```````!`````0````$`05-#24D@=&5X=`!D:7)E8W1O<GD`````````````
|
||||
M```````````````````````````_````!____/`````0'XL(```````"`S,P
|
||||
M-S`W,#0``J-$"W,0;6&8:&*`'8#4&9H:6AA"^690V@))'AM(AC'T]%-+DO73
|
||||
M,G-2#1D8&#)2<W+RN1@8#)#=8$$_-QCA<H,E_=Q@C-4-1`!BU:&#)!@C),C1
|
||||
3T\<U2%%1$>@$!@"1O'?9"`(`````
|
||||
`
|
||||
end
|
697
lib/libarchive/test/test_read_format_xar.c
Normal file
697
lib/libarchive/test/test_read_format_xar.c
Normal file
@ -0,0 +1,697 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* Copyright (c) 2009 Michihiro NAKAJIMA
|
||||
* 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.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define UID 1001
|
||||
#define UNAME "cue"
|
||||
#define GID 1001
|
||||
#define GNAME "cue"
|
||||
|
||||
/* Verify that a file records with hardlink.
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
ln f1 hardlink
|
||||
chown $UNAME:$GNAME hardlink
|
||||
chmod 0644 hardlink
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1 hardlink
|
||||
xar -cf archive1.xar f1 hardlink
|
||||
od -t x1 archive1.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive1.xar.txt
|
||||
*/
|
||||
static unsigned char archive1[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xc6,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x70,0x00,0x00,0x00,0x01,0x78,0xda,0xc4,0x54,
|
||||
0xc9,0x6e,0xdb,0x30,0x14,0xbc,0xe7,0x2b,0x08,0xdd,0x55,0xae,0xb6,0x45,0x83,0x56,
|
||||
0xd0,0x4b,0xd1,0x7b,0xd3,0x4b,0x6f,0x34,0x17,0x89,0x88,0x36,0x48,0x54,0xe0,0xe4,
|
||||
0xeb,0x4b,0x52,0x52,0x0c,0xa7,0x71,0x6f,0x45,0x01,0x01,0x1a,0x0e,0x87,0xa3,0xa7,
|
||||
0xf7,0x06,0x14,0x8f,0x97,0xb6,0x01,0x2f,0x66,0x9c,0x5c,0xdf,0x9d,0x32,0xfc,0x05,
|
||||
0x65,0xc0,0x74,0xaa,0xd7,0xae,0xab,0x4e,0xd9,0xcf,0xa7,0x6f,0x79,0x91,0x3d,0x96,
|
||||
0x0f,0xe2,0x22,0xc7,0xf2,0x01,0x08,0xdf,0xab,0xf0,0x02,0x42,0x8d,0x46,0xfa,0x70,
|
||||
0x22,0xf7,0xae,0x35,0x25,0x41,0x88,0xe7,0x98,0xe4,0x88,0x3c,0x61,0x7a,0xa4,0xe8,
|
||||
0x48,0xb9,0x80,0xb7,0x92,0x74,0xa8,0x36,0xea,0x79,0x9a,0x5b,0x30,0xf9,0xd7,0xc6,
|
||||
0x9c,0xb2,0xa9,0x96,0x38,0x8b,0x3b,0x40,0xf4,0xd6,0x4e,0xc6,0x97,0x48,0xc0,0x15,
|
||||
0x25,0x76,0x72,0x6f,0xd1,0x5c,0xc0,0x04,0xa2,0x05,0xdc,0x3c,0xd2,0xca,0xba,0xc6,
|
||||
0x00,0xa7,0x4f,0x19,0x59,0x6d,0xd4,0x9d,0x72,0xd8,0xaf,0x70,0x72,0xab,0x03,0x88,
|
||||
0x36,0x41,0xcc,0x0f,0x28,0x47,0x38,0xca,0x10,0x3a,0xc6,0x07,0x07,0x59,0x7b,0x95,
|
||||
0xc9,0x7b,0x3f,0x17,0x64,0xf2,0x2a,0xab,0xc6,0x7e,0x1e,0x4a,0x35,0x1b,0x01,0x17,
|
||||
0xb8,0xb0,0x4e,0x97,0x18,0x21,0x1c,0xc8,0x80,0x12,0x35,0x4f,0x66,0x5c,0x74,0x09,
|
||||
0x2d,0xdc,0xbb,0x6c,0xde,0x64,0x6d,0xaf,0x4d,0x89,0xf6,0x8c,0x85,0x62,0x22,0x4c,
|
||||
0xa4,0x7f,0x1d,0x0c,0x68,0x5c,0xf7,0x1c,0x66,0x94,0x95,0xb5,0x1c,0x75,0x5c,0x08,
|
||||
0x18,0xf9,0x45,0xd1,0xc9,0x50,0xd0,0x75,0x23,0x2d,0x53,0xcb,0x62,0x97,0x6e,0xdb,
|
||||
0xb5,0x75,0x5d,0x4b,0x2f,0x13,0x02,0xa2,0x31,0x5d,0xe5,0xeb,0x92,0x50,0x01,0x57,
|
||||
0xb8,0xf0,0xeb,0x38,0xc8,0xed,0x64,0xd6,0xd1,0xe0,0xfd,0x75,0x34,0x81,0xdb,0x72,
|
||||
0xb3,0xcd,0x57,0x0e,0x43,0xe3,0x54,0x0a,0x01,0xbc,0xe4,0xd5,0x9b,0x1b,0x32,0xb8,
|
||||
0x4a,0xe5,0xa8,0x6a,0xf7,0x62,0x74,0xfe,0x31,0x13,0x3f,0xbe,0x7f,0x0d,0xd5,0xd9,
|
||||
0x82,0x52,0x4d,0xac,0x56,0x98,0x53,0xc6,0xa9,0x3c,0xb3,0x82,0x4b,0x2d,0x09,0xb5,
|
||||
0x85,0x3d,0x70,0x6c,0xf7,0xc4,0x2a,0xba,0xe7,0x45,0x98,0xc3,0x47,0xa3,0xad,0x96,
|
||||
0x8b,0x1f,0xa5,0xf2,0x77,0xbf,0xb0,0xd3,0x07,0x76,0x56,0x67,0x75,0xe0,0x9a,0x5a,
|
||||
0x7e,0xb6,0x4c,0xda,0xe0,0xcd,0x8a,0xa2,0x40,0x86,0xed,0xc8,0x7e,0xc7,0xac,0x41,
|
||||
0x8a,0x87,0x1c,0xff,0xe9,0xb4,0x34,0x0f,0xbe,0x77,0xef,0x9f,0xc4,0xee,0x73,0xd9,
|
||||
0x7f,0x8c,0x5d,0x3f,0xba,0xca,0x75,0xb2,0xf9,0x4b,0xfa,0x2c,0xfe,0x24,0x77,0x41,
|
||||
0x15,0x2f,0x0d,0x01,0xd3,0x15,0xf2,0x1b,0x00,0x00,0xff,0xff,0x03,0x00,0x88,0x32,
|
||||
0x49,0x7b,0x67,0xbf,0xc6,0x01,0x29,0xf2,0x1c,0x40,0x05,0x3c,0x49,0x25,0x9f,0xab,
|
||||
0x7c,0x8e,0xc5,0xa5,0x79,0xe0,0x78,0xda,0xca,0x48,0xcd,0xc9,0xc9,0xcf,0x80,0x13,
|
||||
0x5c,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x37,0xf7,0x06,0x47
|
||||
};
|
||||
|
||||
static void verify0(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
const void *p;
|
||||
size_t size;
|
||||
off_t offset;
|
||||
|
||||
assert(archive_entry_filetype(ae) == AE_IFREG);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "f1");
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
assertEqualInt(archive_entry_size(ae), 16);
|
||||
assertEqualInt(archive_read_data_block(a, &p, &size, &offset), 0);
|
||||
assertEqualInt((int)size, 16);
|
||||
assertEqualInt((int)offset, 0);
|
||||
assertEqualInt(memcmp(p, "hellohellohello\n", 16), 0);
|
||||
}
|
||||
|
||||
static void verify1(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
/* A hardlink is not a symlink. */
|
||||
assert(archive_entry_filetype(ae) != AE_IFLNK);
|
||||
/* Nor is it a directory. */
|
||||
assert(archive_entry_filetype(ae) != AE_IFDIR);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "hardlink");
|
||||
assertEqualString(archive_entry_hardlink(ae), "f1");
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
assertEqualInt(archive_entry_nlink(ae), 2);
|
||||
}
|
||||
|
||||
/* Verify that symlinks are read correctly.
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
ln -s f1 symlink
|
||||
chown $UNAME:$GNAME symlink
|
||||
chmod 0644 symlink
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1 symlink
|
||||
xar -cf archive2.xar f1 symlink
|
||||
od -t x1 archive2.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive2.xar.txt
|
||||
*/
|
||||
static unsigned char archive2[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe8,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x84,0x00,0x00,0x00,0x01,0x78,0xda,0xb4,0x54,
|
||||
0xcb,0x6e,0xa3,0x30,0x14,0xdd,0xf7,0x2b,0x90,0xf7,0x8c,0x1f,0x40,0x82,0x23,0xe3,
|
||||
0xaa,0x9b,0x6a,0xf6,0xd3,0xd9,0xcc,0xce,0xf1,0x83,0x58,0xe5,0x25,0x70,0xaa,0xa4,
|
||||
0x5f,0x3f,0xb6,0x09,0x4d,0xd3,0x30,0xdd,0x8d,0x84,0xc4,0xf5,0xf1,0xb9,0xc7,0x97,
|
||||
0x7b,0x0f,0x66,0x8f,0xa7,0xb6,0x49,0xde,0xf4,0x38,0xd9,0xbe,0xab,0x00,0xfe,0x81,
|
||||
0x40,0xa2,0x3b,0xd9,0x2b,0xdb,0xd5,0x15,0xf8,0xfd,0xf2,0x9c,0x96,0xe0,0x91,0x3f,
|
||||
0xb0,0x93,0x18,0xf9,0x43,0xc2,0x5c,0x2f,0xfd,0x2b,0x61,0x72,0xd4,0xc2,0xf9,0x8c,
|
||||
0xd4,0xd9,0x56,0x73,0x82,0x10,0x4d,0x31,0x49,0x11,0x79,0xc1,0xd9,0x2e,0x2b,0x76,
|
||||
0xb8,0x60,0xf0,0x96,0x12,0x93,0x0e,0x5a,0xbe,0x4e,0xc7,0x36,0x99,0xdc,0xb9,0xd1,
|
||||
0x15,0x98,0x0e,0x02,0x83,0xb0,0x93,0xb0,0xde,0x98,0x49,0x3b,0x8e,0x18,0xbc,0x44,
|
||||
0x11,0x9d,0xec,0x7b,0x10,0x67,0x30,0x06,0x41,0x02,0x2e,0x1a,0x71,0x65,0x6c,0xa3,
|
||||
0x13,0xab,0x2a,0x40,0x2e,0x32,0xf2,0xae,0x1c,0xb4,0xcb,0xd1,0x0e,0xd1,0x3f,0x3e,
|
||||
0x73,0xa9,0x23,0x61,0xed,0x37,0xb4,0xf6,0x4a,0x13,0xdf,0xd0,0xc4,0x95,0x56,0x8f,
|
||||
0xfd,0x71,0xe0,0xf2,0xa8,0x19,0x9c,0xc3,0x19,0xb5,0x8a,0x63,0x84,0xb0,0x07,0x7d,
|
||||
0x14,0xa1,0xe3,0xa4,0xc7,0x99,0x17,0xa3,0x19,0xfb,0xa0,0x1d,0x17,0x5a,0xdb,0x2b,
|
||||
0xcd,0xd1,0xb6,0xf0,0x3d,0x8c,0x61,0x04,0x1b,0xdb,0xbd,0x26,0xee,0x3c,0xf8,0xb6,
|
||||
0x85,0xaf,0x06,0xdc,0xf8,0x94,0x00,0xce,0xdb,0x61,0x87,0x4f,0xe7,0x36,0x20,0x0c,
|
||||
0xc6,0x55,0xc4,0x3b,0xd1,0x7e,0xc2,0xe3,0x2a,0xb6,0x31,0x68,0xdc,0xb6,0x70,0x99,
|
||||
0x84,0x12,0x4e,0xc4,0xc8,0x9f,0xa9,0xbb,0xda,0x1d,0x38,0xc9,0xfc,0x49,0x73,0x38,
|
||||
0xe3,0x97,0x11,0x91,0xdb,0x69,0x5d,0xc6,0x85,0x37,0xd7,0x71,0x79,0x6c,0xf1,0xd2,
|
||||
0x32,0x73,0x31,0x0c,0x8d,0x95,0xd1,0x18,0xf0,0x94,0xd6,0xef,0x76,0x00,0xf0,0x42,
|
||||
0x15,0xa3,0x3c,0xd8,0x37,0xad,0xd2,0xaf,0x3e,0xf9,0xf5,0xf3,0xc9,0x57,0x67,0xca,
|
||||
0x2c,0x53,0xc4,0x28,0x89,0x69,0x96,0xd3,0x4c,0xec,0xf3,0x92,0x0a,0x25,0x48,0x66,
|
||||
0x4a,0xb3,0xa5,0xd8,0x6c,0x88,0x91,0xd9,0x86,0x96,0x7e,0x36,0x5f,0x85,0x96,0x5a,
|
||||
0x4e,0x6e,0x14,0xd2,0xfd,0xf3,0x84,0x42,0x6d,0xf3,0xbd,0xdc,0xcb,0x2d,0x55,0x99,
|
||||
0xa1,0x7b,0x93,0x0b,0xe3,0xb5,0xf3,0xb2,0x2c,0x91,0xce,0x0b,0xb2,0x29,0x72,0xa3,
|
||||
0x91,0xa4,0x94,0xc1,0x7b,0xa5,0xb9,0x79,0xf0,0xa3,0x7b,0x2b,0x56,0x9c,0xff,0x0c,
|
||||
0xb2,0x66,0x45,0x4c,0xb7,0x28,0x45,0x38,0xd0,0x90,0x37,0x98,0x7f,0xf0,0x9a,0x15,
|
||||
0xd7,0x69,0xff,0xdd,0x8a,0x9b,0x3c,0xff,0x6c,0xc5,0xe0,0xae,0x24,0x18,0xaa,0x02,
|
||||
0xfd,0x68,0x6b,0xdb,0x89,0x06,0xf0,0x83,0x18,0xd5,0xaa,0xf9,0x82,0x4f,0xef,0x7c,
|
||||
0xe7,0x59,0xe1,0x22,0x61,0x30,0x5e,0x2b,0x7f,0x01,0x00,0x00,0xff,0xff,0x03,0x00,
|
||||
0x2b,0xab,0x4f,0xf9,0xbb,0xf7,0x90,0xb5,0x34,0x8f,0x7c,0xae,0x72,0xa0,0x80,0xd2,
|
||||
0x69,0xc7,0xa2,0xe7,0x44,0x53,0xeb,0x75,0x78,0xda,0xca,0x48,0xcd,0xc9,0xc9,0xcf,
|
||||
0x80,0x13,0x5c,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x37,0xf7,0x06,0x47
|
||||
};
|
||||
|
||||
static void verify2(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assertEqualInt(archive_entry_filetype(ae), AE_IFLNK);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "symlink");
|
||||
assertEqualString(archive_entry_symlink(ae), "f1");
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
}
|
||||
|
||||
/* Character device node.
|
||||
#How to make
|
||||
mknod devchar c 0 30
|
||||
chown $UNAME:$GNAME devchar
|
||||
chmod 0644 devchar
|
||||
env TZ=utc touch -afm -t 197001020000.01 devchar
|
||||
xar -cf archive3.xar devchar
|
||||
od -t x1 archive3.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive3.xar.txt
|
||||
*/
|
||||
static unsigned char archive3[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x38,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x3b,0x00,0x00,0x00,0x01,0x78,0xda,0x7c,0x92,
|
||||
0x4d,0x6e,0xc3,0x20,0x10,0x85,0xf7,0x39,0x05,0xf2,0xde,0x05,0x9c,0x9f,0x36,0xd6,
|
||||
0x84,0xec,0x7a,0x82,0x74,0xd3,0x1d,0xc2,0x93,0x98,0xd4,0x36,0x11,0xe0,0x28,0xe9,
|
||||
0xe9,0x0b,0xe3,0xa4,0x69,0xa5,0xaa,0x92,0x25,0x1e,0x8f,0xef,0x8d,0x86,0xc1,0xb0,
|
||||
0xbd,0xf4,0x1d,0x3b,0xa3,0x0f,0xd6,0x0d,0x9b,0x42,0x3e,0x89,0x82,0xe1,0x60,0x5c,
|
||||
0x63,0x87,0xc3,0xa6,0x78,0xdb,0xbd,0x96,0x2f,0xc5,0x56,0xcd,0xe0,0xa2,0xbd,0x9a,
|
||||
0x31,0x88,0xce,0xa4,0x85,0x81,0xf1,0xa8,0x63,0x4a,0x94,0xd1,0xf6,0xa8,0x2a,0x21,
|
||||
0xd6,0xa5,0xac,0x4a,0x51,0xed,0xa4,0xa8,0xab,0x79,0x2d,0x57,0xc0,0x7f,0x23,0x14,
|
||||
0x6a,0xd1,0x7c,0x84,0xb1,0x67,0x21,0x5e,0x3b,0xdc,0x14,0xa1,0xd5,0xb2,0xc8,0x27,
|
||||
0x0c,0xdc,0x7e,0x1f,0x30,0x2a,0x01,0xfc,0xa6,0xc8,0x0d,0xf6,0x33,0x17,0x07,0x4e,
|
||||
0x22,0x97,0xe0,0xf7,0x1a,0xb4,0xdb,0xdb,0x0e,0x99,0x6d,0x52,0xdb,0xb7,0x32,0xe6,
|
||||
0xaf,0x76,0xaa,0x7a,0xb9,0x7c,0x4f,0xc9,0x7b,0x1f,0x0c,0x7a,0x92,0x72,0xfd,0x2c,
|
||||
0x4a,0x21,0x33,0x26,0x44,0x9d,0x3f,0x99,0xb0,0xfe,0x81,0xe9,0x7f,0x30,0xfd,0xc0,
|
||||
0x0e,0xde,0x8d,0x27,0x65,0x46,0x04,0x3e,0xc9,0xc9,0xb5,0x8d,0x92,0x42,0xc8,0x64,
|
||||
0x26,0x45,0xd6,0x18,0xd0,0x4f,0x1c,0xa9,0xc9,0xfb,0xc6,0xc6,0x3b,0xd6,0xbb,0x06,
|
||||
0x95,0x58,0x2d,0x16,0xa9,0x99,0x2c,0xc9,0x6c,0xf0,0x6c,0xcd,0xa4,0x13,0x61,0x07,
|
||||
0xe7,0xd5,0x3c,0x0d,0x66,0x52,0x37,0x57,0x1f,0x93,0xce,0x26,0x09,0x8a,0xf1,0x1f,
|
||||
0x39,0x88,0xd7,0x13,0x2a,0xd3,0x6a,0xaf,0x4d,0x44,0xcf,0xc2,0x09,0x8d,0xd5,0x1d,
|
||||
0x70,0xf2,0x89,0x18,0x74,0xba,0x54,0x8a,0x64,0x08,0x38,0xed,0x68,0xea,0x79,0xd0,
|
||||
0xf9,0xf9,0x39,0xbd,0x3f,0x70,0xfa,0x1b,0xbe,0x00,0x00,0x00,0xff,0xff,0x03,0x00,
|
||||
0xab,0x43,0xa3,0xac,0x76,0x40,0x1e,0x8b,0x95,0x0d,0x28,0x79,0x79,0x43,0x49,0x4e,
|
||||
0x16,0xa1,0x56,0x99,0x1f,0x83,0x77,0x41
|
||||
};
|
||||
|
||||
static void verify3(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assertEqualInt(archive_entry_filetype(ae), AE_IFCHR);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "devchar");
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
}
|
||||
|
||||
/* Block device node.
|
||||
#How to make
|
||||
mknod devblock b 0 30
|
||||
chown $UNAME:$GNAME devblock
|
||||
chmod 0644 devblock
|
||||
env TZ=utc touch -afm -t 197001020000.01 devblock
|
||||
xar -cf archive4.xar devblock
|
||||
od -t x1 archive4.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive4.xar.txt
|
||||
*/
|
||||
static unsigned char archive4[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x34,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x38,0x00,0x00,0x00,0x01,0x78,0xda,0x7c,0x92,
|
||||
0xc1,0x6e,0xc2,0x30,0x0c,0x86,0xef,0x3c,0x45,0xd4,0x7b,0x17,0x07,0xd0,0x0a,0x95,
|
||||
0x09,0xb7,0x3d,0x01,0xbb,0xec,0x96,0xa5,0x06,0x32,0xda,0xa6,0x6a,0x5a,0x04,0x7b,
|
||||
0xfa,0x25,0x2e,0x8c,0x4d,0x9a,0x26,0x55,0xea,0x97,0x3f,0x9f,0x2d,0x37,0x29,0x6e,
|
||||
0x2f,0x4d,0x2d,0xce,0xd4,0x07,0xe7,0xdb,0x4d,0xa6,0x9e,0x20,0x13,0xd4,0x5a,0x5f,
|
||||
0xb9,0xf6,0xb0,0xc9,0x5e,0x77,0x2f,0xf9,0x2a,0xdb,0xea,0x19,0x5e,0x4c,0xaf,0x67,
|
||||
0x02,0x07,0x6f,0xe3,0x4b,0xa0,0xed,0xc9,0x0c,0xb1,0x22,0x1f,0x5c,0x43,0x7a,0x0e,
|
||||
0xb0,0xce,0xd5,0x3c,0x87,0xf9,0x4e,0x41,0xb9,0x58,0x95,0xaa,0x40,0xf9,0x5b,0xe1,
|
||||
0xa2,0x23,0xd9,0x53,0x18,0x1b,0x11,0x86,0x6b,0x4d,0x9b,0x2c,0x1c,0x8d,0xca,0xd2,
|
||||
0x8e,0x40,0xbf,0xdf,0x07,0x1a,0x34,0xa0,0xbc,0x11,0xa7,0xc1,0x7d,0xa6,0xe6,0x28,
|
||||
0x19,0x52,0x0b,0x79,0xef,0xc1,0xab,0xbd,0xab,0x49,0xb8,0x2a,0x8e,0x7d,0x6b,0x63,
|
||||
0xff,0x1e,0x07,0x8a,0xb7,0x58,0x79,0x9f,0x43,0x60,0xc3,0xa8,0xd6,0x05,0xe4,0xa0,
|
||||
0x92,0x06,0x50,0xa6,0x47,0x45,0xad,0x79,0x68,0xe6,0x1f,0xcd,0x3c,0xb4,0x43,0xef,
|
||||
0xc7,0x4e,0xdb,0x91,0x50,0x4e,0x38,0xa5,0xae,0xd2,0x0a,0x40,0xc5,0x30,0x12,0x47,
|
||||
0x63,0xa0,0x7e,0xf2,0x98,0xa6,0xec,0x5b,0x1b,0xef,0x5a,0xe3,0x2b,0xd2,0xf0,0xbc,
|
||||
0x5c,0xc6,0x61,0x12,0x72,0x58,0xd1,0xd9,0xd9,0x89,0xa3,0xe1,0x5a,0xdf,0xeb,0x45,
|
||||
0x3c,0x98,0x89,0x6e,0xa9,0xf9,0x88,0x9c,0x42,0x06,0x2e,0x93,0x3f,0xea,0x70,0xb8,
|
||||
0x76,0xa4,0xdf,0x6b,0x6f,0x4f,0x22,0x74,0x64,0x9d,0xa9,0x51,0x72,0xc6,0xbb,0xad,
|
||||
0x89,0x1f,0x14,0x75,0x16,0x50,0xf2,0x92,0x8f,0x3c,0x9d,0x72,0xba,0x7b,0xc9,0x97,
|
||||
0x8f,0x92,0x7f,0x85,0x2f,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0xbe,0x66,0xa2,0x82,
|
||||
0x3a,0x54,0xd3,0x61,0xaa,0x8e,0x30,0x4c,0xc8,0x36,0x3b,0x7a,0xa4,0xb9,0xef,0xfc,
|
||||
0x7a,0x5d,0x21,0xde
|
||||
};
|
||||
|
||||
static void verify4(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assertEqualInt(archive_entry_filetype(ae), AE_IFBLK);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "devblock");
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
}
|
||||
|
||||
/* Directory.
|
||||
#How to make
|
||||
mkdir dir1
|
||||
chown $UNAME:$GNAME dir1
|
||||
chmod 0755 dir1
|
||||
env TZ=utc touch -afm -t 197001020000.01 dir1
|
||||
xar -cf archive5.xar dir1
|
||||
od -t x1 archive5.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive5.xar.txt
|
||||
*/
|
||||
static unsigned char archive5[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x16,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xec,0x00,0x00,0x00,0x01,0x78,0xda,0x74,0x91,
|
||||
0xc1,0x6e,0xc2,0x30,0x0c,0x86,0xef,0x3c,0x45,0xd4,0x7b,0x17,0xa7,0x83,0x31,0xaa,
|
||||
0x34,0xdc,0xf6,0x04,0xec,0xb2,0x5b,0x95,0x1a,0x88,0x68,0x1a,0x94,0xa4,0x13,0xdd,
|
||||
0xd3,0x2f,0x71,0xe9,0xd0,0xa4,0x4d,0xaa,0xd4,0x3f,0xbf,0x3f,0xff,0xb2,0x6c,0xb9,
|
||||
0xbf,0xd9,0x9e,0x7d,0xa2,0x0f,0xc6,0x0d,0x4d,0x21,0x9e,0xa0,0x60,0x38,0x68,0xd7,
|
||||
0x99,0xe1,0xd4,0x14,0xef,0x87,0xb7,0xf2,0xb5,0xd8,0xab,0x95,0xbc,0xb5,0x5e,0xad,
|
||||
0x98,0x8c,0x4e,0xa7,0x1f,0x93,0xda,0x63,0x1b,0x53,0x47,0x19,0x8d,0x45,0x55,0x01,
|
||||
0xec,0x4a,0x51,0x95,0x50,0x1d,0x04,0xd4,0x6b,0x51,0xaf,0x37,0x92,0xff,0x46,0xa8,
|
||||
0xe9,0x8c,0xfa,0x12,0x46,0xcb,0x42,0x9c,0x7a,0x6c,0x8a,0x70,0x6e,0x45,0x91,0x2b,
|
||||
0x4c,0xba,0xe3,0x31,0x60,0x54,0x20,0xf9,0x5d,0x91,0x1b,0xcc,0x57,0x0e,0x97,0x9c,
|
||||
0x44,0x8e,0xe0,0x4b,0x06,0xbd,0x8e,0xa6,0x47,0x66,0xba,0x34,0xf6,0x3d,0x46,0xff,
|
||||
0x3d,0xce,0x33,0x7c,0xa4,0xce,0x65,0x0e,0x26,0x2d,0x49,0xb1,0xdb,0x42,0x09,0x22,
|
||||
0x63,0x00,0x75,0xfe,0x44,0xc2,0xec,0x03,0x6b,0xff,0x49,0x7b,0x49,0x58,0xfb,0xc0,
|
||||
0x4e,0xde,0x8d,0x57,0xa5,0x47,0x94,0x7c,0x96,0xb3,0x6b,0x3a,0x25,0x00,0x44,0x32,
|
||||
0x93,0x22,0x6b,0x0c,0xe8,0x67,0x8e,0xd4,0xec,0xfd,0x60,0xe3,0x82,0x59,0xd7,0xa1,
|
||||
0x82,0xed,0x26,0xed,0x90,0x24,0x99,0x71,0xba,0xa2,0xea,0x8c,0x47,0x1d,0x9d,0x9f,
|
||||
0x24,0xa7,0x37,0x55,0x86,0xd6,0x52,0x25,0x45,0x90,0xa4,0x35,0xe5,0xcd,0xe4,0x7b,
|
||||
0x71,0x3a,0x98,0xe4,0x74,0xbe,0x6f,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x23,0x7a,
|
||||
0x8c,0x2f,0x78,0xe9,0x69,0x28,0x93,0x14,0x72,0x68,0x8d,0xeb,0x42,0x7b,0xf6,0x0f,
|
||||
0x70,0x64,0xa3,0xff,0xb9,0x35
|
||||
};
|
||||
|
||||
static void verify5(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assertEqualInt(archive_entry_filetype(ae), AE_IFDIR);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
}
|
||||
|
||||
/* fifo
|
||||
#How to make
|
||||
mkfifo -m 0755 fifo
|
||||
chown $UNAME:$GNAME fifo
|
||||
env TZ=utc touch -afm -t 197001020000.01 fifo
|
||||
xar -cf archive6.xar fifo
|
||||
od -t x1 archive6.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive6.xar.txt
|
||||
*/
|
||||
static unsigned char archive6[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0e,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe7,0x00,0x00,0x00,0x01,0x78,0xda,0x7c,0x91,
|
||||
0xc1,0x6e,0xc3,0x20,0x0c,0x86,0xef,0x7d,0x0a,0xc4,0x3d,0xc3,0x64,0xab,0xda,0x46,
|
||||
0x94,0xde,0xf6,0x04,0xdd,0x65,0x37,0x44,0x9c,0x16,0x2d,0x84,0x2a,0x90,0xa9,0xdd,
|
||||
0xd3,0x0f,0x9c,0x66,0xd5,0xa4,0x69,0x12,0x52,0xbe,0xfc,0x7c,0xb6,0x2c,0xac,0x0e,
|
||||
0x57,0xdf,0xb3,0x4f,0x1c,0xa3,0x0b,0xc3,0x9e,0xcb,0x27,0xe0,0x0c,0x07,0x1b,0x5a,
|
||||
0x37,0x9c,0xf6,0xfc,0xed,0xf8,0x5a,0x6d,0xf9,0x41,0xaf,0xd4,0xd5,0x8c,0x7a,0xc5,
|
||||
0x54,0x0a,0x36,0x7f,0x98,0xb2,0x23,0x9a,0x94,0x2b,0xaa,0xe4,0x3c,0xea,0x1a,0x60,
|
||||
0x57,0xc9,0xba,0x82,0xfa,0x28,0x65,0xf3,0x02,0x4d,0xbd,0x55,0xe2,0xb7,0x42,0x45,
|
||||
0x67,0xb4,0x1f,0x71,0xf2,0x2c,0xa6,0x5b,0x8f,0x7b,0x1e,0xcf,0x46,0xf2,0x72,0xc3,
|
||||
0x54,0xe8,0xba,0x88,0x49,0x83,0x12,0x77,0xa2,0x34,0xba,0xaf,0xd2,0x5c,0x09,0x82,
|
||||
0xd2,0x42,0x2c,0x3d,0xe8,0xaf,0x73,0x3d,0x32,0xd7,0xe6,0xb1,0xef,0x6d,0xec,0xdf,
|
||||
0xe3,0xc8,0xe7,0xf7,0x5c,0xb9,0xcc,0xc1,0x94,0x27,0x94,0xbb,0x0d,0x54,0x20,0x8b,
|
||||
0x06,0xd0,0x94,0x23,0xb3,0xe6,0x1f,0x9a,0xf9,0x47,0x33,0x0f,0xed,0x34,0x86,0xe9,
|
||||
0xa2,0xed,0x84,0x4a,0xcc,0x38,0xa7,0xae,0xd5,0x12,0x40,0xe6,0x30,0x13,0x45,0x53,
|
||||
0xc4,0x71,0xf6,0x88,0xe6,0xec,0x47,0x9b,0x16,0xcd,0x87,0x16,0x35,0x6c,0xd6,0xeb,
|
||||
0x3c,0x4c,0x41,0x0a,0xd3,0xed,0x82,0xba,0x73,0x5d,0x50,0x82,0x90,0xc2,0xc1,0xf8,
|
||||
0x25,0x24,0xa4,0x17,0x2a,0x8f,0x52,0x56,0x25,0x68,0x57,0x4a,0xd0,0xe6,0xbe,0x01,
|
||||
0x00,0x00,0xff,0xff,0x03,0x00,0x44,0x19,0x8a,0x2a,0x82,0xbc,0x8c,0xae,0x97,0xa7,
|
||||
0x7d,0x65,0xa5,0x82,0xdb,0xaa,0xc2,0xcb,0xbe,0xf0,0x1f,0xd1,0xf9,0x56
|
||||
};
|
||||
|
||||
static void verify6(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assertEqualInt(archive_entry_filetype(ae), AE_IFIFO);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "fifo");
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
}
|
||||
|
||||
/* Verify that a file records with directory name.
|
||||
#How to make
|
||||
mkdir dir1
|
||||
echo "hellohellohello" > dir1/f1
|
||||
chown $UNAME:$GNAME dir1/f1
|
||||
chmod 0644 dir1/f1
|
||||
env TZ=utc touch -afm -t 197001020000.01 dir1/f1
|
||||
xar -cf archive7.xar dir1/f1
|
||||
od -t x1 archive7.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive7.xar.txt
|
||||
*/
|
||||
|
||||
static unsigned char archive7[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xbb,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x8a,0x00,0x00,0x00,0x01,0x78,0xda,0x7c,0x53,
|
||||
0xc9,0x6e,0xdb,0x30,0x14,0xbc,0xe7,0x2b,0x04,0xdd,0x55,0x2e,0xa2,0x16,0x1a,0xb4,
|
||||
0x82,0x5e,0x8a,0xdc,0x93,0x5e,0x7a,0xa3,0xb9,0xd8,0x44,0xb5,0x41,0xa2,0x02,0x3b,
|
||||
0x5f,0x5f,0x92,0xa2,0x1c,0xbb,0x59,0x00,0x01,0x1a,0x3e,0xce,0x1b,0x0d,0x9f,0x86,
|
||||
0xec,0xf1,0xdc,0xb5,0xc9,0xab,0x9a,0x66,0x33,0xf4,0xfb,0x14,0xfd,0x80,0x69,0xa2,
|
||||
0x7a,0x31,0x48,0xd3,0x1f,0xf7,0xe9,0xef,0x97,0x5f,0x59,0x9d,0x3e,0x36,0x0f,0xec,
|
||||
0xcc,0xa7,0xe6,0x21,0x61,0x76,0x10,0xee,0x95,0x30,0x31,0x29,0x6e,0x5d,0x47,0x66,
|
||||
0x4d,0xa7,0x1a,0x0c,0x21,0xcd,0x10,0xce,0x20,0x7e,0x41,0x68,0x57,0xe0,0x5d,0x51,
|
||||
0x31,0x70,0x4f,0x09,0x4d,0x27,0x25,0xfe,0xce,0x4b,0x97,0xcc,0xf6,0xd2,0xaa,0x7d,
|
||||
0x3a,0x9f,0x38,0x4a,0xfd,0x4e,0xc2,0x06,0xad,0x67,0x65,0x1b,0xc8,0x40,0x44,0xa1,
|
||||
0x3a,0x9b,0x37,0x2f,0xce,0x40,0x00,0x5e,0x02,0x6c,0x1a,0x61,0xa5,0x4d,0xab,0x12,
|
||||
0x23,0x9d,0xed,0x28,0x63,0x2f,0xa3,0x6a,0xa4,0x99,0x94,0xb0,0xc3,0x74,0x61,0x20,
|
||||
0xac,0xc3,0x4e,0xcf,0xbb,0xb0,0x83,0x18,0x08,0x30,0x14,0xaf,0xfd,0x78,0xed,0x4f,
|
||||
0x98,0xe4,0x96,0xaf,0x30,0x61,0xad,0xea,0x8f,0xf6,0xd4,0xe0,0x9c,0x81,0x08,0xe3,
|
||||
0x46,0xb4,0x88,0xef,0xdd,0x6e,0x7e,0x51,0xf9,0xee,0xd7,0x17,0xb7,0x69,0x6e,0xa7,
|
||||
0xe6,0xe3,0xd8,0x1a,0x11,0x46,0x03,0xce,0xd9,0xf1,0xcd,0x8c,0x29,0xd8,0xb8,0x7c,
|
||||
0x12,0x27,0xf3,0xaa,0x64,0xf6,0xff,0xa8,0x9e,0x9f,0x7e,0xba,0x33,0xea,0x3a,0xcf,
|
||||
0x25,0xd6,0x52,0x20,0x9a,0x13,0x9a,0xf3,0x03,0xa9,0x29,0x97,0x1c,0xe7,0xba,0xd6,
|
||||
0x15,0x45,0xba,0xc4,0x5a,0xe4,0x25,0xad,0x19,0xf8,0x20,0x74,0x75,0x73,0xb6,0x13,
|
||||
0x17,0xf6,0xcb,0x4f,0x14,0xb2,0x22,0x07,0x71,0x10,0x15,0x95,0xb9,0xa6,0x07,0x4d,
|
||||
0xb8,0x76,0xe2,0xa4,0xae,0x6b,0xa8,0x48,0x81,0xcb,0x82,0x68,0x05,0x05,0xa5,0x0c,
|
||||
0x7c,0x54,0x8a,0x33,0x04,0xef,0x43,0x64,0xe2,0xf3,0x7c,0x90,0xfa,0x8f,0xfb,0x95,
|
||||
0x5b,0x30,0x1c,0xaf,0x0b,0x18,0xd1,0x0a,0x66,0x10,0x79,0x1e,0x84,0x3b,0xff,0x20,
|
||||
0xc7,0xeb,0x6e,0x78,0xfc,0x1b,0x1e,0xbf,0xe1,0x1d,0xa7,0x61,0x19,0x1b,0xb1,0x28,
|
||||
0x06,0x56,0x18,0xcb,0x46,0x36,0x08,0x42,0x17,0x02,0x8f,0xd6,0xda,0x32,0xab,0x69,
|
||||
0x65,0x06,0x14,0x8b,0x57,0xe2,0x72,0x25,0x76,0x83,0x54,0x0d,0x2c,0x09,0x71,0x96,
|
||||
0x3c,0x5c,0xab,0x21,0x62,0x3e,0x48,0x37,0x69,0x8b,0x71,0xd3,0x77,0x61,0x03,0x9e,
|
||||
0xb4,0x86,0x38,0x22,0xd7,0xe1,0xaf,0x13,0x03,0xe1,0x72,0xfd,0x03,0x00,0x00,0xff,
|
||||
0xff,0x03,0x00,0x8d,0xb1,0x06,0x76,0xa6,0x7a,0xc3,0xbb,0x13,0x3d,0x45,0xe2,0x2b,
|
||||
0x3b,0xd0,0x88,0xc7,0x58,0x7b,0xbd,0x30,0x9d,0x01,0x44,0x78,0xda,0xca,0x48,0xcd,
|
||||
0xc9,0xc9,0xcf,0x80,0x13,0x5c,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x37,0xf7,
|
||||
0x06,0x47
|
||||
};
|
||||
|
||||
static void verify7(struct archive *a, struct archive_entry *ae)
|
||||
{
|
||||
(void)a; /* UNUSED */
|
||||
assert(archive_entry_filetype(ae) == AE_IFREG);
|
||||
assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
|
||||
assertEqualInt(archive_entry_uid(ae), UID);
|
||||
assertEqualInt(archive_entry_gid(ae), GID);
|
||||
assertEqualString(archive_entry_uname(ae), UNAME);
|
||||
assertEqualString(archive_entry_gname(ae), GNAME);
|
||||
assertEqualString(archive_entry_pathname(ae), "dir1/f1");
|
||||
assert(archive_entry_hardlink(ae) == NULL);
|
||||
assert(archive_entry_symlink(ae) == NULL);
|
||||
assertEqualInt(archive_entry_mtime(ae), 86401);
|
||||
}
|
||||
|
||||
/* Verify that a file records with bzip2 compression
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1
|
||||
xar --compression bzip2 -cf archive8.xar f1
|
||||
od -t x1 archive8.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive8.xar.txt
|
||||
*/
|
||||
|
||||
static unsigned char archive8[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xb1,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x42,0x00,0x00,0x00,0x01,0x78,0xda,0x7c,0x53,
|
||||
0xcb,0x6e,0xdc,0x20,0x14,0xdd,0xe7,0x2b,0x90,0xf7,0x0e,0x60,0xe3,0x07,0x23,0x86,
|
||||
0xa8,0x9b,0xa8,0xfb,0x4e,0x37,0xdd,0x61,0x1e,0x63,0x14,0xbf,0x64,0xe3,0x68,0x92,
|
||||
0xaf,0x2f,0x60,0x3b,0xa3,0x34,0x6d,0x25,0x4b,0x3e,0x1c,0x0e,0xe7,0x5e,0xee,0xe5,
|
||||
0xb2,0xa7,0x5b,0xdf,0x81,0x57,0x3d,0x2f,0x76,0x1c,0xce,0x09,0x7e,0x44,0x09,0xd0,
|
||||
0x83,0x1c,0x95,0x1d,0xae,0xe7,0xe4,0xe7,0xe5,0x39,0xad,0x93,0x27,0xfe,0xc0,0x6e,
|
||||
0x62,0xe6,0x0f,0x80,0xb9,0x51,0xfa,0x1f,0x60,0x72,0xd6,0xc2,0xf9,0x13,0xa9,0xb3,
|
||||
0xbd,0xe6,0x19,0x42,0x34,0xc5,0x59,0x8a,0xc8,0x05,0xd1,0x13,0xc6,0x27,0x9c,0x33,
|
||||
0xf8,0x59,0x12,0x0f,0xb5,0x5a,0xbe,0x2c,0x6b,0x0f,0x16,0xf7,0xd6,0xe9,0x73,0xb2,
|
||||
0xb4,0x02,0x27,0x61,0x07,0xb0,0xd1,0x98,0x45,0x3b,0x8e,0x18,0xdc,0x51,0x64,0x17,
|
||||
0xfb,0x1e,0xcc,0x19,0x8c,0x20,0x58,0xc0,0xc3,0x23,0xae,0x8c,0xed,0x34,0xb0,0xca,
|
||||
0xa7,0xbd,0xdb,0x28,0xe1,0x44,0x44,0x80,0x75,0x7a,0xb8,0xba,0x96,0x13,0xc2,0xe0,
|
||||
0x0e,0x37,0x7e,0xf7,0xcf,0x3e,0x87,0xda,0x63,0xe1,0xf2,0x1e,0xcb,0x73,0x47,0x21,
|
||||
0x8e,0x84,0xc5,0x34,0x75,0x56,0xc6,0x5b,0xc1,0x5b,0xda,0xbc,0xdb,0x29,0x4b,0xe0,
|
||||
0xae,0x15,0xb3,0x6c,0xed,0xab,0x56,0xe9,0x9f,0xb7,0xfc,0xf1,0xfd,0x9b,0x4f,0xcf,
|
||||
0xe4,0xa4,0x28,0x4a,0x94,0xcb,0x3a,0xcf,0x9b,0x26,0x93,0xaa,0x92,0xba,0x29,0xa8,
|
||||
0x2a,0x89,0x29,0xa8,0x50,0x22,0x97,0x45,0xa1,0x71,0xe5,0xeb,0xf6,0xc5,0xe8,0x48,
|
||||
0xe6,0xe6,0x66,0x21,0xdd,0x3f,0x23,0x14,0xaa,0x22,0x8d,0x6c,0x64,0x45,0x55,0x6e,
|
||||
0x68,0x63,0x88,0x30,0xa6,0x36,0xa4,0xae,0x6b,0xa4,0x49,0x91,0x95,0x05,0x31,0x1a,
|
||||
0x49,0x4a,0x19,0xfc,0xea,0xb4,0x55,0x0f,0x7e,0x94,0x8f,0xc9,0xbf,0xf7,0x15,0xd5,
|
||||
0xbf,0x7c,0x0b,0x8e,0x86,0x02,0xd6,0x47,0x88,0x69,0x85,0x52,0x84,0x53,0x94,0x5d,
|
||||
0x10,0x3a,0x85,0x0f,0x7b,0x59,0x7f,0x97,0x89,0xff,0xc8,0xc4,0x5d,0x76,0x9d,0xc7,
|
||||
0x75,0xe2,0x72,0xd5,0x0c,0x6e,0x70,0x63,0xad,0xe2,0x18,0x21,0xec,0x49,0x8f,0x22,
|
||||
0xb5,0x2e,0x7a,0xde,0x74,0x11,0x6d,0xdc,0x87,0x6c,0x3d,0x64,0xfd,0xa8,0x34,0x47,
|
||||
0x65,0x78,0x02,0x11,0x46,0xd2,0xbd,0x4d,0x1a,0x74,0x76,0x78,0x39,0x27,0xe3,0x6c,
|
||||
0xaf,0x76,0x10,0x5d,0xc2,0x5b,0x31,0xab,0xc0,0x31,0x18,0xb6,0x37,0xe1,0x20,0x7c,
|
||||
0x5e,0xc6,0xfb,0x45,0x10,0x1f,0x5f,0x78,0x6f,0x61,0x0a,0x60,0x1c,0x03,0x06,0xe3,
|
||||
0x50,0xfc,0x06,0x00,0x00,0xff,0xff,0x03,0x00,0x19,0xcf,0xf5,0xc0,0xf9,0x65,0xe8,
|
||||
0x78,0xc3,0xfa,0x5f,0x0a,0xf6,0x09,0x17,0xd8,0xb0,0x54,0xb9,0x02,0x8d,0x91,0x31,
|
||||
0x9c,0x42,0x5a,0x68,0x39,0x31,0x41,0x59,0x26,0x53,0x59,0xc1,0x52,0x36,0xf7,0x00,
|
||||
0x00,0x03,0x41,0x00,0x00,0x10,0x02,0x44,0xa0,0x00,0x21,0xb4,0x01,0x9a,0x0d,0x46,
|
||||
0xa5,0x32,0x38,0xbb,0x92,0x29,0xc2,0x84,0x86,0x0a,0x91,0xb7,0xb8
|
||||
};
|
||||
|
||||
/* Verify that a file records with no compression
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1
|
||||
xar --compression none -cf archive9.xar f1
|
||||
od -t x1 archive9.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive9.xar.txt
|
||||
*/
|
||||
|
||||
static unsigned char archive9[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x98,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x47,0x00,0x00,0x00,0x01,0x78,0xda,0xa4,0x53,
|
||||
0x4d,0x6f,0xe3,0x20,0x14,0xbc,0xf7,0x57,0x20,0xee,0x5e,0xc0,0x25,0x89,0x1d,0x11,
|
||||
0xaa,0x5e,0xaa,0xbd,0x6f,0xf6,0xb2,0x37,0x02,0x8f,0x18,0xc5,0x1f,0x11,0xc6,0x55,
|
||||
0xba,0xbf,0x7e,0x01,0xdb,0xad,0xba,0x55,0x7b,0xa9,0x64,0xc9,0xe3,0x61,0xde,0x78,
|
||||
0x78,0xf0,0xc4,0xc3,0xad,0x6b,0xd1,0x33,0xf8,0xd1,0x0d,0xfd,0x01,0xb3,0x1f,0x14,
|
||||
0x23,0xe8,0xf5,0x60,0x5c,0x7f,0x3e,0xe0,0xdf,0xc7,0xa7,0xa2,0xc2,0x0f,0xf2,0x4e,
|
||||
0xdc,0x94,0x97,0x77,0x48,0x84,0x41,0xc7,0x17,0x12,0xda,0x83,0x0a,0xb1,0xa2,0x08,
|
||||
0xae,0x03,0x59,0x52,0x5a,0x17,0xac,0x2c,0x28,0x3f,0xd2,0x7a,0xcf,0xaa,0x3d,0xaf,
|
||||
0x05,0x79,0x2f,0xc9,0x45,0x0d,0xe8,0xcb,0x38,0x75,0x68,0x0c,0x2f,0x2d,0x1c,0xf0,
|
||||
0xd8,0x28,0x86,0xd3,0x0a,0x12,0x83,0xb5,0x23,0x04,0x49,0x05,0x59,0x50,0x66,0x47,
|
||||
0xf7,0x37,0x99,0x0b,0x92,0x41,0xb2,0x20,0xab,0x47,0xfe,0xb2,0xae,0x05,0xe4,0x4c,
|
||||
0x8c,0xbd,0xd8,0x18,0x15,0x54,0x46,0x48,0xb4,0xd0,0x9f,0x43,0x23,0xd9,0x56,0x90,
|
||||
0x05,0xce,0xfc,0xba,0xb9,0x35,0x84,0xba,0x5e,0x5b,0xa7,0x73,0x52,0x32,0xe8,0x00,
|
||||
0xa1,0x18,0x43,0x4c,0xde,0x61,0xb2,0x14,0x2c,0x81,0xca,0xf7,0xd9,0x96,0x70,0xc9,
|
||||
0x7e,0x0d,0x17,0x39,0xe5,0x75,0xe3,0x9e,0xc1,0x14,0xff,0x6f,0xf5,0xd7,0xcf,0xc7,
|
||||
0x98,0x71,0x63,0x76,0xfc,0xa4,0x4f,0x7a,0x57,0x9b,0x7b,0x5b,0x9f,0x2c,0x57,0xd6,
|
||||
0x56,0x96,0x57,0x55,0x45,0x81,0x6f,0xca,0xed,0x86,0x5b,0xa0,0xba,0x8e,0xcd,0xfb,
|
||||
0x60,0xb4,0xa6,0xbf,0x05,0xaf,0x62,0xca,0xef,0xff,0xe1,0xa3,0xd3,0xdc,0x42,0xf2,
|
||||
0xda,0x43,0xa1,0x3f,0x39,0xdc,0xed,0x9f,0x78,0x0e,0xeb,0xa9,0x22,0xd1,0x65,0xc8,
|
||||
0xea,0x1d,0x2d,0x28,0x2b,0x68,0x79,0xa4,0x74,0x9f,0x1e,0x16,0x65,0xdd,0x9b,0x4c,
|
||||
0x7d,0x21,0x53,0x6f,0xb2,0xb3,0x1f,0xa6,0xab,0xd4,0x13,0x08,0x32,0xc3,0x99,0x75,
|
||||
0x46,0x32,0x4a,0x59,0x24,0x23,0xca,0xd4,0x34,0x82,0x9f,0x75,0x19,0xcd,0xdc,0xab,
|
||||
0x6c,0x5a,0x65,0xdd,0x60,0x40,0xd2,0x2d,0xe7,0x31,0x4c,0x82,0x99,0x0c,0x2f,0x57,
|
||||
0x40,0xad,0xeb,0x2f,0x07,0x3c,0x78,0x77,0x76,0xbd,0x6a,0xb1,0x6c,0x94,0x37,0x89,
|
||||
0x13,0x24,0x2d,0xcf,0xc2,0x5e,0xc5,0x5c,0x36,0xfa,0x65,0x90,0x6f,0x60,0xba,0x74,
|
||||
0x69,0x14,0x48,0x9e,0x05,0x41,0xf2,0x64,0xfc,0x03,0x00,0x00,0xff,0xff,0x03,0x00,
|
||||
0xee,0x8e,0xf8,0x75,0xa1,0xaf,0x74,0x71,0x3f,0x40,0x08,0xab,0x13,0x7d,0xc0,0x82,
|
||||
0x3a,0x56,0xeb,0x4e,0x35,0xf1,0x35,0xb7,0x68,0x65,0x6c,0x6c,0x6f,0x68,0x65,0x6c,
|
||||
0x6c,0x6f,0x68,0x65,0x6c,0x6c,0x6f,0x0a
|
||||
};
|
||||
|
||||
/* Verify that a file records with md5 hashing algorithm
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1
|
||||
xar --toc-cksum md5 -cf archive10.xar f1
|
||||
od -t x1 archive10.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive10.xar.txt
|
||||
*/
|
||||
|
||||
static unsigned char archive10[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xaf,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x40,0x00,0x00,0x00,0x02,0x78,0xda,0x7c,0x53,
|
||||
0x4d,0x6f,0xdc,0x20,0x10,0xbd,0xe7,0x57,0x20,0xee,0x0e,0x60,0xb3,0xb6,0x59,0xb1,
|
||||
0x44,0xbd,0x44,0xbd,0x77,0x7b,0xe9,0x8d,0xe5,0xc3,0x8b,0xe2,0x2f,0x61,0x1c,0x6d,
|
||||
0xf2,0xeb,0x8b,0xb1,0x9d,0xb4,0x4d,0x52,0xc9,0x92,0x1f,0x8f,0xc7,0x9b,0x61,0x86,
|
||||
0xe1,0x0f,0xb7,0xae,0x05,0xcf,0xc6,0x4f,0x6e,0xe8,0x4f,0x90,0xdc,0x63,0x08,0x4c,
|
||||
0xaf,0x06,0xed,0xfa,0xe6,0x04,0x7f,0x9e,0x1f,0xb3,0x1a,0x3e,0x88,0x3b,0x7e,0x93,
|
||||
0x5e,0xdc,0x01,0x1e,0x06,0x15,0x7f,0x80,0x2b,0x6f,0x64,0x88,0x27,0xb2,0xe0,0x3a,
|
||||
0x23,0x72,0x8c,0x59,0x46,0xf2,0x0c,0xd3,0x33,0x66,0xc7,0x02,0x1f,0x69,0xcd,0xd1,
|
||||
0xdf,0x92,0x74,0xe8,0x6a,0xd4,0xd3,0x34,0x77,0x60,0x0a,0x2f,0xad,0x39,0xc1,0x4e,
|
||||
0x1f,0xe0,0xb2,0x01,0xf8,0x60,0xed,0x64,0x82,0xc0,0x1c,0x6d,0x28,0xb1,0x93,0x7b,
|
||||
0x35,0x82,0x94,0x1c,0x25,0xb0,0x38,0xa0,0xdd,0x22,0xad,0xac,0x6b,0x0d,0x70,0x3a,
|
||||
0x66,0xbd,0xd9,0x68,0x19,0x64,0x42,0x80,0xb7,0xa6,0x6f,0xc2,0x55,0xe4,0x05,0x47,
|
||||
0x1b,0x5c,0xf9,0xcd,0x7f,0x71,0xfd,0x23,0xd4,0x27,0xb1,0x22,0xb7,0xd7,0x61,0xcf,
|
||||
0x57,0x8e,0x63,0xeb,0x54,0xba,0x14,0xba,0x65,0xcd,0xab,0x1b,0x21,0xda,0xa4,0xd2,
|
||||
0xab,0xab,0x7b,0x36,0x3a,0xfb,0xf7,0x8e,0x3f,0xbe,0x7f,0x8b,0xd9,0xd9,0xba,0x28,
|
||||
0x74,0x6e,0xb5,0x22,0xac,0xa0,0xac,0x90,0x17,0x5a,0x33,0xa9,0x65,0x5e,0xd8,0xda,
|
||||
0x56,0x8c,0xd8,0x32,0xb7,0xaa,0x28,0x59,0xac,0xda,0x07,0xa3,0x3d,0x97,0x5b,0xf0,
|
||||
0x52,0x85,0x2f,0x23,0x1c,0x74,0x45,0x2f,0xea,0xa2,0x2a,0xa6,0x0b,0xcb,0x2e,0x96,
|
||||
0x4a,0x1b,0xbd,0x69,0x5d,0xd7,0xd8,0xd0,0x43,0x5e,0x1e,0xa8,0x35,0x58,0x31,0xc6,
|
||||
0xd1,0x47,0xa7,0xb5,0x78,0xe8,0xad,0x7a,0x5c,0x7d,0xd1,0xd5,0xea,0x57,0xec,0xc0,
|
||||
0xde,0x4e,0xc0,0xbb,0x04,0x09,0xab,0x70,0x86,0x49,0x86,0xf3,0x33,0xc6,0xc7,0xe5,
|
||||
0x23,0x51,0xd6,0xbd,0xcb,0xe4,0x7f,0x64,0xf2,0x5d,0xd6,0xf8,0x61,0x1e,0x85,0x9a,
|
||||
0x0d,0x47,0x2b,0x5c,0x59,0xa7,0x05,0xc1,0x98,0x44,0x32,0xa2,0x44,0xcd,0x93,0xf1,
|
||||
0xab,0x2e,0xa1,0x95,0x7b,0x93,0xcd,0xbb,0xac,0x1b,0xb4,0x11,0xb8,0xa4,0x34,0x26,
|
||||
0xb3,0xc0,0x44,0x86,0x97,0xd1,0x80,0xd6,0xf5,0x4f,0x27,0x38,0x78,0xd7,0xb8,0x5e,
|
||||
0xb6,0x50,0x5c,0xa5,0xd7,0x0b,0xc7,0xd1,0xb2,0xbd,0x0a,0x7b,0x19,0xf3,0xb2,0xd1,
|
||||
0x2f,0x81,0xf4,0xf6,0x96,0xe7,0xb6,0xcc,0x00,0x4a,0x43,0xc0,0x51,0x1a,0x89,0xdf,
|
||||
0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x27,0xf8,0xf5,0x28,0x87,0x01,0xb1,0xb7,0x18,
|
||||
0xe8,0x34,0x20,0x06,0x5c,0x66,0x9a,0x43,0x26,0xe7,0x94,0x78,0xda,0xca,0x48,0xcd,
|
||||
0xc9,0xc9,0xcf,0x80,0x13,0x5c,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x37,0xf7,
|
||||
0x06,0x47
|
||||
};
|
||||
|
||||
/* Verify that a file records with no hashing algorithm
|
||||
#How to make
|
||||
echo "hellohellohello" > f1
|
||||
chown $UNAME:$GNAME f1
|
||||
chmod 0644 f1
|
||||
env TZ=utc touch -afm -t 197001020000.01 f1
|
||||
xar --toc-cksum none -cf archive11.xar f1
|
||||
od -t x1 archive11.xar | sed -E -e 's/^0[0-9]+//;s/^ //;s/( )([0-9a-f]{2})/0x\2,/g;$ D' > archive11.xar.txt
|
||||
*/
|
||||
|
||||
static unsigned char archive11[] = {
|
||||
0x78,0x61,0x72,0x21,0x00,0x1c,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x98,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xef,0x00,0x00,0x00,0x00,0x78,0xda,0x7c,0x52,
|
||||
0xcb,0x6e,0xeb,0x20,0x14,0xdc,0xf7,0x2b,0x10,0x7b,0x17,0xb0,0x89,0x63,0x22,0x42,
|
||||
0x75,0x37,0x55,0xf7,0xcd,0xdd,0x74,0x47,0x78,0x38,0xa8,0x7e,0xc9,0xc6,0x55,0xda,
|
||||
0xaf,0xbf,0x3c,0xe2,0x56,0x55,0xd5,0x2b,0x21,0x79,0x3c,0xcc,0x39,0x67,0x74,0x18,
|
||||
0xfe,0x70,0xed,0x3b,0xf0,0x66,0xe6,0xc5,0x8d,0xc3,0x11,0x92,0x7b,0x0c,0x81,0x19,
|
||||
0xd4,0xa8,0xdd,0xd0,0x1e,0xe1,0xdf,0xd3,0x63,0xd1,0xc0,0x07,0x71,0xc7,0xaf,0x72,
|
||||
0x16,0x77,0x80,0xfb,0x51,0x85,0x0f,0xe0,0x6a,0x36,0xd2,0x87,0x8a,0xc2,0xbb,0xde,
|
||||
0x88,0x12,0x63,0x56,0x90,0xb2,0xc0,0xf4,0x44,0xf0,0x81,0x54,0x07,0x5a,0x73,0xf4,
|
||||
0x5d,0x12,0x8b,0xac,0xeb,0x0c,0x70,0x3a,0x4c,0x81,0xf1,0x1f,0x70,0x2d,0xbd,0x4c,
|
||||
0x08,0xf0,0xce,0x0c,0xad,0xbf,0x88,0xb2,0xe2,0xe8,0x06,0x33,0x3f,0x5a,0xbb,0x18,
|
||||
0x2f,0x30,0x47,0x37,0x94,0xe9,0xc5,0x7d,0x18,0x41,0xc2,0x94,0x04,0x32,0xb7,0xd9,
|
||||
0x06,0x8b,0x7f,0xef,0xcc,0x11,0xca,0x69,0xea,0x9c,0x4a,0x1e,0xd0,0xb5,0x68,0x3f,
|
||||
0xdc,0x04,0xd1,0x4d,0x2a,0x67,0x75,0x71,0x6f,0x46,0x17,0xea,0x62,0xd4,0xeb,0xb2,
|
||||
0xf6,0x5b,0xcd,0xf3,0xd3,0x9f,0x60,0xce,0x36,0x55,0xa5,0x4b,0xab,0x15,0x61,0x15,
|
||||
0x65,0x95,0x3c,0xd3,0x86,0x49,0x2d,0xcb,0xca,0x36,0x76,0xcf,0x88,0xad,0x4b,0xab,
|
||||
0xaa,0x9a,0x35,0x1c,0xfd,0x68,0xb4,0x79,0xb9,0xfa,0x59,0x2a,0xff,0xeb,0x84,0x9d,
|
||||
0xde,0xd3,0xb3,0x3a,0xab,0x3d,0xd3,0x95,0x65,0x67,0x4b,0xa5,0x0d,0xbd,0x69,0xd3,
|
||||
0x34,0xd8,0xd0,0x5d,0x59,0xef,0xa8,0x35,0x58,0x31,0xc6,0xd1,0xcf,0x4e,0x79,0x77,
|
||||
0xe8,0x73,0x79,0x5c,0xfd,0xf2,0x08,0xe4,0x25,0xbc,0xc2,0xb6,0x7d,0xc0,0xfb,0x04,
|
||||
0x09,0xdb,0xe3,0x02,0x93,0x02,0x97,0x27,0x8c,0x0f,0xf1,0x44,0x59,0xff,0x25,0x93,
|
||||
0xff,0x91,0xc9,0x2f,0x59,0x3b,0x8f,0xeb,0x24,0xd4,0x6a,0x38,0xca,0x30,0xb3,0x4e,
|
||||
0x0b,0x82,0x31,0x09,0x64,0x40,0x89,0x5a,0x17,0x33,0x67,0x5d,0x42,0x99,0xfb,0x94,
|
||||
0xad,0x9b,0xac,0x1f,0xb5,0x11,0xb8,0xa6,0x34,0x98,0x89,0x30,0x91,0xfe,0x7d,0x32,
|
||||
0xa0,0x73,0xc3,0xeb,0x11,0x8e,0xb3,0x6b,0xdd,0x20,0x3b,0x28,0x2e,0x72,0xd6,0x91,
|
||||
0xe3,0x28,0x5e,0x67,0xe1,0x20,0x83,0x2f,0x1b,0xfa,0x25,0x10,0xc3,0x86,0x62,0xda,
|
||||
0x62,0x64,0x51,0xca,0x2c,0x47,0x29,0xc1,0xff,0x00,0x00,0x00,0xff,0xff,0x03,0x00,
|
||||
0xf1,0x18,0xdc,0x71,0x78,0xda,0xca,0x48,0xcd,0xc9,0xc9,0xcf,0x80,0x13,0x5c,0x00,
|
||||
0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x37,0xf7,0x06,0x47
|
||||
};
|
||||
|
||||
enum enc {
|
||||
GZIP,
|
||||
BZIP2
|
||||
};
|
||||
|
||||
static void verify(unsigned char *d, size_t s,
|
||||
void (*f1)(struct archive *, struct archive_entry *),
|
||||
void (*f2)(struct archive *, struct archive_entry *),
|
||||
enum enc etype)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
unsigned char *buff;
|
||||
int r;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
switch (etype) {
|
||||
case BZIP2:
|
||||
/* This is only check whether bzip is supported or not.
|
||||
* This filter won't be used this test. */
|
||||
if (ARCHIVE_OK != archive_read_support_compression_bzip2(a)) {
|
||||
skipping("Unsupported bzip2");
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GZIP:
|
||||
/* This gzip must be needed. archive_read_support_format_xar()
|
||||
* will return a warning if gzip is unsupported. */
|
||||
break;
|
||||
}
|
||||
assertA(0 == archive_read_support_compression_all(a));
|
||||
r = archive_read_support_format_xar(a);
|
||||
if (r == ARCHIVE_WARN) {
|
||||
skipping("xar reading not fully supported on this platform");
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
|
||||
return;
|
||||
}
|
||||
assert((buff = malloc(100000)) != NULL);
|
||||
if (buff == NULL)
|
||||
return;
|
||||
memcpy(buff, d, s);
|
||||
memset(buff + s, 0, 2048);
|
||||
|
||||
assertA(0 == archive_read_support_format_all(a));
|
||||
assertA(0 == archive_read_open_memory(a, buff, s + 1024));
|
||||
assertA(0 == archive_read_next_header(a, &ae));
|
||||
assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
|
||||
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_XAR);
|
||||
/* Verify the only entry. */
|
||||
f1(a, ae);
|
||||
if (f2) {
|
||||
assertA(0 == archive_read_next_header(a, &ae));
|
||||
assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
|
||||
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_XAR);
|
||||
/* Verify the only entry. */
|
||||
f2(a, ae);
|
||||
}
|
||||
/* End of archive. */
|
||||
assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
assertA(0 == archive_read_close(a));
|
||||
assertA(0 == archive_read_finish(a));
|
||||
free(buff);
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_xar)
|
||||
{
|
||||
verify(archive1, sizeof(archive1), verify0, verify1, GZIP);
|
||||
verify(archive2, sizeof(archive2), verify0, verify2, GZIP);
|
||||
verify(archive3, sizeof(archive3), verify3, NULL, GZIP);
|
||||
verify(archive4, sizeof(archive4), verify4, NULL, GZIP);
|
||||
verify(archive5, sizeof(archive5), verify5, NULL, GZIP);
|
||||
verify(archive6, sizeof(archive6), verify6, NULL, GZIP);
|
||||
verify(archive7, sizeof(archive7), verify7, NULL, GZIP);
|
||||
verify(archive8, sizeof(archive8), verify0, NULL, BZIP2);
|
||||
verify(archive9, sizeof(archive9), verify0, NULL, GZIP);
|
||||
verify(archive10, sizeof(archive10), verify0, NULL, GZIP);
|
||||
verify(archive11, sizeof(archive11), verify0, NULL, GZIP);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ DEFINE_TEST(test_read_large)
|
||||
archive_entry_set_pathname(entry, "test");
|
||||
assertA(0 == archive_write_header(a, entry));
|
||||
archive_entry_free(entry);
|
||||
assertA(sizeof(testdata) == archive_write_data(a, testdata, sizeof(testdata)));
|
||||
assertA((int)sizeof(testdata) == archive_write_data(a, testdata, sizeof(testdata)));
|
||||
assertA(0 == archive_write_finish(a));
|
||||
|
||||
assert(NULL != (a = archive_read_new()));
|
||||
|
@ -52,7 +52,7 @@ DEFINE_TEST(test_read_truncated)
|
||||
archive_entry_set_size(ae, sizeof(buff2));
|
||||
assertA(0 == archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
assertA(sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
|
||||
assertA((int)sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
|
||||
|
||||
/* Close out the archive. */
|
||||
assertA(0 == archive_write_close(a));
|
||||
@ -81,7 +81,7 @@ DEFINE_TEST(test_read_truncated)
|
||||
assertA(ARCHIVE_FATAL == archive_read_data(a, buff2, sizeof(buff2)));
|
||||
goto wrap_up;
|
||||
} else {
|
||||
assertA(sizeof(buff2) == archive_read_data(a, buff2, sizeof(buff2)));
|
||||
assertA((int)sizeof(buff2) == archive_read_data(a, buff2, sizeof(buff2)));
|
||||
}
|
||||
|
||||
/* Verify the end of the archive. */
|
||||
|
@ -53,7 +53,7 @@ test_filename(const char *prefix, int dlen, int flen)
|
||||
}
|
||||
for (; i < dlen + flen + separator; i++)
|
||||
filename[i] = 'b';
|
||||
filename[i++] = '\0';
|
||||
filename[i] = '\0';
|
||||
|
||||
strcpy(dirname, filename);
|
||||
|
||||
|
@ -112,6 +112,8 @@ test_format(int (*set_format)(struct archive *))
|
||||
|
||||
/*
|
||||
* Damage the second entry to test the search-ahead recovery.
|
||||
* TODO: Move the damage-recovery checking to a separate test;
|
||||
* it doesn't really belong in this write test.
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
@ -124,7 +126,7 @@ test_format(int (*set_format)(struct archive *))
|
||||
}
|
||||
}
|
||||
failure("Unable to locate the second header for damage-recovery test.");
|
||||
assert(damaged = 1);
|
||||
assert(damaged == 1);
|
||||
|
||||
/*
|
||||
* Now, read the data back.
|
||||
@ -151,28 +153,14 @@ test_format(int (*set_format)(struct archive *))
|
||||
assert(0 == memcmp(filedata, "12345678", 8));
|
||||
|
||||
/*
|
||||
* Read the second file back.
|
||||
* The second file can't be read because we damaged its header.
|
||||
*/
|
||||
if (!damaged) {
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(1, archive_entry_mtime(ae));
|
||||
/* Not the same as above: cpio doesn't store hi-res times. */
|
||||
assert(0 == archive_entry_mtime_nsec(ae));
|
||||
assert(0 == archive_entry_atime(ae));
|
||||
assert(0 == archive_entry_ctime(ae));
|
||||
assertEqualString("file2", archive_entry_pathname(ae));
|
||||
assert((S_IFREG | 0755) == archive_entry_mode(ae));
|
||||
assertEqualInt(4, archive_entry_size(ae));
|
||||
assertEqualIntA(a, 4, archive_read_data(a, filedata, 10));
|
||||
assert(0 == memcmp(filedata, "1234", 4));
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the dir entry back.
|
||||
* ARCHIVE_WARN here because the damaged entry was skipped.
|
||||
*/
|
||||
assertEqualIntA(a,
|
||||
damaged ? ARCHIVE_WARN : ARCHIVE_OK,
|
||||
archive_read_next_header(a, &ae));
|
||||
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
|
||||
assertEqualInt(11, archive_entry_mtime(ae));
|
||||
assert(0 == archive_entry_mtime_nsec(ae));
|
||||
assert(0 == archive_entry_atime(ae));
|
||||
|
Loading…
Reference in New Issue
Block a user