From 59843292042aeac40aceffcea2323350313cef22 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 20 Jun 2017 14:06:13 +0900 Subject: [PATCH] Imported Upstream version 3.2.2 Change-Id: Id505d6a62d71781731fdf0a4d9139d31c3e3190c Signed-off-by: DongHun Kwak --- CMakeLists.txt | 43 ++- Makefile.am | 7 + Makefile.in | 118 +++++++- NEWS | 3 + README | 163 ---------- aclocal.m4 | 36 +++ build/autoconf/config.guess | 8 +- build/autoconf/config.sub | 8 +- build/cmake/CheckStructMember.cmake | 43 --- build/cmake/config.h.in | 12 + build/version | 2 +- cat/test/CMakeLists.txt | 3 +- cat/test/main.c | 86 +++++- cat/test/test.h | 10 + cat/test/test_version.c | 2 +- config.h.in | 9 + configure | 178 +++++++++-- configure.ac | 31 +- cpio/cmdline.c | 1 + cpio/cpio.c | 2 +- cpio/test/CMakeLists.txt | 3 +- cpio/test/main.c | 86 +++++- cpio/test/test.h | 10 + cpio/test/test_option_version.c | 6 +- doc/html/archive_entry.3.html | 2 +- doc/html/archive_entry_acl.3.html | 2 +- doc/html/archive_entry_linkify.3.html | 2 +- doc/html/archive_entry_paths.3.html | 2 +- doc/html/archive_entry_perms.3.html | 2 +- doc/html/archive_entry_stat.3.html | 2 +- doc/html/archive_entry_time.3.html | 2 +- doc/html/archive_read.3.html | 2 +- doc/html/archive_read_add_passphrase.3.html | 2 +- doc/html/archive_read_data.3.html | 2 +- doc/html/archive_read_disk.3.html | 2 +- doc/html/archive_read_extract.3.html | 2 +- doc/html/archive_read_filter.3.html | 2 +- doc/html/archive_read_format.3.html | 2 +- doc/html/archive_read_free.3.html | 2 +- doc/html/archive_read_header.3.html | 2 +- doc/html/archive_read_new.3.html | 2 +- doc/html/archive_read_open.3.html | 2 +- doc/html/archive_read_set_options.3.html | 2 +- doc/html/archive_util.3.html | 2 +- doc/html/archive_write.3.html | 2 +- doc/html/archive_write_blocksize.3.html | 2 +- doc/html/archive_write_data.3.html | 2 +- doc/html/archive_write_disk.3.html | 2 +- doc/html/archive_write_filter.3.html | 2 +- doc/html/archive_write_finish_entry.3.html | 2 +- doc/html/archive_write_format.3.html | 2 +- doc/html/archive_write_free.3.html | 2 +- doc/html/archive_write_header.3.html | 2 +- doc/html/archive_write_new.3.html | 2 +- doc/html/archive_write_open.3.html | 2 +- doc/html/archive_write_set_options.3.html | 2 +- doc/html/archive_write_set_passphrase.3.html | 2 +- doc/html/bsdcpio.1.html | 2 +- doc/html/bsdtar.1.html | 2 +- doc/html/cpio.5.html | 2 +- doc/html/libarchive-formats.5.html | 2 +- doc/html/libarchive.3.html | 2 +- doc/html/libarchive_changes.3.html | 2 +- doc/html/libarchive_internals.3.html | 2 +- doc/html/mtree.5.html | 2 +- doc/html/tar.5.html | 2 +- doc/pdf/archive_entry.3.pdf | Bin 7221 -> 7221 bytes doc/pdf/archive_entry_acl.3.pdf | Bin 9036 -> 9036 bytes doc/pdf/archive_entry_linkify.3.pdf | Bin 8417 -> 8417 bytes doc/pdf/archive_entry_paths.3.pdf | Bin 7348 -> 7348 bytes doc/pdf/archive_entry_perms.3.pdf | Bin 9046 -> 9046 bytes doc/pdf/archive_entry_stat.3.pdf | Bin 10154 -> 10154 bytes doc/pdf/archive_entry_time.3.pdf | Bin 6036 -> 6036 bytes doc/pdf/archive_read.3.pdf | Bin 10266 -> 10266 bytes doc/pdf/archive_read_add_passphrase.3.pdf | Bin 4458 -> 4458 bytes doc/pdf/archive_read_data.3.pdf | Bin 6784 -> 6784 bytes doc/pdf/archive_read_disk.3.pdf | Bin 12125 -> 12125 bytes doc/pdf/archive_read_extract.3.pdf | Bin 6968 -> 6968 bytes doc/pdf/archive_read_filter.3.pdf | Bin 6304 -> 6304 bytes doc/pdf/archive_read_format.3.pdf | Bin 7996 -> 7996 bytes doc/pdf/archive_read_free.3.pdf | Bin 5089 -> 5089 bytes doc/pdf/archive_read_header.3.pdf | Bin 4885 -> 4885 bytes doc/pdf/archive_read_new.3.pdf | Bin 4177 -> 4177 bytes doc/pdf/archive_read_open.3.pdf | Bin 9286 -> 9286 bytes doc/pdf/archive_read_set_options.3.pdf | Bin 7543 -> 7543 bytes doc/pdf/archive_util.3.pdf | Bin 9195 -> 9195 bytes doc/pdf/archive_write.3.pdf | Bin 10850 -> 10850 bytes doc/pdf/archive_write_blocksize.3.pdf | Bin 6326 -> 6326 bytes doc/pdf/archive_write_data.3.pdf | Bin 4604 -> 4604 bytes doc/pdf/archive_write_disk.3.pdf | Bin 16677 -> 16677 bytes doc/pdf/archive_write_filter.3.pdf | Bin 5817 -> 5817 bytes doc/pdf/archive_write_finish_entry.3.pdf | Bin 4704 -> 4704 bytes doc/pdf/archive_write_format.3.pdf | Bin 7445 -> 7445 bytes doc/pdf/archive_write_free.3.pdf | Bin 4975 -> 4975 bytes doc/pdf/archive_write_header.3.pdf | Bin 4541 -> 4541 bytes doc/pdf/archive_write_new.3.pdf | Bin 4153 -> 4153 bytes doc/pdf/archive_write_open.3.pdf | Bin 9097 -> 9097 bytes doc/pdf/archive_write_set_options.3.pdf | Bin 17843 -> 17843 bytes doc/pdf/archive_write_set_passphrase.3.pdf | Bin 4440 -> 4440 bytes doc/pdf/bsdcpio.1.pdf | Bin 15501 -> 15501 bytes doc/pdf/bsdtar.1.pdf | Bin 42455 -> 42455 bytes doc/pdf/cpio.5.pdf | Bin 13366 -> 13366 bytes doc/pdf/libarchive-formats.5.pdf | Bin 21501 -> 21501 bytes doc/pdf/libarchive.3.pdf | Bin 11033 -> 11033 bytes doc/pdf/libarchive_changes.3.pdf | Bin 12154 -> 12154 bytes doc/pdf/libarchive_internals.3.pdf | Bin 17132 -> 17132 bytes doc/pdf/mtree.5.pdf | Bin 10134 -> 10134 bytes doc/pdf/tar.5.pdf | Bin 36764 -> 36764 bytes examples/minitar/minitar.c | 8 +- libarchive/archive.h | 4 +- libarchive/archive_acl.c | 5 +- libarchive/archive_entry.h | 2 +- libarchive/archive_match.c | 2 +- libarchive/archive_platform.h | 9 + libarchive/archive_ppmd7_private.h | 2 +- libarchive/archive_read_add_passphrase.c | 22 +- libarchive/archive_read_disk_entry_from_file.c | 185 +++++++++--- libarchive/archive_read_disk_posix.c | 47 +-- libarchive/archive_read_disk_set_standard_lookup.c | 2 + libarchive/archive_read_disk_windows.c | 6 +- libarchive/archive_read_private.h | 2 +- libarchive/archive_read_support_filter_lz4.c | 2 +- libarchive/archive_read_support_format_7zip.c | 10 + libarchive/archive_read_support_format_lha.c | 8 +- libarchive/archive_read_support_format_mtree.c | 11 +- libarchive/archive_read_support_format_tar.c | 28 +- libarchive/archive_read_support_format_warc.c | 22 +- libarchive/archive_read_support_format_zip.c | 42 ++- libarchive/archive_string.c | 51 ++-- libarchive/archive_util.c | 2 +- libarchive/archive_write_disk_acl.c | 97 ++++-- libarchive/archive_write_disk_posix.c | 330 ++++++++++++++++----- libarchive/archive_write_set_format_iso9660.c | 2 +- libarchive/archive_write_set_format_ustar.c | 2 +- libarchive/config_freebsd.h | 1 + libarchive/test/CMakeLists.txt | 9 +- libarchive/test/list.h | 10 +- libarchive/test/main.c | 86 +++++- libarchive/test/test.h | 10 + libarchive/test/test_acl_freebsd_nfs4.c | 2 +- libarchive/test/test_acl_freebsd_posix1e.c | 173 ++++++++++- libarchive/test/test_archive_string_conversion.c | 4 +- libarchive/test/test_fuzz.c | 10 +- libarchive/test/test_read_format_mtree_crash747.c | 49 +++ .../test_read_format_mtree_crash747.mtree.bz2.uu | 6 + libarchive/test/test_read_format_rar.c | 2 +- .../test/test_read_format_zip_high_compression.c | 153 ++++++++++ .../test_read_format_zip_high_compression.zip.uu | 18 ++ libarchive/test/test_read_set_format.c | 33 ++- libarchive/test/test_write_disk_secure744.c | 95 ++++++ libarchive/test/test_write_disk_secure745.c | 79 +++++ libarchive/test/test_write_disk_secure746.c | 129 ++++++++ .../test/test_write_format_gnutar_filenames.c | 12 +- libarchive/test/test_write_format_iso9660.c | 203 ++++++++++++- libarchive_fe/passphrase.c | 33 ++- tar/cmdline.c | 1 + tar/subst.c | 1 + tar/test/CMakeLists.txt | 3 +- tar/test/main.c | 86 +++++- tar/test/test.h | 10 + tar/test/test_missing_file.c | 6 +- tar/test/test_option_H_upper.c | 4 +- tar/test/test_option_L_upper.c | 12 +- tar/test/test_option_U_upper.c | 4 +- tar/test/test_option_b.c | 2 +- tar/test/test_option_n.c | 2 +- tar/test/test_symlink_dir.c | 2 +- tar/test/test_version.c | 2 +- tar/util.c | 2 +- tar/write.c | 2 + 170 files changed, 2485 insertions(+), 628 deletions(-) delete mode 100644 README delete mode 100644 build/cmake/CheckStructMember.cmake create mode 100644 libarchive/test/test_read_format_mtree_crash747.c create mode 100644 libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu create mode 100644 libarchive/test/test_read_format_zip_high_compression.c create mode 100644 libarchive/test/test_read_format_zip_high_compression.zip.uu create mode 100644 libarchive/test/test_write_disk_secure744.c create mode 100644 libarchive/test/test_write_disk_secure745.c create mode 100644 libarchive/test/test_write_disk_secure746.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 68e94a6..a376fce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,7 @@ INCLUDE(CheckHeaderDirent) INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFiles) INCLUDE(CheckLibraryExists) -INCLUDE(CheckStructMember) +INCLUDE(CheckStructHasMember) INCLUDE(CheckSymbolExists) INCLUDE(CheckTypeExists) INCLUDE(CheckTypeSize) @@ -1274,6 +1274,14 @@ CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) CMAKE_POP_CHECK_STATE() # Restore the state of the variables +CHECK_C_SOURCE_COMPILES( + "#include \n#include \nint main(void) { struct vfsconf v; return sizeof(v);}" + HAVE_STRUCT_VFSCONF) + +CHECK_C_SOURCE_COMPILES( + "#include \n#include \nint main(void) { struct xvfsconf v; return sizeof(v);}" + HAVE_STRUCT_XVFSCONF) + # Make sure we have the POSIX version of readdir_r, not the # older 2-argument version. CHECK_C_SOURCE_COMPILES( @@ -1299,6 +1307,10 @@ CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_SYSMACROS) +CHECK_C_SOURCE_COMPILES( + "#include \n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}" + HAVE_LZMA_STREAM_ENCODER_MT) + IF(HAVE_STRERROR_R) SET(HAVE_DECL_STRERROR_R 1) ENDIF(HAVE_STRERROR_R) @@ -1332,47 +1344,47 @@ CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) # Check struct members # # Check for tm_gmtoff in struct tm -CHECK_STRUCT_MEMBER("struct tm" tm_gmtoff +CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" HAVE_STRUCT_TM_TM_GMTOFF) -CHECK_STRUCT_MEMBER("struct tm" __tm_gmtoff +CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" HAVE_STRUCT_TM___TM_GMTOFF) # Check for f_namemax in struct statfs -CHECK_STRUCT_MEMBER("struct statfs" f_namemax +CHECK_STRUCT_HAS_MEMBER("struct statfs" f_namemax "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX) # Check for birthtime in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtime +CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) # Check for high-resolution timestamps in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec +CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtimespec.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_n +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_n "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N) -CHECK_STRUCT_MEMBER("struct stat" st_umtime +CHECK_STRUCT_HAS_MEMBER("struct stat" st_umtime "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_usec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC) # Check for block size support in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_blksize +CHECK_STRUCT_HAS_MEMBER("struct stat" st_blksize "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) # Check for st_flags in struct stat (BSD fflags) -CHECK_STRUCT_MEMBER("struct stat" st_flags +CHECK_STRUCT_HAS_MEMBER("struct stat" st_flags "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) IF(HAVE_SYS_STATVFS_H) - CHECK_STRUCT_MEMBER("struct statvfs" f_iosize + CHECK_STRUCT_HAS_MEMBER("struct statvfs" f_iosize "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE) ENDIF() # # -CHECK_STRUCT_MEMBER("struct tm" tm_sec +CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) # @@ -1592,6 +1604,7 @@ IF(ENABLE_ACL) # test for specific permissions in a permset.) Linux uses the obvious # name, FreeBSD adds _np to mark it as "non-Posix extension." # Test for both as a double-check that we really have POSIX-style ACL support. + CHECK_FUNCTION_EXISTS(acl_get_fd_np HAVE_ACL_GET_FD_NP) CHECK_FUNCTION_EXISTS(acl_get_perm HAVE_ACL_GET_PERM) CHECK_FUNCTION_EXISTS(acl_get_perm_np HAVE_ACL_GET_PERM_NP) CHECK_FUNCTION_EXISTS(acl_get_link HAVE_ACL_GET_LINK) diff --git a/Makefile.am b/Makefile.am index b02797f..5fe2d49 100644 --- a/Makefile.am +++ b/Makefile.am @@ -449,6 +449,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_lha_bugfix_0.c \ libarchive/test/test_read_format_lha_filename.c \ libarchive/test/test_read_format_mtree.c \ + libarchive/test/test_read_format_mtree_crash747.c \ libarchive/test/test_read_format_pax_bz2.c \ libarchive/test/test_read_format_rar.c \ libarchive/test/test_read_format_rar_encryption_data.c \ @@ -475,6 +476,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_zip_encryption_partially.c \ libarchive/test/test_read_format_zip_encryption_header.c \ libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_high_compression.c \ libarchive/test/test_read_format_zip_mac_metadata.c \ libarchive/test/test_read_format_zip_malformed.c \ libarchive/test/test_read_format_zip_msdos.c \ @@ -509,6 +511,9 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_disk_no_hfs_compression.c \ libarchive/test/test_write_disk_perms.c \ libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_secure744.c \ + libarchive/test/test_write_disk_secure745.c \ + libarchive/test/test_write_disk_secure746.c \ libarchive/test/test_write_disk_sparse.c \ libarchive/test/test_write_disk_symlink.c \ libarchive/test/test_write_disk_times.c \ @@ -657,6 +662,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ libarchive/test/test_read_filter_lzop.tar.lzo.uu \ libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ + libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu \ libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ @@ -782,6 +788,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ + libarchive/test/test_read_format_zip_high_compression.zip.uu \ libarchive/test/test_read_format_zip_length_at_end.zip.uu \ libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ libarchive/test/test_read_format_zip_malformed1.zip.uu \ diff --git a/Makefile.in b/Makefile.in index 0d860d3..46b6976 100644 --- a/Makefile.in +++ b/Makefile.in @@ -857,6 +857,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_read_format_lha_bugfix_0.c \ libarchive/test/test_read_format_lha_filename.c \ libarchive/test/test_read_format_mtree.c \ + libarchive/test/test_read_format_mtree_crash747.c \ libarchive/test/test_read_format_pax_bz2.c \ libarchive/test/test_read_format_rar.c \ libarchive/test/test_read_format_rar_encryption_data.c \ @@ -883,6 +884,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_read_format_zip_encryption_partially.c \ libarchive/test/test_read_format_zip_encryption_header.c \ libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_high_compression.c \ libarchive/test/test_read_format_zip_mac_metadata.c \ libarchive/test/test_read_format_zip_malformed.c \ libarchive/test/test_read_format_zip_msdos.c \ @@ -917,6 +919,9 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_write_disk_no_hfs_compression.c \ libarchive/test/test_write_disk_perms.c \ libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_secure744.c \ + libarchive/test/test_write_disk_secure745.c \ + libarchive/test/test_write_disk_secure746.c \ libarchive/test/test_write_disk_sparse.c \ libarchive/test/test_write_disk_symlink.c \ libarchive/test/test_write_disk_times.c \ @@ -1230,6 +1235,7 @@ am_libarchive_test_OBJECTS = $(am__objects_9) $(am__objects_10) \ libarchive/test/libarchive_test-test_read_format_lha_bugfix_0.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_lha_filename.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_mtree.$(OBJEXT) \ + libarchive/test/libarchive_test-test_read_format_mtree_crash747.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_pax_bz2.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_rar.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_rar_encryption_data.$(OBJEXT) \ @@ -1256,6 +1262,7 @@ am_libarchive_test_OBJECTS = $(am__objects_9) $(am__objects_10) \ libarchive/test/libarchive_test-test_read_format_zip_encryption_partially.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_zip_encryption_header.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_zip_filename.$(OBJEXT) \ + libarchive/test/libarchive_test-test_read_format_zip_high_compression.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_zip_mac_metadata.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_zip_malformed.$(OBJEXT) \ libarchive/test/libarchive_test-test_read_format_zip_msdos.$(OBJEXT) \ @@ -1290,6 +1297,9 @@ am_libarchive_test_OBJECTS = $(am__objects_9) $(am__objects_10) \ libarchive/test/libarchive_test-test_write_disk_no_hfs_compression.$(OBJEXT) \ libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT) \ libarchive/test/libarchive_test-test_write_disk_secure.$(OBJEXT) \ + libarchive/test/libarchive_test-test_write_disk_secure744.$(OBJEXT) \ + libarchive/test/libarchive_test-test_write_disk_secure745.$(OBJEXT) \ + libarchive/test/libarchive_test-test_write_disk_secure746.$(OBJEXT) \ libarchive/test/libarchive_test-test_write_disk_sparse.$(OBJEXT) \ libarchive/test/libarchive_test-test_write_disk_symlink.$(OBJEXT) \ libarchive/test/libarchive_test-test_write_disk_times.$(OBJEXT) \ @@ -1618,7 +1628,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/build/autoconf/missing \ $(top_srcdir)/build/autoconf/test-driver \ $(top_srcdir)/build/pkgconfig/libarchive.pc.in COPYING INSTALL \ - NEWS README build/autoconf/compile build/autoconf/config.guess \ + NEWS build/autoconf/compile build/autoconf/config.guess \ build/autoconf/config.rpath build/autoconf/config.sub \ build/autoconf/depcomp build/autoconf/install-sh \ build/autoconf/ltmain.sh build/autoconf/missing @@ -1689,6 +1699,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ @@ -2159,6 +2170,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_read_format_lha_bugfix_0.c \ libarchive/test/test_read_format_lha_filename.c \ libarchive/test/test_read_format_mtree.c \ + libarchive/test/test_read_format_mtree_crash747.c \ libarchive/test/test_read_format_pax_bz2.c \ libarchive/test/test_read_format_rar.c \ libarchive/test/test_read_format_rar_encryption_data.c \ @@ -2185,6 +2197,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_read_format_zip_encryption_partially.c \ libarchive/test/test_read_format_zip_encryption_header.c \ libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_high_compression.c \ libarchive/test/test_read_format_zip_mac_metadata.c \ libarchive/test/test_read_format_zip_malformed.c \ libarchive/test/test_read_format_zip_msdos.c \ @@ -2219,6 +2232,9 @@ libarchive_test_SOURCES = \ libarchive/test/test_write_disk_no_hfs_compression.c \ libarchive/test/test_write_disk_perms.c \ libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_secure744.c \ + libarchive/test/test_write_disk_secure745.c \ + libarchive/test/test_write_disk_secure746.c \ libarchive/test/test_write_disk_sparse.c \ libarchive/test/test_write_disk_symlink.c \ libarchive/test/test_write_disk_times.c \ @@ -2358,6 +2374,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ libarchive/test/test_read_filter_lzop.tar.lzo.uu \ libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ + libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu \ libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ @@ -2483,6 +2500,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ + libarchive/test/test_read_format_zip_high_compression.zip.uu \ libarchive/test/test_read_format_zip_length_at_end.zip.uu \ libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ libarchive/test/test_read_format_zip_malformed1.zip.uu \ @@ -2866,7 +2884,7 @@ all: $(BUILT_SOURCES) config.h .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs am--refresh: Makefile @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -2892,9 +2910,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): @@ -2905,7 +2923,7 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -4442,6 +4460,9 @@ libarchive/test/libarchive_test-test_read_format_lha_filename.$(OBJEXT): \ libarchive/test/libarchive_test-test_read_format_mtree.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_read_format_mtree_crash747.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/libarchive_test-test_read_format_pax_bz2.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -4520,6 +4541,9 @@ libarchive/test/libarchive_test-test_read_format_zip_encryption_header.$(OBJEXT) libarchive/test/libarchive_test-test_read_format_zip_filename.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_read_format_zip_high_compression.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/libarchive_test-test_read_format_zip_mac_metadata.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -4622,6 +4646,15 @@ libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT): \ libarchive/test/libarchive_test-test_write_disk_secure.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_write_disk_secure744.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_write_disk_secure745.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/libarchive_test-test_write_disk_secure746.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/libarchive_test-test_write_disk_sparse.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -5267,6 +5300,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_lha_bugfix_0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_lha_filename.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_rar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_rar_encryption_data.Po@am__quote@ @@ -5293,6 +5327,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_encryption_header.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_encryption_partially.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_filename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_mac_metadata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_malformed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_msdos.Po@am__quote@ @@ -5327,6 +5362,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_no_hfs_compression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Po@am__quote@ @@ -10940,6 +10978,20 @@ libarchive/test/libarchive_test-test_read_format_mtree.obj: libarchive/test/test @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_mtree.obj `if test -f 'libarchive/test/test_read_format_mtree.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_mtree.c'; fi` +libarchive/test/libarchive_test-test_read_format_mtree_crash747.o: libarchive/test/test_read_format_mtree_crash747.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_mtree_crash747.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Tpo -c -o libarchive/test/libarchive_test-test_read_format_mtree_crash747.o `test -f 'libarchive/test/test_read_format_mtree_crash747.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_mtree_crash747.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_mtree_crash747.c' object='libarchive/test/libarchive_test-test_read_format_mtree_crash747.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_mtree_crash747.o `test -f 'libarchive/test/test_read_format_mtree_crash747.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_mtree_crash747.c + +libarchive/test/libarchive_test-test_read_format_mtree_crash747.obj: libarchive/test/test_read_format_mtree_crash747.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_mtree_crash747.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Tpo -c -o libarchive/test/libarchive_test-test_read_format_mtree_crash747.obj `if test -f 'libarchive/test/test_read_format_mtree_crash747.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_mtree_crash747.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_mtree_crash747.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree_crash747.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_mtree_crash747.c' object='libarchive/test/libarchive_test-test_read_format_mtree_crash747.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_mtree_crash747.obj `if test -f 'libarchive/test/test_read_format_mtree_crash747.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_mtree_crash747.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_mtree_crash747.c'; fi` + libarchive/test/libarchive_test-test_read_format_pax_bz2.o: libarchive/test/test_read_format_pax_bz2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_pax_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_pax_bz2.o `test -f 'libarchive/test/test_read_format_pax_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_pax_bz2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Po @@ -11304,6 +11356,20 @@ libarchive/test/libarchive_test-test_read_format_zip_filename.obj: libarchive/te @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_zip_filename.obj `if test -f 'libarchive/test/test_read_format_zip_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_zip_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_zip_filename.c'; fi` +libarchive/test/libarchive_test-test_read_format_zip_high_compression.o: libarchive/test/test_read_format_zip_high_compression.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_zip_high_compression.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Tpo -c -o libarchive/test/libarchive_test-test_read_format_zip_high_compression.o `test -f 'libarchive/test/test_read_format_zip_high_compression.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_zip_high_compression.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_zip_high_compression.c' object='libarchive/test/libarchive_test-test_read_format_zip_high_compression.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_zip_high_compression.o `test -f 'libarchive/test/test_read_format_zip_high_compression.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_zip_high_compression.c + +libarchive/test/libarchive_test-test_read_format_zip_high_compression.obj: libarchive/test/test_read_format_zip_high_compression.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_zip_high_compression.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Tpo -c -o libarchive/test/libarchive_test-test_read_format_zip_high_compression.obj `if test -f 'libarchive/test/test_read_format_zip_high_compression.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_zip_high_compression.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_zip_high_compression.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_high_compression.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_zip_high_compression.c' object='libarchive/test/libarchive_test-test_read_format_zip_high_compression.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_zip_high_compression.obj `if test -f 'libarchive/test/test_read_format_zip_high_compression.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_zip_high_compression.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_zip_high_compression.c'; fi` + libarchive/test/libarchive_test-test_read_format_zip_mac_metadata.o: libarchive/test/test_read_format_zip_mac_metadata.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_zip_mac_metadata.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_mac_metadata.Tpo -c -o libarchive/test/libarchive_test-test_read_format_zip_mac_metadata.o `test -f 'libarchive/test/test_read_format_zip_mac_metadata.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_zip_mac_metadata.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_mac_metadata.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip_mac_metadata.Po @@ -11780,6 +11846,48 @@ libarchive/test/libarchive_test-test_write_disk_secure.obj: libarchive/test/test @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure.obj `if test -f 'libarchive/test/test_write_disk_secure.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure.c'; fi` +libarchive/test/libarchive_test-test_write_disk_secure744.o: libarchive/test/test_write_disk_secure744.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure744.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure744.o `test -f 'libarchive/test/test_write_disk_secure744.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure744.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure744.c' object='libarchive/test/libarchive_test-test_write_disk_secure744.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure744.o `test -f 'libarchive/test/test_write_disk_secure744.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure744.c + +libarchive/test/libarchive_test-test_write_disk_secure744.obj: libarchive/test/test_write_disk_secure744.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure744.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure744.obj `if test -f 'libarchive/test/test_write_disk_secure744.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure744.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure744.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure744.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure744.c' object='libarchive/test/libarchive_test-test_write_disk_secure744.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure744.obj `if test -f 'libarchive/test/test_write_disk_secure744.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure744.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure744.c'; fi` + +libarchive/test/libarchive_test-test_write_disk_secure745.o: libarchive/test/test_write_disk_secure745.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure745.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure745.o `test -f 'libarchive/test/test_write_disk_secure745.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure745.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure745.c' object='libarchive/test/libarchive_test-test_write_disk_secure745.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure745.o `test -f 'libarchive/test/test_write_disk_secure745.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure745.c + +libarchive/test/libarchive_test-test_write_disk_secure745.obj: libarchive/test/test_write_disk_secure745.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure745.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure745.obj `if test -f 'libarchive/test/test_write_disk_secure745.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure745.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure745.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure745.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure745.c' object='libarchive/test/libarchive_test-test_write_disk_secure745.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure745.obj `if test -f 'libarchive/test/test_write_disk_secure745.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure745.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure745.c'; fi` + +libarchive/test/libarchive_test-test_write_disk_secure746.o: libarchive/test/test_write_disk_secure746.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure746.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure746.o `test -f 'libarchive/test/test_write_disk_secure746.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure746.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure746.c' object='libarchive/test/libarchive_test-test_write_disk_secure746.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure746.o `test -f 'libarchive/test/test_write_disk_secure746.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure746.c + +libarchive/test/libarchive_test-test_write_disk_secure746.obj: libarchive/test/test_write_disk_secure746.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure746.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure746.obj `if test -f 'libarchive/test/test_write_disk_secure746.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure746.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure746.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure746.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_disk_secure746.c' object='libarchive/test/libarchive_test-test_write_disk_secure746.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure746.obj `if test -f 'libarchive/test/test_write_disk_secure746.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure746.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure746.c'; fi` + libarchive/test/libarchive_test-test_write_disk_sparse.o: libarchive/test/test_write_disk_sparse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_sparse.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_sparse.o `test -f 'libarchive/test/test_write_disk_sparse.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_sparse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Po diff --git a/NEWS b/NEWS index f672d3d..dd4cfd5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Oct 23, 2016: libarchive 3.2.2 released + Security release + Jun 20, 2016: libarchive 3.2.1 released This fixes a handful of security and other critical issues with 3.2.0 diff --git a/README b/README deleted file mode 100644 index 180d284..0000000 --- a/README +++ /dev/null @@ -1,163 +0,0 @@ -README for libarchive bundle. - -Questions? Issues? - * http://www.libarchive.org is the home for ongoing - libarchive development, including documentation, and - links to the libarchive mailing lists. - * To report an issue, use the issue tracker at - https://github.com/libarchive/libarchive/issues - * To submit an enhancement to libarchive, please submit - a pull request via GitHub. - https://github.com/libarchive/libarchive/pulls - -This distribution bundle includes the following components: - * libarchive: a library for reading and writing streaming archives - * tar: the 'bsdtar' program is a full-featured 'tar' - implementation built on libarchive - * cpio: the 'bsdcpio' program is a different interface to - essentially the same functionality - * cat: the 'bsdcat' program is a simple replacement tool for - zcat, bzcat, xzcat, and such - * examples: Some small example programs that you may find useful. - * examples/minitar: a compact sample demonstrating use of libarchive. - * contrib: Various items sent to me by third parties; - please contact the authors with any questions. - -The top-level directory contains the following information files: - * NEWS - highlights of recent changes - * COPYING - what you can do with this - * INSTALL - installation instructions - * README - this file - * configure - configuration script, see INSTALL for details. - * CMakeLists.txt - input for "cmake" build tool, see INSTALL - -The following files in the top-level directory are used by the -'configure' script: - * Makefile.am, aclocal.m4, configure.ac - - used to build this distribution, only needed by maintainers - * Makefile.in, config.h.in - - templates used by configure script - -Guide to Documentation installed by this system: - * bsdtar.1 explains the use of the bsdtar program - * bsdcpio.1 explains the use of the bsdcpio program - * bsdcat.1 explains the use of the bsdcat program - * libarchive.3 gives an overview of the library as a whole - * archive_read.3, archive_write.3, archive_write_disk.3, and - archive_read_disk.3 provide detailed calling sequences for the read - and write APIs - * archive_entry.3 details the "struct archive_entry" utility class - * archive_internals.3 provides some insight into libarchive's - internal structure and operation. - * libarchive-formats.5 documents the file formats supported by the library - * cpio.5, mtree.5, and tar.5 provide detailed information about these - popular archive formats, including hard-to-find details about - modern cpio and tar variants. -The manual pages above are provided in the 'doc' directory in -a number of different formats. - -You should also read the copious comments in "archive.h" and the -source code for the sample programs for more details. Please let us -know about any errors or omissions you find. - -Currently, the library automatically detects and reads the following fomats: - * GNU tar format (including GNU long filenames, long link names, and sparse files) - * Solaris 9 extended tar format (including ACLs) - * Old V7 tar archives - * POSIX ustar - * POSIX pax interchange format - * POSIX octet-oriented cpio - * SVR4 ASCII cpio - * POSIX octet-oriented cpio - * Binary cpio (big-endian or little-endian) - * 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 - * 7-Zip archives - * Microsoft CAB format - * LHA and LZH archives - * RAR archives - * XAR archives - -The library also detects and handles any of the following before evaluating the archive: - * uuencoded files - * files with RPM wrapper - * gzip compression - * bzip2 compression - * compress/LZW compression - * lzma, lzip, and xz compression - * lz4 compression - * lzop compression - -The library can create archives in any of the following formats: - * 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). - * Old GNU tar format - * Old V7 tar format - * POSIX octet-oriented cpio - * SVR4 "newc" cpio - * shar archives - * ZIP archives (with uncompressed or "deflate" compressed entries) - * GNU and BSD 'ar' archives - * 'mtree' format - * ISO9660 format - * 7-Zip archives - * XAR archives - -When creating archives, the result can be filtered with any of the following: - * uuencode - * gzip compression - * bzip2 compression - * compress/LZW compression - * lzma, lzip, and xz compression - * lz4 compression - * lzop compression - -Notes about the library architecture: - - * This is a heavily stream-oriented system. There is no direct - support for in-place modification or random access. - - * The library is designed to be extended with new compression and - archive formats. The only requirement is that the format be - readable or writable as a stream and that each archive entry be - independent. There are articles on the libarchive Wiki explaining - how to extend libarchive. - - * On read, compression and format are always detected automatically. - - * I've attempted to minimize static link pollution. If you don't - explicitly invoke a particular feature (such as support for a - particular compression or format), it won't get pulled in to - statically-linked programs. In particular, if you don't explicitly - enable a particular compression or decompression support, you won't - need to link against the corresponding compression or decompression - libraries. This also reduces the size of statically-linked - binaries in environments where that matters. - - * On read, the library accepts whatever blocks you hand it. - Your read callback is free to pass the library a byte at a time - or mmap the entire archive and give it to the library at once. - On write, the library always produces correctly-blocked output. - - * The object-style approach allows you to have multiple archive streams - open at once. bsdtar uses this in its "@archive" extension. - - * The archive itself is read/written using callback functions. - You can read an archive directly from an in-memory buffer or - write it to a socket, if you wish. There are some utility - functions to provide easy-to-use "open file," etc, capabilities. - - * The read/write APIs are designed to allow individual entries - to be read or written to any data source: You can create - a block of data in memory and add it to a tar archive without - first writing a temporary file. You can also read an entry from - an archive and write the data directly to a socket. If you want - to read/write entries to disk, there are convenience functions to - make this especially easy. - - * Note: "pax interchange format" is really an extended tar format, - despite what the name says. diff --git a/aclocal.m4 b/aclocal.m4 index acfb5d7..8a75261 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -9462,6 +9462,42 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. diff --git a/build/autoconf/config.guess b/build/autoconf/config.guess index c4bd827..2e9ad7f 100755 --- a/build/autoconf/config.guess +++ b/build/autoconf/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2016-05-15' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1000,6 +1000,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1032,6 +1035,9 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; diff --git a/build/autoconf/config.sub b/build/autoconf/config.sub index 9feb73b..cc69b06 100755 --- a/build/autoconf/config.sub +++ b/build/autoconf/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2016-06-20' +timestamp='2016-09-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -1030,7 +1030,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1040,7 +1040,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) diff --git a/build/cmake/CheckStructMember.cmake b/build/cmake/CheckStructMember.cmake deleted file mode 100644 index 05ddb3a..0000000 --- a/build/cmake/CheckStructMember.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# - Check if the given struct or class has the specified member variable -# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) -# -# STRUCT - the name of the struct or class you are interested in -# MEMBER - the member which existence you want to check -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories - -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckCSourceCompiles) - -MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) - - SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " -${_INCLUDE_FILES} -int main() -{ - static ${_STRUCT} tmp; - if (sizeof(tmp.${_MEMBER})) - return 0; - return 0; -} -") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - -ENDMACRO (CHECK_STRUCT_MEMBER) - diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index 64f4d4d..053d205 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -293,6 +293,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `acl_create_entry' function. */ #cmakedefine HAVE_ACL_CREATE_ENTRY 1 +/* Define to 1 if you have the `acl_get_fd_np' function. */ +#cmakedefine HAVE_ACL_GET_FD_NP 1 + /* Define to 1 if you have the `acl_get_link' function. */ #cmakedefine HAVE_ACL_GET_LINK 1 @@ -721,6 +724,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZMA_H 1 +/* Define to 1 if you have a working `lzma_stream_encoder_mt' function. */ +#cmakedefine HAVE_LZMA_STREAM_ENCODER_MT 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZO_LZO1X_H 1 @@ -923,6 +929,12 @@ typedef uint64_t uintmax_t; /* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ #cmakedefine HAVE_STRUCT_TM___TM_GMTOFF 1 +/* Define to 1 if you have `struct vfsconf'. */ +#cmakedefine HAVE_STRUCT_VFSCONF 1 + +/* Define to 1 if you have `struct xvfsconf'. */ +#cmakedefine HAVE_STRUCT_XVFSCONF 1 + /* Define to 1 if you have the `symlink' function. */ #cmakedefine HAVE_SYMLINK 1 diff --git a/build/version b/build/version index f293156..f54ddaa 100644 --- a/build/version +++ b/build/version @@ -1 +1 @@ -3002001 +3002002 diff --git a/cat/test/CMakeLists.txt b/cat/test/CMakeLists.txt index 0990bcf..c4642ae 100644 --- a/cat/test/CMakeLists.txt +++ b/cat/test/CMakeLists.txt @@ -58,7 +58,8 @@ IF(ENABLE_CAT AND ENABLE_TEST) # Experimental new test handling ADD_CUSTOM_TARGET(run_bsdcat_test COMMAND bsdcat_test -p $ - -r ${CMAKE_CURRENT_SOURCE_DIR}) + -r ${CMAKE_CURRENT_SOURCE_DIR} + -vv) ADD_DEPENDENCIES(run_bsdcat_test bsdcat) ADD_DEPENDENCIES(run_all_tests run_bsdcat_test) diff --git a/cat/test/main.c b/cat/test/main.c index 0aa1deb..a579842 100644 --- a/cat/test/main.c +++ b/cat/test/main.c @@ -129,6 +129,13 @@ # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1156,6 +1163,35 @@ assertion_file_contains_lines_any_order(const char *file, int line, return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1293,6 +1329,11 @@ assertion_file_time(const char *file, int line, switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1360,6 +1401,33 @@ assertion_file_birthtime_recent(const char *file, int line, return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1399,7 +1467,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1578,8 +1646,12 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode) if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1628,6 +1700,12 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + close(fd); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1640,10 +1718,12 @@ assertion_make_file(const char *file, int line, failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } diff --git a/cat/test/test.h b/cat/test/test.h index 704a137..3a23a05 100644 --- a/cat/test/test.h +++ b/cat/test/test.h @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,8 +244,10 @@ int assertion_file_atime_recent(const char *, int, const char *); int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); @@ -326,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; diff --git a/cat/test/test_version.c b/cat/test/test_version.c index e7c9363..e587b34 100644 --- a/cat/test/test_version.c +++ b/cat/test/test_version.c @@ -83,7 +83,7 @@ DEFINE_TEST(test_version) if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; /* Skip arbitrary third-party version numbers. */ - while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { ++q; --s; } diff --git a/config.h.in b/config.h.in index f5bc56f..c117579 100644 --- a/config.h.in +++ b/config.h.in @@ -129,6 +129,9 @@ /* Define to 1 if you have the `acl_create_entry' function. */ #undef HAVE_ACL_CREATE_ENTRY +/* Define to 1 if you have the `acl_get_fd_np' function. */ +#undef HAVE_ACL_GET_FD_NP + /* Define to 1 if you have the `acl_get_link' function. */ #undef HAVE_ACL_GET_LINK @@ -784,6 +787,12 @@ /* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ #undef HAVE_STRUCT_TM___TM_GMTOFF +/* Define to 1 if the system has the type `struct vfsconf'. */ +#undef HAVE_STRUCT_VFSCONF + +/* Define to 1 if the system has the type `struct xvfsconf'. */ +#undef HAVE_STRUCT_XVFSCONF + /* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK diff --git a/configure b/configure index 892401d..a2b18f0 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libarchive 3.2.1. +# Generated by GNU Autoconf 2.69 for libarchive 3.2.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libarchive' PACKAGE_TARNAME='libarchive' -PACKAGE_VERSION='3.2.1' -PACKAGE_STRING='libarchive 3.2.1' +PACKAGE_VERSION='3.2.2' +PACKAGE_STRING='libarchive 3.2.2' PACKAGE_BUGREPORT='libarchive-discuss@googlegroups.com' PACKAGE_URL='' @@ -714,6 +714,9 @@ BSDCAT_VERSION_STRING BSDTAR_VERSION_STRING BSDCPIO_VERSION_STRING ARCHIVE_LIBTOOL_VERSION +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V @@ -783,6 +786,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules +enable_maintainer_mode enable_dependency_tracking enable_shared enable_static @@ -1366,7 +1370,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libarchive 3.2.1 to adapt to many kinds of systems. +\`configure' configures libarchive 3.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1436,7 +1440,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libarchive 3.2.1:";; + short | recursive ) echo "Configuration of libarchive 3.2.2:";; esac cat <<\_ACEOF @@ -1446,6 +1450,9 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") + --disable-maintainer-mode + disable make rules and dependencies not useful (and + sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -1592,7 +1599,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libarchive configure 3.2.1 +libarchive configure 3.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2431,7 +2438,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libarchive $as_me 3.2.1, which was +It was created by libarchive $as_me 3.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3300,7 +3307,7 @@ fi # Define the identity of the package. PACKAGE='libarchive' - VERSION='3.2.1' + VERSION='3.2.2' cat >>confdefs.h <<_ACEOF @@ -3393,6 +3400,29 @@ END fi fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -3437,7 +3467,7 @@ AM_BACKSLASH='\' # Libtool interface version bumps on any API change, so increments # whenever libarchive minor version does. -ARCHIVE_MINOR=$(( (3002001 / 1000) % 1000 )) +ARCHIVE_MINOR=$(( (3002002 / 1000) % 1000 )) # Libarchive 2.7 == libtool interface 9 = 2 + 7 # Libarchive 2.8 == libtool interface 10 = 2 + 8 # Libarchive 2.9 == libtool interface 11 = 2 + 8 @@ -3445,37 +3475,37 @@ ARCHIVE_MINOR=$(( (3002001 / 1000) % 1000 )) # Libarchive 3.1 == libtool interface 13 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` # Libarchive revision is bumped on any source change === libtool revision -ARCHIVE_REVISION=$(( 3002001 % 1000 )) +ARCHIVE_REVISION=$(( 3002002 % 1000 )) # Libarchive minor is bumped on any interface addition === libtool age ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR # Stick the version numbers into config.h -$as_echo "#define LIBARCHIVE_VERSION_STRING \"3.2.1\"" >>confdefs.h +$as_echo "#define LIBARCHIVE_VERSION_STRING \"3.2.2\"" >>confdefs.h cat >>confdefs.h <<_ACEOF -#define LIBARCHIVE_VERSION_NUMBER "3002001" +#define LIBARCHIVE_VERSION_NUMBER "3002002" _ACEOF -$as_echo "#define BSDCPIO_VERSION_STRING \"3.2.1\"" >>confdefs.h +$as_echo "#define BSDCPIO_VERSION_STRING \"3.2.2\"" >>confdefs.h -$as_echo "#define BSDTAR_VERSION_STRING \"3.2.1\"" >>confdefs.h +$as_echo "#define BSDTAR_VERSION_STRING \"3.2.2\"" >>confdefs.h -$as_echo "#define BSDCAT_VERSION_STRING \"3.2.1\"" >>confdefs.h +$as_echo "#define BSDCAT_VERSION_STRING \"3.2.2\"" >>confdefs.h # The shell variables here must be the same as the AC_SUBST() variables # below, but the shell variable names apparently cannot be the same as # the m4 macro names above. Why? Ask autoconf. -BSDCPIO_VERSION_STRING=3.2.1 -BSDTAR_VERSION_STRING=3.2.1 -BSDCAT_VERSION_STRING=3.2.1 -LIBARCHIVE_VERSION_STRING=3.2.1 -LIBARCHIVE_VERSION_NUMBER=3002001 +BSDCPIO_VERSION_STRING=3.2.2 +BSDTAR_VERSION_STRING=3.2.2 +BSDCAT_VERSION_STRING=3.2.2 +LIBARCHIVE_VERSION_STRING=3.2.2 +LIBARCHIVE_VERSION_NUMBER=3002002 # Substitute the above version numbers into the various files below. # Yes, I believe this is the fourth time we define what are essentially @@ -14733,6 +14763,9 @@ else /* end confdefs.h. */ #include + #if LZMA_VERSION < 50020000 + #error unsupported + #endif int main () { @@ -14741,12 +14774,13 @@ lzma_stream_encoder_mt(0, 0); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lzma_has_mt=yes else ac_cv_lzma_has_mt=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lzma_has_mt" >&5 $as_echo "$ac_cv_lzma_has_mt" >&6; } @@ -17245,6 +17279,39 @@ fi done +# DragonFly uses vfsconf, FreeBSD xvfsconf. +ac_fn_c_check_type "$LINENO" "struct vfsconf" "ac_cv_type_struct_vfsconf" "#if HAVE_SYS_TYPES_H + #include + #endif + #include + +" +if test "x$ac_cv_type_struct_vfsconf" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_VFSCONF 1 +_ACEOF + + +fi + + +ac_fn_c_check_type "$LINENO" "struct xvfsconf" "ac_cv_type_struct_xvfsconf" "#if HAVE_SYS_TYPES_H + #include + #endif + #include + +" +if test "x$ac_cv_type_struct_xvfsconf" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_XVFSCONF 1 +_ACEOF + + +fi + + # There are several variants of readdir_r around; we only # accept the POSIX-compliant version. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17555,7 +17622,19 @@ _ACEOF fi - for ac_func in acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file + for ac_func in acl_create_entry acl_get_fd_np +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + for ac_func in acl_init acl_set_fd acl_set_fd_np acl_set_file do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -19464,6 +19543,51 @@ fi done fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } +if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char EVP_CIPHER_CTX_init (); +int +main () +{ +return EVP_CIPHER_CTX_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +else + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +fi + fi # Probe libmd AFTER OpenSSL/libcrypto. @@ -20085,6 +20209,10 @@ else am__EXEEXT_FALSE= fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${INC_WINDOWS_FILES_TRUE}" && test -z "${INC_WINDOWS_FILES_FALSE}"; then as_fn_error $? "conditional \"INC_WINDOWS_FILES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20522,7 +20650,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libarchive $as_me 3.2.1, which was +This file was extended by libarchive $as_me 3.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20588,7 +20716,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libarchive config.status 3.2.1 +libarchive config.status 3.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index e15ceee..008b04d 100644 --- a/configure.ac +++ b/configure.ac @@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.2.1]) -m4_define([LIBARCHIVE_VERSION_N],[3002001]) +m4_define([LIBARCHIVE_VERSION_S],[3.2.2]) +m4_define([LIBARCHIVE_VERSION_N],[3002002]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) @@ -27,6 +27,7 @@ AC_CONFIG_AUX_DIR([build/autoconf]) AC_CONFIG_MACRO_DIR([build/autoconf]) # Must follow AC_CONFIG macros above... AM_INIT_AUTOMAKE() +AM_MAINTAINER_MODE([enable]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Libtool's "interface version" can be computed from the libarchive version. @@ -373,8 +374,11 @@ if test "x$with_lzma" != "xno"; then AC_CACHE_CHECK( [whether we have multithread support in lzma], ac_cv_lzma_has_mt, - [AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[#include ]], + [AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ] + [#if LZMA_VERSION < 50020000] + [#error unsupported] + [#endif]], [[lzma_stream_encoder_mt(0, 0);]])], [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) if test "x$ac_cv_lzma_has_mt" != xno; then @@ -612,6 +616,21 @@ AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) # detects cygwin-1.7, as opposed to older versions AC_CHECK_FUNCS([cygwin_conv_path]) +# DragonFly uses vfsconf, FreeBSD xvfsconf. +AC_CHECK_TYPES(struct vfsconf,,, + [#if HAVE_SYS_TYPES_H + #include + #endif + #include + ]) + +AC_CHECK_TYPES(struct xvfsconf,,, + [#if HAVE_SYS_TYPES_H + #include + #endif + #include + ]) + # There are several variants of readdir_r around; we only # accept the POSIX-compliant version. AC_COMPILE_IFELSE( @@ -676,7 +695,8 @@ if test "x$enable_acl" != "xno"; then AC_CHECK_HEADERS([acl/libacl.h]) AC_CHECK_HEADERS([sys/acl.h]) AC_CHECK_LIB([acl],[acl_get_file]) - AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file]) + AC_CHECK_FUNCS([acl_create_entry acl_get_fd_np]) + AC_CHECK_FUNCS([acl_init acl_set_fd acl_set_fd_np acl_set_file]) AC_CHECK_TYPES(acl_permset_t,,, [#if HAVE_SYS_TYPES_H @@ -845,6 +865,7 @@ if test "x$with_openssl" != "xno"; then else AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) fi + AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init) fi # Probe libmd AFTER OpenSSL/libcrypto. diff --git a/cpio/cmdline.c b/cpio/cmdline.c index 7e59536..0c10b2c 100644 --- a/cpio/cmdline.c +++ b/cpio/cmdline.c @@ -63,6 +63,7 @@ static const struct option { } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, { "create", 0, 'o' }, + { "dereference", 0, 'L' }, { "dot", 0, 'V' }, { "extract", 0, 'i' }, { "file", 1, 'F' }, diff --git a/cpio/cpio.c b/cpio/cpio.c index 4b69893..c11ac16 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -498,7 +498,7 @@ long_help(void) static void version(void) { - fprintf(stdout,"bsdcpio %s -- %s\n", + fprintf(stdout,"bsdcpio %s - %s\n", BSDCPIO_VERSION_STRING, archive_version_details()); exit(0); diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index e3063ee..8ffb542 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -91,7 +91,8 @@ IF(ENABLE_CPIO AND ENABLE_TEST) # Experimental new test handling ADD_CUSTOM_TARGET(run_bsdcpio_test COMMAND bsdcpio_test -p $ - -r ${CMAKE_CURRENT_SOURCE_DIR}) + -r ${CMAKE_CURRENT_SOURCE_DIR} + -vv) ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) ENDIF(ENABLE_CPIO AND ENABLE_TEST) diff --git a/cpio/test/main.c b/cpio/test/main.c index 1c9ae6e..6e6b5ab 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -130,6 +130,13 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1157,6 +1164,35 @@ assertion_file_contains_lines_any_order(const char *file, int line, return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1294,6 +1330,11 @@ assertion_file_time(const char *file, int line, switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1361,6 +1402,33 @@ assertion_file_birthtime_recent(const char *file, int line, return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1400,7 +1468,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1579,8 +1647,12 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode) if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1629,6 +1701,12 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + close(fd); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1641,10 +1719,12 @@ assertion_make_file(const char *file, int line, failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } diff --git a/cpio/test/test.h b/cpio/test/test.h index 606b121..49fa32c 100644 --- a/cpio/test/test.h +++ b/cpio/test/test.h @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,8 +244,10 @@ int assertion_file_atime_recent(const char *, int, const char *); int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); @@ -326,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; diff --git a/cpio/test/test_option_version.c b/cpio/test/test_option_version.c index 2f2c409..ac58cef 100644 --- a/cpio/test/test_option_version.c +++ b/cpio/test/test_option_version.c @@ -59,8 +59,8 @@ verify(const char *p, size_t s) ++q; --s; /* Separator. */ failure("Version: %s", p); - assertEqualMem(q, "-- ", 3); - q += 3; s -= 3; + assertEqualMem(q, "- ", 2); + q += 2; s -= 2; /* libarchive name and version number */ assert(s > 11); failure("Version: %s", p); @@ -75,7 +75,7 @@ verify(const char *p, size_t s) if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; /* Skip arbitrary third-party version numbers. */ - while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { ++q; --s; } diff --git a/doc/html/archive_entry.3.html b/doc/html/archive_entry.3.html index 2c1de49..1642f29 100644 --- a/doc/html/archive_entry.3.html +++ b/doc/html/archive_entry.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_acl.3.html b/doc/html/archive_entry_acl.3.html index f4068d3..be4b52a 100644 --- a/doc/html/archive_entry_acl.3.html +++ b/doc/html/archive_entry_acl.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_linkify.3.html b/doc/html/archive_entry_linkify.3.html index 2e7af8b..b5301c4 100644 --- a/doc/html/archive_entry_linkify.3.html +++ b/doc/html/archive_entry_linkify.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_paths.3.html b/doc/html/archive_entry_paths.3.html index 4e7d559..0ca2adf 100644 --- a/doc/html/archive_entry_paths.3.html +++ b/doc/html/archive_entry_paths.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_perms.3.html b/doc/html/archive_entry_perms.3.html index a20c6c8..af085b5 100644 --- a/doc/html/archive_entry_perms.3.html +++ b/doc/html/archive_entry_perms.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_stat.3.html b/doc/html/archive_entry_stat.3.html index be32b92..73c4675 100644 --- a/doc/html/archive_entry_stat.3.html +++ b/doc/html/archive_entry_stat.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_entry_time.3.html b/doc/html/archive_entry_time.3.html index a385f50..dc38f14 100644 --- a/doc/html/archive_entry_time.3.html +++ b/doc/html/archive_entry_time.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read.3.html b/doc/html/archive_read.3.html index 2f1a80e..7467b0f 100644 --- a/doc/html/archive_read.3.html +++ b/doc/html/archive_read.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_add_passphrase.3.html b/doc/html/archive_read_add_passphrase.3.html index 7d32eea..e51d21c 100644 --- a/doc/html/archive_read_add_passphrase.3.html +++ b/doc/html/archive_read_add_passphrase.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_data.3.html b/doc/html/archive_read_data.3.html index 4ca22ad..c7b89b8 100644 --- a/doc/html/archive_read_data.3.html +++ b/doc/html/archive_read_data.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_disk.3.html b/doc/html/archive_read_disk.3.html index c2a782a..401246a 100644 --- a/doc/html/archive_read_disk.3.html +++ b/doc/html/archive_read_disk.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_extract.3.html b/doc/html/archive_read_extract.3.html index 5928645..c3d57fe 100644 --- a/doc/html/archive_read_extract.3.html +++ b/doc/html/archive_read_extract.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_filter.3.html b/doc/html/archive_read_filter.3.html index 2e14347..e8dae11 100644 --- a/doc/html/archive_read_filter.3.html +++ b/doc/html/archive_read_filter.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_format.3.html b/doc/html/archive_read_format.3.html index 548eed9..cfd7b8b 100644 --- a/doc/html/archive_read_format.3.html +++ b/doc/html/archive_read_format.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_free.3.html b/doc/html/archive_read_free.3.html index 49a21ef..eefea70 100644 --- a/doc/html/archive_read_free.3.html +++ b/doc/html/archive_read_free.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_header.3.html b/doc/html/archive_read_header.3.html index 7c16ef9..6540e09 100644 --- a/doc/html/archive_read_header.3.html +++ b/doc/html/archive_read_header.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_new.3.html b/doc/html/archive_read_new.3.html index d415322..ead6e27 100644 --- a/doc/html/archive_read_new.3.html +++ b/doc/html/archive_read_new.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_open.3.html b/doc/html/archive_read_open.3.html index 41097e8..b1b265e 100644 --- a/doc/html/archive_read_open.3.html +++ b/doc/html/archive_read_open.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_read_set_options.3.html b/doc/html/archive_read_set_options.3.html index 8e7f182..6d66c03 100644 --- a/doc/html/archive_read_set_options.3.html +++ b/doc/html/archive_read_set_options.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_util.3.html b/doc/html/archive_util.3.html index ab0c3f0..3e5ce1c 100644 --- a/doc/html/archive_util.3.html +++ b/doc/html/archive_util.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write.3.html b/doc/html/archive_write.3.html index 44c8e42..2ce047d 100644 --- a/doc/html/archive_write.3.html +++ b/doc/html/archive_write.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_blocksize.3.html b/doc/html/archive_write_blocksize.3.html index 2ddd3a5..2f6d54f 100644 --- a/doc/html/archive_write_blocksize.3.html +++ b/doc/html/archive_write_blocksize.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_data.3.html b/doc/html/archive_write_data.3.html index a4542eb..c79a23b 100644 --- a/doc/html/archive_write_data.3.html +++ b/doc/html/archive_write_data.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_disk.3.html b/doc/html/archive_write_disk.3.html index 0e976b4..836447f 100644 --- a/doc/html/archive_write_disk.3.html +++ b/doc/html/archive_write_disk.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_filter.3.html b/doc/html/archive_write_filter.3.html index c66133a..19d60d5 100644 --- a/doc/html/archive_write_filter.3.html +++ b/doc/html/archive_write_filter.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_finish_entry.3.html b/doc/html/archive_write_finish_entry.3.html index bf63015..9a6256a 100644 --- a/doc/html/archive_write_finish_entry.3.html +++ b/doc/html/archive_write_finish_entry.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_format.3.html b/doc/html/archive_write_format.3.html index 09d6147..e96b3ab 100644 --- a/doc/html/archive_write_format.3.html +++ b/doc/html/archive_write_format.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_free.3.html b/doc/html/archive_write_free.3.html index b65a085..81c4abd 100644 --- a/doc/html/archive_write_free.3.html +++ b/doc/html/archive_write_free.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_header.3.html b/doc/html/archive_write_header.3.html index 404075a..9c63f1c 100644 --- a/doc/html/archive_write_header.3.html +++ b/doc/html/archive_write_header.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_new.3.html b/doc/html/archive_write_new.3.html index 1cd3e06..268c256 100644 --- a/doc/html/archive_write_new.3.html +++ b/doc/html/archive_write_new.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_open.3.html b/doc/html/archive_write_open.3.html index 5c69284..1db700d 100644 --- a/doc/html/archive_write_open.3.html +++ b/doc/html/archive_write_open.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_set_options.3.html b/doc/html/archive_write_set_options.3.html index 50e1731..f984e80 100644 --- a/doc/html/archive_write_set_options.3.html +++ b/doc/html/archive_write_set_options.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/archive_write_set_passphrase.3.html b/doc/html/archive_write_set_passphrase.3.html index 94e90b3..6f1a8d3 100644 --- a/doc/html/archive_write_set_passphrase.3.html +++ b/doc/html/archive_write_set_passphrase.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/bsdcpio.1.html b/doc/html/bsdcpio.1.html index 31c9378..4a7f247 100644 --- a/doc/html/bsdcpio.1.html +++ b/doc/html/bsdcpio.1.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/bsdtar.1.html b/doc/html/bsdtar.1.html index 92e798a..758409a 100644 --- a/doc/html/bsdtar.1.html +++ b/doc/html/bsdtar.1.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/cpio.5.html b/doc/html/cpio.5.html index a532116..b8aeb2f 100644 --- a/doc/html/cpio.5.html +++ b/doc/html/cpio.5.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/libarchive-formats.5.html b/doc/html/libarchive-formats.5.html index 2298d6b..5d4ba28 100644 --- a/doc/html/libarchive-formats.5.html +++ b/doc/html/libarchive-formats.5.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/libarchive.3.html b/doc/html/libarchive.3.html index a128625..c208b77 100644 --- a/doc/html/libarchive.3.html +++ b/doc/html/libarchive.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/libarchive_changes.3.html b/doc/html/libarchive_changes.3.html index 76b6232..c3b0225 100644 --- a/doc/html/libarchive_changes.3.html +++ b/doc/html/libarchive_changes.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/libarchive_internals.3.html b/doc/html/libarchive_internals.3.html index 4b9aa52..93f6d21 100644 --- a/doc/html/libarchive_internals.3.html +++ b/doc/html/libarchive_internals.3.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/mtree.5.html b/doc/html/mtree.5.html index 5f37ee9..4b004c3 100644 --- a/doc/html/mtree.5.html +++ b/doc/html/mtree.5.html @@ -1,5 +1,5 @@ - + diff --git a/doc/html/tar.5.html b/doc/html/tar.5.html index c30306d..2191caa 100644 --- a/doc/html/tar.5.html +++ b/doc/html/tar.5.html @@ -1,5 +1,5 @@ - + diff --git a/doc/pdf/archive_entry.3.pdf b/doc/pdf/archive_entry.3.pdf index a347a717aeee256f35be32feec60d95df3ea1fb2..8e99cdb276f23e001b1027a5bdae03ec6a09ce0d 100644 GIT binary patch delta 269 zcmdmLvDIS3I}zTLB-4~+3ln4A6vHI*$rDB8CrgQDVTgwF85-ys8HX4dSQ%Sb85vCe zCaQ}rWGL2*rthFw9Gb{PQHjYe;wl)T@|&lK?_kt1G%zwYGBCCCd+{M()%+b`y#MQ*b(!|l( N#LkA0ipf$k(g4E9M}qUkU}|J! OZfR#jNX29+8EF9jI7avY diff --git a/doc/pdf/archive_entry_acl.3.pdf b/doc/pdf/archive_entry_acl.3.pdf index 39e81a7862de2d77467980b963998ad2f521c04f..5d28633ef26b94d54ce9c67021db4adcad2c04b0 100644 GIT binary patch delta 254 zcmX@(cE)YPR%zapB-4~+3ln4A6vHI*$u@HGlOIZFVG%8tvEVZ_&^0m+F*2|+wy-iX zn7mg;7hULwOfwd}%Vq5`L?tG3%c-D>ZnlxT&d6nGU}S7$U~B=jKvqEliM!ceVFQzs sfw`%%fq|imlcj-~tC6Xrxtp`2tBHxRp}CWzfwPgDoed!slMR)n0j`)r+5i9m delta 254 zcmX@(cE)YPR%za3OXDQtR5J@*v(&`Y$u@HGlOIZFVG%8tvEVZ>(>1gVF|@QYHMTOf zoV-^?7hULwOfwd}%Vq5`L?tG3%c-D>ZnlxT&d6n8W@u?>X=)6#KvqEliM!ceVFQzs so0FrlsiT>Nxv`P4v$3<2tD&KVnW3?(v8jQnk&(Hjoed!slMR)n0sMSJGXMYp diff --git a/doc/pdf/archive_entry_linkify.3.pdf b/doc/pdf/archive_entry_linkify.3.pdf index d950391780ed2fe016433341e92068e2b19d2698..b57bb868049e839c52df1a11cfcf46f4c2220977 100644 GIT binary patch delta 296 zcmaFp_|S2~EJ@y!B-4~+3ln4A6vHI*$%-=alaEPeVG)gyvfwi`&^0m+F*2|+wy-iX zn7l|z7hUMCR5KR6J<|3Vq7suoNUNZVZdR1J&ZuK(U}S7$U~FMzple{RZeXCU$))d` zpW>2OlB(eXwARoJp<=U&Tmn<9fw`%%fq|imlcj-~tC6Xrxtp`2tBHxRp}CWzfwPgD ioee=1v0Qd`T*W1cMI{wQscBs1=4K{bs;aL3Zd?FH?@dww delta 296 zcmaFp_|S2~EJ@yEOXDQtR5J@*v(&`Y$%-=alaEPeVG)gyvfwi?(>1gVF|@QYHMTOf zoV-X%7hUMCR5KR6J<|3Vq7suoNUNZVZdR1J&ZuKxW@u?>X=-e0scT@aZeXCU$))d` zpW>2OlB(fiWn^GzhETCtMJ|CU*3HS$*woR?!ra)%*xA_G$<@%%!pzXv)!5X))X2!( j($0pUidZf?JFeoA#G;alqSQ1lb8|BjE>%@me>W}wrYudX diff --git a/doc/pdf/archive_entry_paths.3.pdf b/doc/pdf/archive_entry_paths.3.pdf index fcab5e75e2585883548a1196391f339e217acc40..f97a0036fca2be4f42e43796c8e4d20cbdafd3f3 100644 GIT binary patch delta 269 zcmdmDxy5pWtSE0vl4(k^g^96lieZxZH8oShbD4BRAO?mxC(}-{N}^rI~a8g4UCM942&&|40H|5)eQ{PHM#VC z^HW?BOHwslfYutCAyjN$F1dlp$-vyy*ucQh#mUmZ%+<)$(cI11(bdGn*wEa`(ZJcr N&CZ69ipeu&qyc&%N2CA% delta 269 zcmdmDxy5pWtSE1?rE!vRs+onZS!!bHH8oShbD4BRAO?mxC(}-{N}^rI~a8g%nU6JElrJ0Ep-jd)eQ{PHM#VC z^HW?BOHwsltc(l{%@8U!FPGfF}qUkU}|J! OZfR#jNX6utGSUFiUq}4_ diff --git a/doc/pdf/archive_entry_perms.3.pdf b/doc/pdf/archive_entry_perms.3.pdf index 2b10ae2d0d5834b8364992cc77bbd506716acc36..2b3832ba92e8849a3065ec8a465422efd8b5fd6a 100644 GIT binary patch delta 282 zcmccScFk?Werev6B-4~+3ln4A6vHI*$$w=fCdbLKPkt?(g+r!M#)8+-K-b7P#K^$P z*uu(a@-Z1bG!aJG796@a%GzVd*kFiAY>t!L&!}x^U}S7$U~FMzple{RZeXCU$))d` zpW>2OlB(fiWn^Gz23N7!Lt!J6lYzOZv4Mf1i<6~+nX8ehqq&>2qpOLDv7xz>qk*%L No1G0I6_c%%r2$o{P0auR delta 282 zcmccScFk?Wereuh%M{}jlT-^`v(&`Y$$w=fCdbLKPkt?(g+r!M#)8+tOxMsd#L&{p z)WphQ@-Z1bG!aJG796@a%GzVd*kFiAY>t!L&!}x+W@u?>X=-9%ple{RZeXCU$))d` zpW>2OlB(fiWn^Gz23N7!Lt!J6lZ%<5tA(qxrKyp#k(;xNi@Bw%g|U&Fk&~;Dv!j!l NiJc806_c%%r2%c#Pv-yt diff --git a/doc/pdf/archive_entry_stat.3.pdf b/doc/pdf/archive_entry_stat.3.pdf index 631891141d557a8fe4fb9c4f26b8c9411a66d27e..b4c0a6af2fe0a2921afaca97a2ac5d6c9bfff502 100644 GIT binary patch delta 250 zcmZ4Gzsi3@yF717l4(k^g^96lieZxZWIiSN$(!Y~u!wppSnwJe=o%S^7#Ua@TUZ%Q z?o-f16FI5Sf<PNqf%#wJFl7G|zymUcFT KR7|cEmj(bJIZ4$3 diff --git a/doc/pdf/archive_read.3.pdf b/doc/pdf/archive_read.3.pdf index 002f7a12013def014135c46df7075bdc4dcda53e..c677ac1851feb2d034f7868d33980c7b090b84d5 100644 GIT binary patch delta 285 zcmbOgFe_j~z5;JbQkt1*YO=9zieZxZp)y3J|(aqS< Oz|78ukc!Fw)ujOqqfO-i delta 285 zcmbOgFe_j~z5;KuWr}f%NvegeS!!bHF6cTAG>|80Z?9s~Z@oYjWxP z=BKzMmZWO9SQ!}@njutd{;6_=$;r&X)Wq1xz|qpg(#*)%(%8by#ni;a$l1)*+1%XJ Oz{Jjmkc!Fw)ujOv%1s0S diff --git a/doc/pdf/archive_read_add_passphrase.3.pdf b/doc/pdf/archive_read_add_passphrase.3.pdf index 7015dc0daad140b5259d1df9d1939000b2c89983..7e1229da217793d2c7f0003aaf7eb0d91f75bad3 100644 GIT binary patch delta 269 zcmaE*^h#;NY%boEq%TG7_W@zqeY~F6cTAG>|80Z?9s~Z@oYjWxP z=BKzMmZWO9SQ!}@njutdR^@-e=wxhS=;rL|Xz5~X?BwhMqz#RnOpOeTO^i$}%v{YZ N?Q96CnCveo4FEjyN3j3^ diff --git a/doc/pdf/archive_read_data.3.pdf b/doc/pdf/archive_read_data.3.pdf index 8c4343c75f2bb47815b25921981e603c4528ec00..06d926c455a79df8a63824359b5827da99dadfa2 100644 GIT binary patch delta 292 zcmZoLZ7|*7E6kgclxAj{nry6_Vwhw;`Gc_hIMetnq2z6 z`6(`mC8-)NRz?PfW(XCVuZ#OI#hM$t8oOFLIk^}aSz4GnyEwbKn7UZHx;UFVx)~c9 knAzD7R1wQ%XUA1sl2}wyQIwj-WoBq<$fc_4>hHz{0F>xYjQ{`u delta 292 zcmZoLZ7|*7E6kg0nPQw`l4_xAmYSG4`Gc_hrAmZl~K2D%33>IMetnq2z6 z`6(`mC8-)NRz?PfW(XCVuZ#OI#hMwIniv}yI9i%mni&~e8e6!zn3|XvIh(mUo12>& knAq76R1wQ%XUA1sl2}wyQIwj-WoBq<$fc_4>hHz{0EBc-tN;K2 diff --git a/doc/pdf/archive_read_disk.3.pdf b/doc/pdf/archive_read_disk.3.pdf index d70ee334f4db9caf0264a9f4e8183171c266acb8..590d5ce1d9f393877704d7be858de960e4f4f4ae 100644 GIT binary patch delta 269 zcmcZ`cQuR3o^Qkt1*YO=9zieZxZ|}22YV2z1f&tf=w@ta OU}k4SNX2AFeHj2*K1)pi delta 269 zcmcZ`cQuR3qCWr}f%NvegeS!!bHF6cTAG>|80Z?9s~Z@oYjWxP z=BKzMmZWO9SQ!}@njutdzOJpo?Brr*=xX8WY-wubY~<$b;$m*;YGG{TX5{2*`0U18poq%8HG zDK3d6sTwX;Mh1pva21==Bubea&5d1+T`irQT#Sq?ElizVoZVbZT`XN)oXs8Gj13LU N>}&|Am@FeL0|4`LM$rHO delta 265 zcmdmCw!>`0U18qjM6+bGBr^+Lv(&`Y$qgd%lQ~7QFhs+74a{^6Ekg_~txQd<3?@Gj z(L)oF7i~e)wLvrvO{76YVzRNA3Wlis=4P=SjM@ffhL(nwrX~i4x(4Rz1_tVyT>8HG zDK3d6sTwX;Mh1pva21==BubeaO^r+p3=B=2jh)?G+$}&|Am@FeL0|4~uMjHSC diff --git a/doc/pdf/archive_read_filter.3.pdf b/doc/pdf/archive_read_filter.3.pdf index cfa15303be48ff1f9d0f5ec800fc161c7af2dbcc..4c688d110db31eb3c6da6e814a0651917f2c7afe 100644 GIT binary patch delta 289 zcmZ2rxWI5jt{`tpQkt1*YO=9zieZxZWC0=h$ukABFhs+74GnaSj6;kJtc)$Jj3$=| z>7j|N7ivM%8HG zDK3d6sTwX;Mh1pva21=siTX0d8ag=}8akUgo0+*8n!6esxw^TTJDD1~S(=-;8Jn9} j*x3+N5zA#~$5mXCSX5F`l$yq6YG!W8rK;-c@5TiHHbhG# delta 289 zcmZ2rxWI5jt{`u6qFJ(8l9`3BS!!bHWC0=h$ukABFhs+74a{^6Ekg_~txQd<3?`Qd z>7j|N7ivM%8HG zDK3d6sTwX;Mh1pva21=siTX0dni`s08XB3ISh~5n8ksvhSBa@?( rxru?Jg|n%XnUk5RiKUsjrGce^skw=hxw)Z%vw@+V4FMIC735_AwR1ue delta 249 zcmdmEx5sY7QgPnoM6+bGBr^+Lv(&`Y$vRT1gVF|@QYHL)_7 zyhcI~P2{;m3l^QzCG9apB_{utR6!NptRr=uk<-A;(9+P-)Wl#ikBlUOw^>hSBa@?} rxv7PlsjH=>rK!28laslNrJISRqpPElv89QTn~|ZN4FMIC735_A@iIde diff --git a/doc/pdf/archive_read_free.3.pdf b/doc/pdf/archive_read_free.3.pdf index cc9276ed94a63874deb722b23a60e2da7b37a357..decf21db836e733437b718d6ce9a572b51e774ac 100644 GIT binary patch delta 301 zcmaE;{!o2`5HD{^Qkt1*YO=9zieZxZ0p^=%1rJI|pk-4LVlZlg~iJ5_^fs=)Sxr>vL ioee=1v0Qd`T*W1cMI{wQscBp$rlw|Gs;aL3Zd?F`3s7MI diff --git a/doc/pdf/archive_read_header.3.pdf b/doc/pdf/archive_read_header.3.pdf index 4581a74a94e7c75cf985515d499ea16ecb4e6e42..f61f24b4f1b98c98fb7c632da92c852e31bf291c 100644 GIT binary patch delta 249 zcmbQLHdSqd8xL6Y1b>!J^ZG&mKcmV)7h56;#p9XZfx(avB;K85jhJcF6KZRrfm%Bvo delta 249 zcmbQLHdSqd8xL=CqFJ(8l9`3BS!!bH6Y1b>!J^ZG&mKcmV)7h56;#p9XZfx(avGQ!S{hoKnix!8D#LdjW)zr++hJcF6KZRrflv+eN diff --git a/doc/pdf/archive_read_new.3.pdf b/doc/pdf/archive_read_new.3.pdf index d94331d184bc982f7ed7e830d2204c9eec1e55a8..c9b5f2f2de17fe6206802bb0ec8a1261285f4417 100644 GIT binary patch delta 304 zcmcbpa8Y4H6DMy}ieZxZ=qOh+7QMOLZWy9A7$RWXH*4_hVAL@*FfukWFt#u<(lszwH!x7wu0(9zk=(#gcw#mL;z j+0KTbidZf?JFeoA#G;alqSQ1lV>1&IE>%@me>W}wBCJpl delta 304 zcmcbpa8Y4H6DMzSqFJ(8l9`3BS!!bH=qOh+7QMOLZWy9A7$RWXH*4_hVAL@%Gqg0cG&M0W)HN_yH!x7wx%+$oq%)r&u j%+7|OidZf?JFeoA#G;alqSQ1lV>1&IE>%@me>W}w0fSKX diff --git a/doc/pdf/archive_read_open.3.pdf b/doc/pdf/archive_read_open.3.pdf index 544d5580a5d146ea9d936514fa3105d3ce5859cc..4c73225d734369beb7a9eee7d406f2f2ad3e910c 100644 GIT binary patch delta 282 zcmX@+am-`GdKuo7WQ)`^Qxjv|6vHI*$#3N(Ci}^=Prfaag+r!L)`Hj2K-b7P#K^$P z*uu(a@-|sLG?9<8EjV;9l(WZ>vB40L*z702pHbV;z{uFhz}UjbNY}tz-M~OylS|(> zKgA`nBvr%3%E-Xb46b6ch2lmgCktaoV^ecu7Xw3Q7e_}o69YqYS7TQfS4UT4Co?xk OOFJ7vDkf{INCN<908V58 delta 282 zcmX@+am-`GdKup2Bm+|e!&D1hv(&`Y$#3N(Ci}^=Prfaag+r!L)`Hi-OxMsd#L&{p z)WphQ@-|sLG?9<8EjV;9l(WZ>vB40L*z702pHbVu%+S)%($vJjNY}tz-M~OylS|(> zKgA`nBvr%3%E-Xb46b6ch2lmgCu0j2CsT80M-yi^HzzkUa|1^p-@wGx(8}ieZxZl@qMw7k8 z_0UAx#9OfFG?TE$5S5rbOF{)hRDSa-i5-lbh6YB)Mh35H pIGLI|JDNDVxjDI+nHx9)`35GghE7JNCZ>)?b~c1mOpcM21_052LOB2c diff --git a/doc/pdf/archive_util.3.pdf b/doc/pdf/archive_util.3.pdf index e7b0ce14c72088c2ac6f52e6ff7f86afc3918526..00780a067bd941724a1f2e900d4e9c15a7f9218c 100644 GIT binary patch delta 250 zcmaFu{@Q&*hzxH^vPEi|sfn>}ieZxZl@qMw6pu z_0UA7$+lq8=_Y57Au2I>m7EHOsQl(%ayu9~4GoNpjSP$}j3)0^kVNn{-&NSi|$W(?BeL?W@2Dy?rQAn;_B#X>}2NVXlZ9dNX6s}%F+P2&qQtj delta 250 zcmaFu{@Q&*hzxIXl7Xp#VXB3$S!!bHm7EHOsQl(%ayu9~4a^KJ4J}Pg3?}bZkVNn{-&NSiSkv{NX6s}%F+Op^h5yw diff --git a/doc/pdf/archive_write.3.pdf b/doc/pdf/archive_write.3.pdf index 45fec5af98f5fe2aa17213993f5bb188b4a53187..9c6e0b619e1c90ad4ef808a790b5cf85db0bd0b0 100644 GIT binary patch delta 305 zcmaD9@+f43y%KLqvPEi|sfn>}ieZxZ%xHZ?bPF)(y?addPuF)%cDHFkAzb#yg$GIMjZ jw6h_oB9_a}j;pvNv8be?C^e1C($d_VOI6j?-;E0ZC!JF2 delta 305 zcmaD9@+f43y%KM7l7Xp#VXB3$S!!bH1gVF|@QY zHL)_7?53=TCeo}ieZxZ}ieZxZga0hWaj2* NX=g)7#pH*A(g4&KN8|ti delta 265 zcmeyP{6~3%E;ny-l7Xp#VXB3$S!!bHSSi+j4IveiIUQvH1i?^I delta 284 zcmZ45#JIGHal=Ln-sB_$Qv<_P3th9+#MH^}tt2J~ShG*QYmtRRrr6Sg*T78I&@#l( z(#q7t%3$&iOFcA^&z3DXbT78D$B?nX5Rup%V7;GF+rZ4w($Lb>#K1_`z+BzHKwXnd z-#0(SC9xz`!^O(Tz|ah?VzZTPFSC=8xw)~4lZAJIHF9xsHgI${cXc#(GdDIgF?X`FA)sRNTrn8{_(eed delta 249 zcmdm~yHj^V8$WMyl4Xjeg_(t}S!!bHWL_cp$(#7Iu!wpHSnwK{=^9#w7+PAHnphc3 z?iJ8O6FDK!f<(_`CL8dvPu|O&g+nHo$AZ_;K-b7P#K^$P z*uu(a@(dn5G?B|ZEjV;H^V(y`*kFiAY&PKA&!}x^U}S7$U~FMztZQJdZeXCU$))d` zpW>2OlB(fiWn^Gz23N6JO5i19thuF&qno3liHotLg|n-Xi<7f~qqDiIqq&>8v7w2% jlbsDg6|r1)c3j0JiA5z9MX70ACWhvQT&k+B{%%|VNM=#w delta 305 zcmaE$@<3(7L~h>XB+C>_3o{E{v(&`Y$>(_`CL8dvPu|O&g+nHo$AZ_uOxMsd#L&{p z)WphQ@(dn5G?B|ZEjV;H^V(y`*kFiAY&PKA&!}x+W@u?>X=-9%tZQJdZeXCU$))d` zpW>2OlB(fiWn^Gz23N6JO5i19tg)%Nfw_^ng^R0+n~{;5p^LervyqX3tBJ9Nv#F7# jv7HS;6|r1)c3j0JiA5z9MX70ACWhvQT&k+B{%%|VfOJud diff --git a/doc/pdf/archive_write_format.3.pdf b/doc/pdf/archive_write_format.3.pdf index 541d41b907dc6a381de78635d4d26242a8b06456..0f505666088835a52a5028739ed51cc19e76afa4 100644 GIT binary patch delta 265 zcmbPgHPvcEohWZgijlcRQnImbieZxZWJNLg$*V-OFhs+74GnaSj6;kJtc)$Jj3&2= z>7j`n5Nkox6(}BuCZZ@NG5LzP3WlisW)+DYjM|08HG zDK3d6sTwX;Mh1pva21=`r8Y4+TDUp7Ia?T-nmaoiyO_I}8@d{s8oRlgxf&XoJ6f39 N*%%X0G5ME_GypW>MFRi; delta 265 zcmbPgHPvcEohWZ|l4Xjeg_(t}S!!bHWJNLg$*V-OFhs+74a{^6Ekg_~txQd<3?{dV z>7j`n5Nkox6(}BuCZZ@NG5LzP3WlisW)+DYjM@ffhL(nwrX~i)x(4Rz1_tVyT>8HG zDK3d6sTwX;Mh1pva21=`r8Y4+nwlG!8<|_UxSF^b8Mzs{m^(Tf85y{m7+W}-8d)0K N*%%X0G5ME_Gyr~NMFIc- diff --git a/doc/pdf/archive_write_free.3.pdf b/doc/pdf/archive_write_free.3.pdf index 23ba1d2ae70a74fe1fdc2db33841be471567b571..d3c4b87d5f6157fdd5c29820169979726cadc98c 100644 GIT binary patch delta 304 zcmaE__Fiqn0v_I!6eDwsq-0~=6vHI*$@lmqCfoC~Pd>wwg+nHZ*Mis3K-b7P#K^$P z*uu(a@^W51G?7QVEjV;f; zKgA`nBvr%3%E-Xb46b6crr;~a7z;N?H)jh&Q*&o$V;6H5b3<2SQ)4$*Ggm_+b4LqP jI~!v{Dq^|p?6`_c5{pVIic-_KOiWCSxKveL{oS|#=EYKc delta 304 zcmaE__Fiqn0v_JvB+C>_3o{E{v(&`Y$@lmqCfoC~Pd>wwg+nHZ*Mir;OxMsd#L&{p z)WphQ@^W51G?7QVEjV;f; zKgA`nBvr%3%E-Xb46b6crr;~a7*lftb0c#L7grNEBO^CM7js8vBO?P>6JrZ!QzJ`b jI~!v{Dq^|p?6`_c5{pVIic-_KOiWCSxKveL{oS|#GQ(1P diff --git a/doc/pdf/archive_write_header.3.pdf b/doc/pdf/archive_write_header.3.pdf index be135762c792826b40cff7b31b57f72ed8d92110..0fc7cf1ad08a5cb615735b52a2d59124878435f9 100644 GIT binary patch delta 289 zcmdn1yjOX{J1*Xo6eDwsq-0~=6vHI*$rHKdCrfc>VTgwF8XD*t8HX4dSQ%Sb8BPAm zt%oLJz|(@J>mW}Yn#e?MiODX!Dj1^jo2T&ZVAM7=FfukWFt#u<)-^C!H!x7w%@me>W}waDq(1 delta 289 zcmdn1yjOX{J1*YjB+C>_3o{E{v(&`Y$rHKdCrfc>VTgwF8kp%CT80=}TA7+y8BG4l zt%oLJz|(@J>mW}Yn#e?MiODX!Dj1^jo2T&ZVAM7+Gqg0cG&M0W)-^C!H!x7w%@me>W}w;51gVF|@QYHL)_7 zT*#$|CbEXB1&huYZhH(-iOC1JRZvAYf8@T-$Z23^XlZC^YGN??BCjNZxA`;gOGYPS sQ*#4zBXbKER}(iQBR4}Ab4O<*BLi0xV+&_fBTHjD8$v23%LzyW0L4N@00000 diff --git a/doc/pdf/archive_write_open.3.pdf b/doc/pdf/archive_write_open.3.pdf index 7e95664b03f34a8c99e8b65d17b1ac0ebc82f1a4..56a944923ce62f5db06fb336535fc44a1ba334dd 100644 GIT binary patch delta 278 zcmeBl?{webB*UAMVq|WSlx(bY<6W$hKh7sVnD(A!>sm0=9ee3%MPP+J**3#zqFl7DmRp2IlGp2I`tz`o8%o zE{P?n8ZK5w28L#E6`M~hBr-V}Tevy8Ia?T-nmaoiyO_I}8@d{s8oRlgxf&XoJ6f39 M*$`4OIZs&{03bL^SpWb4 delta 278 zcmeBl?{webB*UAWWSL@VVP>IgmYSG4xj{~1@?RPD$$2taSY_;a4a{^6Ekg_~txQd< z3?_TZ>Y<6W$hKh7sVnD(A!>sm0=9ee3%MPP+6HEZmWGz5CI-g32IlGp2I`tz`o8%o zE{P?n8ZK5w28L#E6`M~hBr-Xf7&|(dJDD3gSvWhpxS5)oIlH==I~f`p7`vER8k#xT M*$`4OIZs&{0EIzI>;M1& diff --git a/doc/pdf/archive_write_set_options.3.pdf b/doc/pdf/archive_write_set_options.3.pdf index 8befb4b464fad8063e1bd349f11f82184b2a7bc4..7efcccc5c16147c0ef2029a693b81dc355312ebd 100644 GIT binary patch delta 311 zcmdno&A7Rnal?BX-joz0bBm;8W8D@j4pxMFjk{eDIrLjxmYBLia#BV%0yb9Dm)bxkgP z-~1Gp#FA7E7b_zJLo@j4pxMFjk{eDIr12aQQLrYT=0~1{Xb9Dm)bxkgP z-~1Gp#FA7E7b_zJLoRyu!wqdTkshg=o%S^7#Ua@TUZ$x zPoBuFi!OAAyBUk#Y94zGQHja-c~nqEHw*AyXXG+8FfukWFtz|%@R3gfiMv^t{{^Fy sv4xwXo3n+XskyVWv5UEjxuL7Esj-`@nX93Zxub=toed!slWhg10b9pG`2YX_ delta 254 zcmcbibVF%FCl_yWvay*_YN~~Ryu!wqdTksi}=^9#w7+PAHnphc_ zOrFTCi!OAAyBUk#Y94zGQHja-c~nqEHw*AyXXG+4Gqg0cG&KQQ@R3gfiMv^t{{^Fy snSq;urJ;qRrLlpLg@uKSqlvM(i-C!yg_*OZsiA?Hoed!slWhg10R{C!U;qFB diff --git a/doc/pdf/bsdcpio.1.pdf b/doc/pdf/bsdcpio.1.pdf index a5ddd70bbf0078c30676ad900a08dc561e31661b..8054f8d8de92e081f82a985e88808a54478fa5d3 100644 GIT binary patch delta 282 zcmeCJ?5*73Xu_M4YHE>Wk!-A+Vwhw;x!z1-@&hyW$+;$3IAoYjEqDzLbd8Kdj0~)d zEv$?tdzk8>i8PzG;LvSsW{)9bgCQcZ`GMJfMr}g_BV!{2V+$iwT?2D<0|RwUE`8tp z6qm%3R1Fs^BLhP-xQflEEK-@B3>+<7O)U&eoGmSlEDT*74Gf(fP0WnV%nU6|%}p)c N>}&|Bm|SQh0{~*+O)>xg delta 282 zcmeCJ?5*73Xu_MEoSd3$YG$EpmYSG4x!z1-@&hyW$+;$3IAoYjEqD#gbPX*-3@xop zO{@$idzk8>i8PzG;LvSsW{)9bgCQcZ`GMJfMr{K#LrX(TQxgMIT?2D<0|RwUE`8tp z6qm%3R1Fs^BLhP-xQflEEK-@BoGmRZjEtR(+{_$ZoQ#}}jhqdPj9iQ?EL_b^4c&~5 N?Q96Cm|SQh0{{bRPm=%u diff --git a/doc/pdf/bsdtar.1.pdf b/doc/pdf/bsdtar.1.pdf index 42ab8273c150e39ac6a188b5ff9a03da5b8909a4..a65282cd0878ae17e87f514584c63630b5df0c49 100644 GIT binary patch delta 282 zcmcb9n(6v!rVW#4@us9C8yFdx80)4OCYevZI7ec#-)#2D`)6fgm9ghDG|)9N4ly#Y zGPbZXGMPMkwl2ERwb{*B^w!OB!w|K>5CPl1*>dgp%ot+#_4BZTz&72KPO)cDv&D|{A ROw25e?Q96Bn7nJLEC5+CR0aS5 delta 282 zcmcb9n(6v!rVW#4@g^rHrzV@4S?HRjCZFr7Smwl2ERwb{*B^w!OB!w|K>5CPl1*>dgaajEtR(+{_$ZoQ#}}jhqdPj9iQ?EL_b^ R4c&~5?Q96Bn7nJLECAtUS33Xz diff --git a/doc/pdf/cpio.5.pdf b/doc/pdf/cpio.5.pdf index e6f548ed00b487a6f9486f507d7b91f1c2e32f04..534c349dfa0ed220a63a31673aab44d940b5fbbf 100644 GIT binary patch delta 267 zcmdm%u`OeRpAK(IijlcRQnImbieZxZFS~jP1J2h)2FBxhbHn-M`H34JrxX5`ORPSb};G~8WFS~jP1J2h)2FBxhbHn-M`H34JrxX5`ORPSb};G~m>F6cTAG>|nCKdqs~Z@oYjWxP z=BKzMmZWO9SQ!}@njusyzG1-ZXlUYQYG~+Y=wxYW>SAnZb(7?#p$iUdbXtGX#B!aiuFCdWF t$<4&j#mU6P(Amk+#L&&a+05C%)YQVw*xb#+&BV;o*v^KKipdXyWdNX#MN9wy delta 252 zcmeynobm5+#tlckd6Sck&5Tl0Ep*LN6H_Pq_{mTH=$(Z{wB5&o*T78I&@#l((#q7t z%3$&tA3Zb?cHb5(I=B1UV~9#jmiALY72WLPcb$>bz|7Fn(9+bzV6sktB!aiuFCdWF t$;`mbz|zpd(bCw!$il+H#nHsr+{M7e(!$Ky($vtv%+7|8ipdXyWdIP2M+^V} diff --git a/doc/pdf/libarchive.3.pdf b/doc/pdf/libarchive.3.pdf index 5bc146427260edad6ba2517ba89bf0418424828a..756528af8031fff47de0c05468b3dc5cbe322293 100644 GIT binary patch delta 250 zcmbOkHZyF)RAt_jlw<=VBNJoY6vHI*$ues4lMgCqVG#{ivEVf{&^0m+F*2|+wy-jq zJV!+jP2{>t3l^R2s`eP75|dx6s-TK)mQlOT$Z2R`WNc($Y+*F{kGdp+w^>eOE|Zg! sxsj2Ji;J1gVF|@QYHL)_7 zJV!+jP2{>t3l^R2s`eP75|dx6s-TK)mQlOT$Z23^XlZC^YGN??kGdp+w^>eOE|Zg? siJPgRp_`$TrKPEhv89oVk-34Bi?fA`g|UT^p|Po*4Ivei|7ytq06JJiRR910 diff --git a/doc/pdf/libarchive_changes.3.pdf b/doc/pdf/libarchive_changes.3.pdf index 9fe90ec64068f477ffb5b0380faf9df9596b86aa..5ac2e48b8c8ec08cacee316f197c30e0ef832141 100644 GIT binary patch delta 250 zcmewr_bYA#n>uewO0t2Gk%_TxieZxZFiLEZj`YERF4K2&tGHr!NBlgsMW) delta 250 zcmewr_bYA#n>ufDvay*_YN~~RF-7MTp Q%q)%VYzU~BeBMbG08QXXC;$Ke delta 270 zcmaFU%J`<0al;)e-sI%u)MQgL3th9+#MH_4*7B1%tg|pg!}$!%bPX*-3@xopO{@$| zCqJ>)MHiB{X-3nx-X;!Bq~2O$vXQL{hN%4JCfgm1ItFHjmWGz5CI+Uu2IlGp2I`tz z`o8%oE{P?n8ZK5w28Lz`6`RxSHJBZpEiEjJjGc_!%p6^ujGT>)oDGbOT#PI%T+K}l Q-HeUxYzU~BeBMbG0K@=GT>t<8 diff --git a/doc/pdf/mtree.5.pdf b/doc/pdf/mtree.5.pdf index 4f2eb904d05e8cbd6566fb20cbae5220e1f752c7..fb38329b14fb947ea8db4343909cf5e9d9a5ac4e 100644 GIT binary patch delta 253 zcmbQ{Kh1xGx&m)XO0t2Gk%_TxieZxZ?>`sKn%2B^6ZB&Fhq|GjbUk7#SNG7+U}>=vR?I;%?rk(!u2D sW@6~#WMX3I?Br--=w{$-=4@bUYT;&V?q=a;VrFS1gVF|@QYHL)@< zovg2@i!PL<*o;N5q>?>`sKn%2B^6ZB&Fhq|GjbW28Cn`znwkJD=vR?I;%?rk(!u2D sY-wR(Wb9<*X6ESPWaMmY#K3fNLZ<{0cXLzc w9#%(ZOA8AlV<#gwGe;LEBWGhHX9FW67b6P`S94QCH)CTv8v-gO*Z0c;0Pd(vg8%>k diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c index 81e5e11..0b4b414 100644 --- a/examples/minitar/minitar.c +++ b/examples/minitar/minitar.c @@ -222,7 +222,6 @@ static void create(const char *filename, int compress, const char **argv) { struct archive *a; - struct archive *disk; struct archive_entry *entry; ssize_t len; int fd; @@ -253,12 +252,11 @@ create(const char *filename, int compress, const char **argv) filename = NULL; archive_write_open_filename(a, filename); - disk = archive_read_disk_new(); -#ifndef NO_LOOKUP - archive_read_disk_set_standard_lookup(disk); -#endif while (*argv != NULL) { struct archive *disk = archive_read_disk_new(); +#ifndef NO_LOOKUP + archive_read_disk_set_standard_lookup(disk); +#endif int r; r = archive_read_disk_open(disk, *argv); diff --git a/libarchive/archive.h b/libarchive/archive.h index 1794dd3..ff401e9 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.2.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); diff --git a/libarchive/archive_acl.c b/libarchive/archive_acl.c index bf4b610..d128920 100644 --- a/libarchive/archive_acl.c +++ b/libarchive/archive_acl.c @@ -707,10 +707,11 @@ archive_acl_text_l(struct archive_acl *acl, int flags, if (r != 0) return (-1); *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { id = ap->id; - else + } else { id = -1; + } append_entry(&p, NULL, ap->tag, name, ap->permset, id); count++; diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index dab2c9d..71b1e87 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/libarchive/archive_match.c b/libarchive/archive_match.c index 4c41bad..0719cbd 100644 --- a/libarchive/archive_match.c +++ b/libarchive/archive_match.c @@ -655,7 +655,7 @@ add_pattern_from_file(struct archive_match *a, struct match_list *mlist, } } - /* If something error happend, report it immediately. */ + /* If an error occurred, report it immediately. */ if (r < ARCHIVE_OK) { archive_copy_error(&(a->archive), ar); archive_read_free(ar); diff --git a/libarchive/archive_platform.h b/libarchive/archive_platform.h index b06c3cd..e44c932 100644 --- a/libarchive/archive_platform.h +++ b/libarchive/archive_platform.h @@ -159,6 +159,15 @@ #define CAN_RESTORE_METADATA_FD #endif +/* + * glibc 2.24 deprecates readdir_r + */ +#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) +#define USE_READDIR_R 1 +#else +#undef USE_READDIR_R +#endif + /* Set up defaults for internal error codes. */ #ifndef ARCHIVE_ERRNO_FILE_FORMAT #if HAVE_EFTYPE diff --git a/libarchive/archive_ppmd7_private.h b/libarchive/archive_ppmd7_private.h index 3a6b9eb..06c99e8 100644 --- a/libarchive/archive_ppmd7_private.h +++ b/libarchive/archive_ppmd7_private.h @@ -19,7 +19,7 @@ If you need the compatibility with original PPMd var.H, you can use external Ran #define PPMD7_MAX_ORDER 64 #define PPMD7_MIN_MEM_SIZE (1 << 11) -#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) +#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3) struct CPpmd7_Context_; diff --git a/libarchive/archive_read_add_passphrase.c b/libarchive/archive_read_add_passphrase.c index f67f1eb..cf821b5 100644 --- a/libarchive/archive_read_add_passphrase.c +++ b/libarchive/archive_read_add_passphrase.c @@ -125,7 +125,7 @@ void __archive_read_reset_passphrase(struct archive_read *a) { - a->passphrases.candiate = -1; + a->passphrases.candidate = -1; } /* @@ -137,31 +137,31 @@ __archive_read_next_passphrase(struct archive_read *a) struct archive_read_passphrase *p; const char *passphrase; - if (a->passphrases.candiate < 0) { + if (a->passphrases.candidate < 0) { /* Count out how many passphrases we have. */ int cnt = 0; for (p = a->passphrases.first; p != NULL; p = p->next) cnt++; - a->passphrases.candiate = cnt; + a->passphrases.candidate = cnt; p = a->passphrases.first; - } else if (a->passphrases.candiate > 1) { + } else if (a->passphrases.candidate > 1) { /* Rotate a passphrase list. */ - a->passphrases.candiate--; + a->passphrases.candidate--; p = remove_passphrases_from_head(a); add_passphrase_to_tail(a, p); - /* Pick a new passphrase candiate up. */ + /* Pick a new passphrase candidate up. */ p = a->passphrases.first; - } else if (a->passphrases.candiate == 1) { - /* This case is that all cadiates failed to decryption. */ - a->passphrases.candiate = 0; + } else if (a->passphrases.candidate == 1) { + /* This case is that all candidates failed to decrypt. */ + a->passphrases.candidate = 0; if (a->passphrases.first->next != NULL) { /* Rotate a passphrase list. */ p = remove_passphrases_from_head(a); add_passphrase_to_tail(a, p); } p = NULL; - } else /* There is no passphrase candaite. */ + } else /* There is no passphrase candidate. */ p = NULL; if (p != NULL) @@ -177,7 +177,7 @@ __archive_read_next_passphrase(struct archive_read *a) if (p == NULL) return (NULL); insert_passphrase_to_head(a, p); - a->passphrases.candiate = 1; + a->passphrases.candidate = 1; } } else passphrase = NULL; diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index 74fe353..4c7f048 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -411,20 +411,38 @@ setup_acls(struct archive_read_disk *a, { const char *accpath; acl_t acl; -#if HAVE_ACL_IS_TRIVIAL_NP int r; -#endif accpath = archive_entry_sourcepath(entry); if (accpath == NULL) accpath = archive_entry_pathname(entry); + if (*fd < 0 && a->tree != NULL) { + if (a->follow_symlinks || + archive_entry_filetype(entry) != AE_IFLNK) + *fd = a->open_on_current_dir(a->tree, + accpath, O_RDONLY | O_NONBLOCK); + if (*fd < 0) { + if (a->tree_enter_working_dir(a->tree) != 0) { + archive_set_error(&a->archive, errno, + "Couldn't access %s", accpath); + return (ARCHIVE_FAILED); + } + } + } + archive_entry_acl_clear(entry); + acl = NULL; + #ifdef ACL_TYPE_NFS4 /* Try NFS4 ACL first. */ if (*fd >= 0) +#if HAVE_ACL_GET_FD_NP + acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4); +#else acl = acl_get_fd(*fd); +#endif #if HAVE_ACL_GET_LINK_NP else if (!a->follow_symlinks) acl = acl_get_link_np(accpath, ACL_TYPE_NFS4); @@ -437,20 +455,31 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_NFS4); + #if HAVE_ACL_IS_TRIVIAL_NP - /* Ignore "trivial" ACLs that just mirror the file mode. */ - acl_is_trivial_np(acl, &r); - if (r) { - acl_free(acl); - acl = NULL; + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (r) { + acl_free(acl); + acl = NULL; + /* + * Simultaneous NFSv4 and POSIX.1e ACLs for the same + * entry are not allowed, so we should return here + */ + return (ARCHIVE_OK); + } } #endif if (acl != NULL) { - translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4); + r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4); acl_free(acl); - return (ARCHIVE_OK); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, errno, + "Couldn't translate NFSv4 ACLs: %s", accpath); + } + return (r); } -#endif +#endif /* ACL_TYPE_NFS4 */ /* Retrieve access ACL from file. */ if (*fd >= 0) @@ -467,19 +496,42 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_ACCESS); + +#if HAVE_ACL_IS_TRIVIAL_NP + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + if (r) { + acl_free(acl); + acl = NULL; + } + } +#endif + if (acl != NULL) { - translate_acl(a, entry, acl, + r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); acl_free(acl); + acl = NULL; + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, errno, + "Couldn't translate access ACLs: %s", accpath); + return (r); + } } /* Only directories can have default ACLs. */ if (S_ISDIR(archive_entry_mode(entry))) { acl = acl_get_file(accpath, ACL_TYPE_DEFAULT); if (acl != NULL) { - translate_acl(a, entry, acl, + r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT); acl_free(acl); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, errno, + "Couldn't translate default ACLs: %s", + accpath); + return (r); + } } } return (ARCHIVE_OK); @@ -535,12 +587,12 @@ translate_acl(struct archive_read_disk *a, #ifdef ACL_TYPE_NFS4 acl_entry_type_t acl_type; acl_flagset_t acl_flagset; - int brand, r; + int brand; #endif acl_entry_t acl_entry; acl_permset_t acl_permset; int i, entry_acl_type; - int s, ae_id, ae_tag, ae_perm; + int r, s, ae_id, ae_tag, ae_perm; const char *ae_name; @@ -548,7 +600,11 @@ translate_acl(struct archive_read_disk *a, // FreeBSD "brands" ACLs as POSIX.1e or NFSv4 // Make sure the "brand" on this ACL is consistent // with the default_entry_acl_type bits provided. - acl_get_brand_np(acl, &brand); + if (acl_get_brand_np(acl, &brand) != 0) { + archive_set_error(&a->archive, errno, + "Failed to read ACL brand"); + return (ARCHIVE_WARN); + } switch (brand) { case ACL_BRAND_POSIX: switch (default_entry_acl_type) { @@ -556,31 +612,42 @@ translate_acl(struct archive_read_disk *a, case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: break; default: - // XXX set warning message? - return ARCHIVE_FAILED; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Invalid ACL entry type for POSIX.1e ACL"); + return (ARCHIVE_WARN); } break; case ACL_BRAND_NFS4: if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) { - // XXX set warning message? - return ARCHIVE_FAILED; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Invalid ACL entry type for NFSv4 ACL"); + return (ARCHIVE_WARN); } break; default: - // XXX set warning message? - return ARCHIVE_FAILED; - break; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Unknown ACL brand"); + return (ARCHIVE_WARN); } #endif s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry); + if (s == -1) { + archive_set_error(&a->archive, errno, + "Failed to get first ACL entry"); + return (ARCHIVE_WARN); + } while (s == 1) { ae_id = -1; ae_name = NULL; ae_perm = 0; - acl_get_tag_type(acl_entry, &acl_tag); + if (acl_get_tag_type(acl_entry, &acl_tag) != 0) { + archive_set_error(&a->archive, errno, + "Failed to get ACL tag type"); + return (ARCHIVE_WARN); + } switch (acl_tag) { case ACL_USER: ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry); @@ -615,13 +682,18 @@ translate_acl(struct archive_read_disk *a, continue; } - // XXX acl type maps to allow/deny/audit/YYYY bits - // XXX acl_get_entry_type_np on FreeBSD returns EINVAL for - // non-NFSv4 ACLs + // XXX acl_type maps to allow/deny/audit/YYYY bits entry_acl_type = default_entry_acl_type; #ifdef ACL_TYPE_NFS4 - r = acl_get_entry_type_np(acl_entry, &acl_type); - if (r == 0) { + if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + /* + * acl_get_entry_type_np() falis with non-NFSv4 ACLs + */ + if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) { + archive_set_error(&a->archive, errno, "Failed " + "to get ACL type from a NFSv4 ACL entry"); + return (ARCHIVE_WARN); + } switch (acl_type) { case ACL_ENTRY_TYPE_ALLOW: entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW; @@ -635,29 +707,53 @@ translate_acl(struct archive_read_disk *a, case ACL_ENTRY_TYPE_ALARM: entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM; break; + default: + archive_set_error(&a->archive, errno, + "Invalid NFSv4 ACL entry type"); + return (ARCHIVE_WARN); } - } - /* - * Libarchive stores "flag" (NFSv4 inheritance bits) - * in the ae_perm bitmap. - */ - acl_get_flagset_np(acl_entry, &acl_flagset); - for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { - if (acl_get_flag_np(acl_flagset, - acl_inherit_map[i].platform_inherit)) - ae_perm |= acl_inherit_map[i].archive_inherit; - - } + /* + * Libarchive stores "flag" (NFSv4 inheritance bits) + * in the ae_perm bitmap. + * + * acl_get_flagset_np() fails with non-NFSv4 ACLs + */ + if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) { + archive_set_error(&a->archive, errno, + "Failed to get flagset from a NFSv4 ACL entry"); + return (ARCHIVE_WARN); + } + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + r = acl_get_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit); + if (r == -1) { + archive_set_error(&a->archive, errno, + "Failed to check flag in a NFSv4 " + "ACL flagset"); + return (ARCHIVE_WARN); + } else if (r) + ae_perm |= acl_inherit_map[i].archive_inherit; + } + } #endif - acl_get_permset(acl_entry, &acl_permset); + if (acl_get_permset(acl_entry, &acl_permset) != 0) { + archive_set_error(&a->archive, errno, + "Failed to get ACL permission set"); + return (ARCHIVE_WARN); + } for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { /* * acl_get_perm() is spelled differently on different * platforms; see above. */ - if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm)) + r = ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm); + if (r == -1) { + archive_set_error(&a->archive, errno, + "Failed to check permission in an ACL permission set"); + return (ARCHIVE_WARN); + } else if (r) ae_perm |= acl_perm_map[i].archive_perm; } @@ -666,6 +762,11 @@ translate_acl(struct archive_read_disk *a, ae_id, ae_name); s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); + if (s == -1) { + archive_set_error(&a->archive, errno, + "Failed to get next ACL entry"); + return (ARCHIVE_WARN); + } } return (ARCHIVE_OK); } diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 22a1f14..e856d98 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -165,7 +165,7 @@ struct filesystem { int synthetic; int remote; int noatime; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) size_t name_max; #endif long incr_xfer_size; @@ -200,7 +200,7 @@ struct tree { DIR *d; #define INVALID_DIR_HANDLE NULL struct dirent *de; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) struct dirent *dirent; size_t dirent_allocated; #endif @@ -938,7 +938,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -1041,7 +1041,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -1067,7 +1067,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -1504,7 +1504,20 @@ setup_current_filesystem(struct archive_read_disk *a) struct tree *t = a->tree; struct statfs sfs; #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC) +/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make + * this accurate; some platforms have both and we need the one that's + * used by getvfsbyname() + * + * Then the following would become: + * #if defined(GETVFSBYNAME_ARG_TYPE) + * GETVFSBYNAME_ARG_TYPE vfc; + * #endif + */ +# if defined(HAVE_STRUCT_XVFSCONF) struct xvfsconf vfc; +# else + struct vfsconf vfc; +# endif #endif int r, xr = 0; #if !defined(HAVE_STRUCT_STATFS_F_NAMEMAX) @@ -1579,7 +1592,7 @@ setup_current_filesystem(struct archive_read_disk *a) #endif t->current_filesystem->noatime = 0; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) /* Set maximum filename length. */ #if defined(HAVE_STRUCT_STATFS_F_NAMEMAX) t->current_filesystem->name_max = sfs.f_namemax; @@ -1602,7 +1615,7 @@ setup_current_filesystem(struct archive_read_disk *a) else t->current_filesystem->name_max = nm; #endif -#endif /* HAVE_READDIR_R */ +#endif /* USE_READDIR_R */ return (ARCHIVE_OK); } @@ -1804,7 +1817,7 @@ setup_current_filesystem(struct archive_read_disk *a) #endif t->current_filesystem->noatime = 0; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) /* Set maximum filename length. */ t->current_filesystem->name_max = sfs.f_namelen; #endif @@ -1888,7 +1901,7 @@ setup_current_filesystem(struct archive_read_disk *a) #endif t->current_filesystem->noatime = 0; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) /* Set maximum filename length. */ t->current_filesystem->name_max = sfs.f_namemax; #endif @@ -1905,7 +1918,7 @@ static int setup_current_filesystem(struct archive_read_disk *a) { struct tree *t = a->tree; -#if defined(_PC_NAME_MAX) && defined(HAVE_READDIR_R) +#if defined(_PC_NAME_MAX) && defined(USE_READDIR_R) long nm; #endif t->current_filesystem->synthetic = -1;/* Not supported */ @@ -1917,7 +1930,7 @@ setup_current_filesystem(struct archive_read_disk *a) t->current_filesystem->min_xfer_size = -1; t->current_filesystem->incr_xfer_size = -1; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) /* Set maximum filename length. */ # if defined(_PC_NAME_MAX) if (tree_current_is_symblic_link_target(t)) { @@ -1945,7 +1958,7 @@ setup_current_filesystem(struct archive_read_disk *a) else t->current_filesystem->name_max = nm; # endif /* _PC_NAME_MAX */ -#endif /* HAVE_READDIR_R */ +#endif /* USE_READDIR_R */ return (ARCHIVE_OK); } @@ -2353,7 +2366,7 @@ tree_dir_next_posix(struct tree *t) size_t namelen; if (t->d == NULL) { -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) size_t dirent_size; #endif @@ -2374,7 +2387,7 @@ tree_dir_next_posix(struct tree *t) t->visit_type = r != 0 ? r : TREE_ERROR_DIR; return (t->visit_type); } -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) dirent_size = offsetof(struct dirent, d_name) + t->filesystem_table[t->current->filesystem_id].name_max + 1; if (t->dirent == NULL || t->dirent_allocated < dirent_size) { @@ -2391,11 +2404,11 @@ tree_dir_next_posix(struct tree *t) } t->dirent_allocated = dirent_size; } -#endif /* HAVE_READDIR_R */ +#endif /* USE_READDIR_R */ } for (;;) { errno = 0; -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) r = readdir_r(t->d, t->dirent, &t->de); #ifdef _AIX /* Note: According to the man page, return value 9 indicates @@ -2647,7 +2660,7 @@ tree_free(struct tree *t) if (t == NULL) return; archive_string_free(&t->path); -#if defined(HAVE_READDIR_R) +#if defined(USE_READDIR_R) free(t->dirent); #endif free(t->sparse_list); diff --git a/libarchive/archive_read_disk_set_standard_lookup.c b/libarchive/archive_read_disk_set_standard_lookup.c index d6b2d55..c7fd247 100644 --- a/libarchive/archive_read_disk_set_standard_lookup.c +++ b/libarchive/archive_read_disk_set_standard_lookup.c @@ -232,6 +232,7 @@ static const char * lookup_uname_helper(struct name_cache *cache, id_t id) { struct passwd *result; + (void)cache; /* UNUSED */ result = getpwuid((uid_t)id); @@ -298,6 +299,7 @@ static const char * lookup_gname_helper(struct name_cache *cache, id_t id) { struct group *result; + (void)cache; /* UNUSED */ result = getgrgid((gid_t)id); diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 566d264..1fd158f 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -803,7 +803,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -875,7 +875,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -901,7 +901,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, r = archive_match_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { diff --git a/libarchive/archive_read_private.h b/libarchive/archive_read_private.h index 9b61a53..8eb5435 100644 --- a/libarchive/archive_read_private.h +++ b/libarchive/archive_read_private.h @@ -221,7 +221,7 @@ struct archive_read { struct { struct archive_read_passphrase *first; struct archive_read_passphrase **last; - int candiate; + int candidate; archive_passphrase_callback *callback; void *client_data; } passphrases; diff --git a/libarchive/archive_read_support_filter_lz4.c b/libarchive/archive_read_support_filter_lz4.c index e877917..37b2f59 100644 --- a/libarchive/archive_read_support_filter_lz4.c +++ b/libarchive/archive_read_support_filter_lz4.c @@ -595,7 +595,7 @@ lz4_filter_read_data_block(struct archive_read_filter *self, const void **p) #endif } - /* Check if an error happend in decompression process. */ + /* Check if an error occurred in the decompression process. */ if (uncompressed_size < 0) { archive_set_error(&(self->archive->archive), ARCHIVE_ERRNO_MISC, "lz4 decompression failed"); diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 1dfe52b..c0a536c 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -2431,6 +2431,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, switch (type) { case kEmptyStream: + if (h->emptyStreamBools != NULL) + return (-1); h->emptyStreamBools = calloc((size_t)zip->numFiles, sizeof(*h->emptyStreamBools)); if (h->emptyStreamBools == NULL) @@ -2451,6 +2453,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, return (-1); break; } + if (h->emptyFileBools != NULL) + return (-1); h->emptyFileBools = calloc(empty_streams, sizeof(*h->emptyFileBools)); if (h->emptyFileBools == NULL) @@ -2465,6 +2469,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, return (-1); break; } + if (h->antiBools != NULL) + return (-1); h->antiBools = calloc(empty_streams, sizeof(*h->antiBools)); if (h->antiBools == NULL) @@ -2491,6 +2497,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, if ((ll & 1) || ll < zip->numFiles * 4) return (-1); + if (zip->entry_names != NULL) + return (-1); zip->entry_names = malloc(ll); if (zip->entry_names == NULL) return (-1); @@ -2543,6 +2551,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, if ((p = header_bytes(a, 2)) == NULL) return (-1); allAreDefined = *p; + if (h->attrBools != NULL) + return (-1); h->attrBools = calloc((size_t)zip->numFiles, sizeof(*h->attrBools)); if (h->attrBools == NULL) diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index c359d83..a7f1d8d 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -1712,10 +1712,14 @@ lha_crc16(uint16_t crc, const void *pp, size_t len) for (;len >= 8; len -= 8) { /* This if statement expects compiler optimization will * remove the stament which will not be executed. */ +#undef bswap16 #if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */ # define bswap16(x) _byteswap_ushort(x) -#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \ - || defined(__clang__) +#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) +/* GCC 4.8 and later has __builtin_bswap16() */ +# define bswap16(x) __builtin_bswap16(x) +#elif defined(__clang__) +/* All clang versions have __builtin_bswap16() */ # define bswap16(x) __builtin_bswap16(x) #else # define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8)) diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index 8c3be9a..ae58e87 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -301,6 +301,15 @@ get_line_size(const char *b, ssize_t avail, ssize_t *nlsize) return (avail); } +/* + * <---------------- ravail ---------------------> + * <-- diff ------> <--- avail -----------------> + * <---- len -----------> + * | Previous lines | line being parsed nl extra | + * ^ + * b + * + */ static ssize_t next_line(struct archive_read *a, const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl) @@ -339,7 +348,7 @@ next_line(struct archive_read *a, *b += diff; *avail -= diff; tested = len;/* Skip some bytes we already determinated. */ - len = get_line_size(*b, *avail, nl); + len = get_line_size(*b + len, *avail - len, nl); if (len >= 0) len += tested; } diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index b0521a6..469666e 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -136,6 +136,7 @@ struct tar { int64_t entry_padding; int64_t entry_bytes_unconsumed; int64_t realsize; + int sparse_allowed; struct sparse_block *sparse_list; struct sparse_block *sparse_last; int64_t sparse_offset; @@ -1128,8 +1129,15 @@ header_common(struct archive_read *a, struct tar *tar, if (tar->entry_bytes_remaining < 0) { tar->entry_bytes_remaining = 0; archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Tar entry has negative size?"); - err = ARCHIVE_WARN; + "Tar entry has negative size"); + return (ARCHIVE_FATAL); + } + if (tar->entry_bytes_remaining == INT64_MAX) { + /* Note: tar_atol returns INT64_MAX on overflow */ + tar->entry_bytes_remaining = 0; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Tar entry size overflow"); + return (ARCHIVE_FATAL); } tar->realsize = tar->entry_bytes_remaining; archive_entry_set_size(entry, tar->entry_bytes_remaining); @@ -1264,6 +1272,14 @@ header_common(struct archive_read *a, struct tar *tar, * sparse information in the extended area. */ /* FALLTHROUGH */ + case '0': + /* + * Enable sparse file "read" support only for regular + * files and explicit GNU sparse files. However, we + * don't allow non-standard file types to be sparse. + */ + tar->sparse_allowed = 1; + /* FALLTHROUGH */ default: /* Regular file and non-standard types */ /* * Per POSIX: non-recognized types should always be @@ -1721,6 +1737,14 @@ pax_attribute(struct archive_read *a, struct tar *tar, * NULL pointer to strlen(). */ switch (key[0]) { case 'G': + /* Reject GNU.sparse.* headers on non-regular files. */ + if (strncmp(key, "GNU.sparse", 10) == 0 && + !tar->sparse_allowed) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Non-regular file cannot be sparse"); + return (ARCHIVE_FATAL); + } + /* GNU "0.0" sparse pax format. */ if (strcmp(key, "GNU.sparse.numblocks") == 0) { tar->sparse_offset = -1; diff --git a/libarchive/archive_read_support_format_warc.c b/libarchive/archive_read_support_format_warc.c index 46a59ea..deeaa9e 100644 --- a/libarchive/archive_read_support_format_warc.c +++ b/libarchive/archive_read_support_format_warc.c @@ -318,7 +318,7 @@ start_over: } memcpy(w->pool.str, fnam.str, fnam.len); w->pool.str[fnam.len] = '\0'; - /* let noone else know about the pool, it's a secret, shhh */ + /* let no one else know about the pool, it's a secret, shhh */ fnam.str = w->pool.str; /* snarf mtime or deduce from rtime @@ -535,7 +535,8 @@ xstrpisotime(const char *s, char **endptr) /* as a courtesy to our callers, and since this is a non-standard * routine, we skip leading whitespace */ - for (; isspace(*s); s++); + while (isspace((unsigned char)*s)) + ++s; /* read year */ if ((tm.tm_year = strtoi_lim(s, &s, 1583, 4095)) < 0 || *s++ != '-') { @@ -639,7 +640,9 @@ _warc_rdtyp(const char *buf, size_t bsz) return WT_NONE; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; if (val + 8U > eob) { ; @@ -676,7 +679,9 @@ _warc_rduri(const char *buf, size_t bsz) return res; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; /* overread URL designators */ if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) { @@ -692,7 +697,8 @@ _warc_rduri(const char *buf, size_t bsz) /* also massage eol to point to the first whitespace * after the last non-whitespace character before * the end of the line */ - for (; eol > uri && isspace(eol[-1]); eol--); + while (eol > uri && isspace((unsigned char)eol[-1])) + --eol; /* now then, inspect the URI */ if (memcmp(val, "file", 4U) == 0) { @@ -727,7 +733,7 @@ _warc_rdlen(const char *buf, size_t bsz) /* strtol kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; len = strtol(val, &on, 10); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return -1; } @@ -750,7 +756,7 @@ _warc_rdrtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } @@ -773,7 +779,7 @@ _warc_rdmtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 34ab04e..9796fca 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -418,18 +418,30 @@ zip_time(const char *p) * id1+size1+data1 + id2+size2+data2 ... * triplets. id and size are 2 bytes each. */ -static void -process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) +static int +process_extra(struct archive_read *a, const char *p, size_t extra_length, struct zip_entry* zip_entry) { unsigned offset = 0; - while (offset < extra_length - 4) { + if (extra_length == 0) { + return ARCHIVE_OK; + } + + if (extra_length < 4) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Too-small extra data: Need at least 4 bytes, but only found %d bytes", (int)extra_length); + return ARCHIVE_FAILED; + } + while (offset <= extra_length - 4) { unsigned short headerid = archive_le16dec(p + offset); unsigned short datasize = archive_le16dec(p + offset + 2); offset += 4; if (offset + datasize > extra_length) { - break; + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Extra data overflow: Need %d bytes but only found %d bytes", + (int)datasize, (int)(extra_length - offset)); + return ARCHIVE_FAILED; } #ifdef DEBUG fprintf(stderr, "Header id 0x%04x, length %d\n", @@ -715,13 +727,13 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) } offset += datasize; } -#ifdef DEBUG - if (offset != extra_length) - { - fprintf(stderr, - "Extra data field contents do not match reported size!\n"); + if (offset != extra_length) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Malformed extra data: Consumed %d bytes of %d bytes", + (int)offset, (int)extra_length); + return ARCHIVE_FAILED; } -#endif + return ARCHIVE_OK; } /* @@ -840,7 +852,9 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, return (ARCHIVE_FATAL); } - process_extra(h, extra_length, zip_entry); + if (ARCHIVE_OK != process_extra(a, h, extra_length, zip_entry)) { + return ARCHIVE_FATAL; + } __archive_read_consume(a, extra_length); /* Work around a bug in Info-Zip: When reading from a pipe, it @@ -1293,7 +1307,7 @@ zip_read_data_deflate(struct archive_read *a, const void **buff, && bytes_avail > zip->entry_bytes_remaining) { bytes_avail = (ssize_t)zip->entry_bytes_remaining; } - if (bytes_avail <= 0) { + if (bytes_avail < 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated ZIP file body"); return (ARCHIVE_FATAL); @@ -2691,7 +2705,9 @@ slurp_central_directory(struct archive_read *a, struct zip *zip) "Truncated ZIP file header"); return ARCHIVE_FATAL; } - process_extra(p + filename_length, extra_length, zip_entry); + if (ARCHIVE_OK != process_extra(a, p + filename_length, extra_length, zip_entry)) { + return ARCHIVE_FATAL; + } /* * Mac resource fork files are stored under the diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 282c58e..33094f4 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -559,7 +559,8 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest, } if (count == 0 && length != 0) ret = -1; - } while (0); + break; + } while (1); } dest->length += count; dest->s[dest->length] = L'\0'; @@ -3552,18 +3553,19 @@ win_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes, ll = WideCharToMultiByte(sc->to_cp, 0, (LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size, NULL, &defchar); - if (ll == 0 && - GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - /* Need more buffer for MBS. */ - ll = WideCharToMultiByte(sc->to_cp, 0, - (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL); - if (archive_string_ensure(as, ll +1) == NULL) - return (-1); - mbs = as->s + as->length; - mbs_size = as->buffer_length - as->length -1; - continue; + /* Exit loop if we succeeded */ + if (ll != 0 || + GetLastError() != ERROR_INSUFFICIENT_BUFFER) { + break; } - } while (0); + /* Else expand buffer and loop to try again. */ + ll = WideCharToMultiByte(sc->to_cp, 0, + (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL); + if (archive_string_ensure(as, ll +1) == NULL) + return (-1); + mbs = as->s + as->length; + mbs_size = as->buffer_length - as->length -1; + } while (1); archive_string_free(&tmp); as->length += ll; as->s[as->length] = '\0'; @@ -3634,19 +3636,20 @@ win_strncat_to_utf16(struct archive_string *as16, const void *_p, do { count = MultiByteToWideChar(sc->from_cp, MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1); - if (count == 0 && - GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - /* Need more buffer for UTF-16 string */ - count = MultiByteToWideChar(sc->from_cp, - MB_PRECOMPOSED, s, (int)length, NULL, 0); - if (archive_string_ensure(as16, (count +1) * 2) - == NULL) - return (-1); - u16 = as16->s + as16->length; - avail = as16->buffer_length - 2; - continue; + /* Exit loop if we succeeded */ + if (count != 0 || + GetLastError() != ERROR_INSUFFICIENT_BUFFER) { + break; } - } while (0); + /* Expand buffer and try again */ + count = MultiByteToWideChar(sc->from_cp, + MB_PRECOMPOSED, s, (int)length, NULL, 0); + if (archive_string_ensure(as16, (count +1) * 2) + == NULL) + return (-1); + u16 = as16->s + as16->length; + avail = as16->buffer_length - 2; + } while (1); as16->length += count * 2; as16->s[as16->length] = 0; as16->s[as16->length+1] = 0; diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index cc3d1c4..6b3bd61 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -580,7 +580,7 @@ void __archive_ensure_cloexec_flag(int fd) { #if defined(_WIN32) && !defined(__CYGWIN__) - (void)fd; /* UNSED */ + (void)fd; /* UNUSED */ #else int flags; diff --git a/libarchive/archive_write_disk_acl.c b/libarchive/archive_write_disk_acl.c index 5cbba54..e47384a 100644 --- a/libarchive/archive_write_disk_acl.c +++ b/libarchive/archive_write_disk_acl.c @@ -138,6 +138,7 @@ set_acl(struct archive *a, int fd, const char *name, acl_permset_t acl_permset; #ifdef ACL_TYPE_NFS4 acl_flagset_t acl_flagset; + int r; #endif int ret; int ae_type, ae_permset, ae_tag, ae_id; @@ -152,9 +153,19 @@ set_acl(struct archive *a, int fd, const char *name, if (entries == 0) return (ARCHIVE_OK); acl = acl_init(entries); + if (acl == (acl_t)NULL) { + archive_set_error(a, errno, + "Failed to initialize ACL working storage"); + return (ARCHIVE_FAILED); + } while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type, &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) { - acl_create_entry(&acl, &acl_entry); + if (acl_create_entry(&acl, &acl_entry) != 0) { + archive_set_error(a, errno, + "Failed to create a new ACL entry"); + ret = ARCHIVE_FAILED; + goto exit_free; + } switch (ae_tag) { case ARCHIVE_ENTRY_ACL_USER: @@ -185,50 +196,97 @@ set_acl(struct archive *a, int fd, const char *name, break; #endif default: - /* XXX */ - break; + archive_set_error(a, ARCHIVE_ERRNO_MISC, + "Unknown ACL tag"); + ret = ARCHIVE_FAILED; + goto exit_free; } #ifdef ACL_TYPE_NFS4 + r = 0; switch (ae_type) { case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: - acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW); + r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW); break; case ARCHIVE_ENTRY_ACL_TYPE_DENY: - acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY); + r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY); break; case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: - acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT); + r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT); break; case ARCHIVE_ENTRY_ACL_TYPE_ALARM: - acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM); + r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM); break; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: // These don't translate directly into the system ACL. break; default: - // XXX error handling here. - break; + archive_set_error(a, ARCHIVE_ERRNO_MISC, + "Unknown ACL entry type"); + ret = ARCHIVE_FAILED; + goto exit_free; + } + if (r != 0) { + archive_set_error(a, errno, + "Failed to set ACL entry type"); + ret = ARCHIVE_FAILED; + goto exit_free; } #endif - acl_get_permset(acl_entry, &acl_permset); - acl_clear_perms(acl_permset); + if (acl_get_permset(acl_entry, &acl_permset) != 0) { + archive_set_error(a, errno, + "Failed to get ACL permission set"); + ret = ARCHIVE_FAILED; + goto exit_free; + } + if (acl_clear_perms(acl_permset) != 0) { + archive_set_error(a, errno, + "Failed to clear ACL permissions"); + ret = ARCHIVE_FAILED; + goto exit_free; + } for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { if (ae_permset & acl_perm_map[i].archive_perm) - acl_add_perm(acl_permset, - acl_perm_map[i].platform_perm); + if (acl_add_perm(acl_permset, + acl_perm_map[i].platform_perm) != 0) { + archive_set_error(a, errno, + "Failed to add ACL permission"); + ret = ARCHIVE_FAILED; + goto exit_free; + } } #ifdef ACL_TYPE_NFS4 - acl_get_flagset_np(acl_entry, &acl_flagset); - acl_clear_flags_np(acl_flagset); - for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { - if (ae_permset & acl_inherit_map[i].archive_inherit) - acl_add_flag_np(acl_flagset, - acl_inherit_map[i].platform_inherit); + if (acl_type == ACL_TYPE_NFS4) { + /* + * acl_get_flagset_np() fails with non-NFSv4 ACLs + */ + if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) { + archive_set_error(a, errno, + "Failed to get flagset from an NFSv4 ACL entry"); + ret = ARCHIVE_FAILED; + goto exit_free; + } + if (acl_clear_flags_np(acl_flagset) != 0) { + archive_set_error(a, errno, + "Failed to clear flags from an NFSv4 ACL flagset"); + ret = ARCHIVE_FAILED; + goto exit_free; + } + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + if (ae_permset & acl_inherit_map[i].archive_inherit) { + if (acl_add_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit) != 0) { + archive_set_error(a, errno, + "Failed to add flag to NFSv4 ACL flagset"); + ret = ARCHIVE_FAILED; + goto exit_free; + } + } + } } #endif } @@ -257,6 +315,7 @@ set_acl(struct archive *a, int fd, const char *name, ret = ARCHIVE_WARN; } #endif +exit_free: acl_free(acl); return (ret); } diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 6737cd7..17c23b0 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -140,7 +140,17 @@ __FBSDID("$FreeBSD$"); #define O_BINARY 0 #endif #ifndef O_CLOEXEC -#define O_CLOEXEC 0 +#define O_CLOEXEC 0 +#endif + +/* Ignore non-int O_NOFOLLOW constant. */ +/* gnulib's fcntl.h does this on AIX, but it seems practical everywhere */ +#if defined O_NOFOLLOW && !(INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) +#undef O_NOFOLLOW +#endif + +#ifndef O_NOFOLLOW +#define O_NOFOLLOW 0 #endif struct fixup_entry { @@ -326,12 +336,14 @@ struct archive_write_disk { #define HFS_BLOCKS(s) ((s) >> 12) +static int check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags); static int check_symlinks(struct archive_write_disk *); static int create_filesystem_object(struct archive_write_disk *); static struct fixup_entry *current_fixup(struct archive_write_disk *, const char *pathname); #if defined(HAVE_FCHDIR) && defined(PATH_MAX) static void edit_deep_directories(struct archive_write_disk *ad); #endif +static int cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags); static int cleanup_pathname(struct archive_write_disk *); static int create_dir(struct archive_write_disk *, char *); static int create_parent_dir(struct archive_write_disk *, char *); @@ -1796,7 +1808,7 @@ edit_deep_directories(struct archive_write_disk *a) char *tail = a->name; /* If path is short, avoid the open() below. */ - if (strlen(tail) <= PATH_MAX) + if (strlen(tail) < PATH_MAX) return; /* Try to record our starting dir. */ @@ -1806,7 +1818,7 @@ edit_deep_directories(struct archive_write_disk *a) return; /* As long as the path is too long... */ - while (strlen(tail) > PATH_MAX) { + while (strlen(tail) >= PATH_MAX) { /* Locate a dir prefix shorter than PATH_MAX. */ tail += PATH_MAX - 8; while (tail > a->name && *tail != '/') @@ -2014,6 +2026,10 @@ create_filesystem_object(struct archive_write_disk *a) const char *linkname; mode_t final_mode, mode; int r; + /* these for check_symlinks_fsobj */ + char *linkname_copy; /* non-const copy of linkname */ + struct archive_string error_string; + int error_number; /* We identify hard/symlinks according to the link names. */ /* Since link(2) and symlink(2) don't handle modes, we're done here. */ @@ -2022,6 +2038,27 @@ create_filesystem_object(struct archive_write_disk *a) #if !HAVE_LINK return (EPERM); #else + archive_string_init(&error_string); + linkname_copy = strdup(linkname); + if (linkname_copy == NULL) { + return (EPERM); + } + /* TODO: consider using the cleaned-up path as the link target? */ + r = cleanup_pathname_fsobj(linkname_copy, &error_number, &error_string, a->flags); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, error_number, "%s", error_string.s); + free(linkname_copy); + /* EPERM is more appropriate than error_number for our callers */ + return (EPERM); + } + r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, error_number, "%s", error_string.s); + free(linkname_copy); + /* EPERM is more appropriate than error_number for our callers */ + return (EPERM); + } + free(linkname_copy); r = link(linkname, a->name) ? errno : 0; /* * New cpio and pax formats allow hardlink entries @@ -2040,7 +2077,7 @@ create_filesystem_object(struct archive_write_disk *a) a->deferred = 0; } else if (r == 0 && a->filesize > 0) { a->fd = open(a->name, - O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC); + O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC | O_NOFOLLOW); __archive_ensure_cloexec_flag(a->fd); if (a->fd < 0) r = errno; @@ -2351,116 +2388,233 @@ current_fixup(struct archive_write_disk *a, const char *pathname) return (a->current_fixup); } -/* TODO: Make this work. */ -/* - * TODO: The deep-directory support bypasses this; disable deep directory - * support if we're doing symlink checks. - */ /* * TODO: Someday, integrate this with the deep dir support; they both * scan the path and both can be optimized by comparing against other * recent paths. */ /* TODO: Extend this to support symlinks on Windows Vista and later. */ + +/* + * Checks the given path to see if any elements along it are symlinks. Returns + * ARCHIVE_OK if there are none, otherwise puts an error in errmsg. + */ static int -check_symlinks(struct archive_write_disk *a) +check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags) { #if !defined(HAVE_LSTAT) /* Platform doesn't have lstat, so we can't look for symlinks. */ - (void)a; /* UNUSED */ + (void)path; /* UNUSED */ + (void)error_number; /* UNUSED */ + (void)error_string; /* UNUSED */ + (void)flags; /* UNUSED */ return (ARCHIVE_OK); #else - char *pn; + int res = ARCHIVE_OK; + char *tail; + char *head; + int last; char c; int r; struct stat st; + int restore_pwd; + + /* Nothing to do here if name is empty */ + if(path[0] == '\0') + return (ARCHIVE_OK); /* * Guard against symlink tricks. Reject any archive entry whose * destination would be altered by a symlink. + * + * Walk the filename in chunks separated by '/'. For each segment: + * - if it doesn't exist, continue + * - if it's symlink, abort or remove it + * - if it's a directory and it's not the last chunk, cd into it + * As we go: + * head points to the current (relative) path + * tail points to the temporary \0 terminating the segment we're currently examining + * c holds what used to be in *tail + * last is 1 if this is the last tail */ - /* Whatever we checked last time doesn't need to be re-checked. */ - pn = a->name; - if (archive_strlen(&(a->path_safe)) > 0) { - char *p = a->path_safe.s; - while ((*pn != '\0') && (*p == *pn)) - ++p, ++pn; - } + restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC); + __archive_ensure_cloexec_flag(restore_pwd); + if (restore_pwd < 0) + return (ARCHIVE_FATAL); + head = path; + tail = path; + last = 0; + /* TODO: reintroduce a safe cache here? */ /* Skip the root directory if the path is absolute. */ - if(pn == a->name && pn[0] == '/') - ++pn; - c = pn[0]; - /* Keep going until we've checked the entire name. */ - while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) { + if(tail == path && tail[0] == '/') + ++tail; + /* Keep going until we've checked the entire name. + * head, tail, path all alias the same string, which is + * temporarily zeroed at tail, so be careful restoring the + * stashed (c=tail[0]) for error messages. + * Exiting the loop with break is okay; continue is not. + */ + while (!last) { + /* Skip the separator we just consumed, plus any adjacent ones */ + while (*tail == '/') + ++tail; /* Skip the next path element. */ - while (*pn != '\0' && *pn != '/') - ++pn; - c = pn[0]; - pn[0] = '\0'; + while (*tail != '\0' && *tail != '/') + ++tail; + /* is this the last path component? */ + last = (tail[0] == '\0') || (tail[0] == '/' && tail[1] == '\0'); + /* temporarily truncate the string here */ + c = tail[0]; + tail[0] = '\0'; /* Check that we haven't hit a symlink. */ - r = lstat(a->name, &st); + r = lstat(head, &st); if (r != 0) { + tail[0] = c; /* We've hit a dir that doesn't exist; stop now. */ - if (errno == ENOENT) + if (errno == ENOENT) { break; + } else { + /* Treat any other error as fatal - best to be paranoid here + * Note: This effectively disables deep directory + * support when security checks are enabled. + * Otherwise, very long pathnames that trigger + * an error here could evade the sandbox. + * TODO: We could do better, but it would probably + * require merging the symlink checks with the + * deep-directory editing. */ + if (error_number) *error_number = errno; + if (error_string) + archive_string_sprintf(error_string, + "Could not stat %s", + path); + res = ARCHIVE_FAILED; + break; + } + } else if (S_ISDIR(st.st_mode)) { + if (!last) { + if (chdir(head) != 0) { + tail[0] = c; + if (error_number) *error_number = errno; + if (error_string) + archive_string_sprintf(error_string, + "Could not chdir %s", + path); + res = (ARCHIVE_FATAL); + break; + } + /* Our view is now from inside this dir: */ + head = tail + 1; + } } else if (S_ISLNK(st.st_mode)) { - if (c == '\0') { + if (last) { /* * Last element is symlink; remove it * so we can overwrite it with the * item being extracted. */ - if (unlink(a->name)) { - archive_set_error(&a->archive, errno, - "Could not remove symlink %s", - a->name); - pn[0] = c; - return (ARCHIVE_FAILED); + if (unlink(head)) { + tail[0] = c; + if (error_number) *error_number = errno; + if (error_string) + archive_string_sprintf(error_string, + "Could not remove symlink %s", + path); + res = ARCHIVE_FAILED; + break; } - a->pst = NULL; /* * Even if we did remove it, a warning * is in order. The warning is silly, * though, if we're just replacing one * symlink with another symlink. */ - if (!S_ISLNK(a->mode)) { - archive_set_error(&a->archive, 0, - "Removing symlink %s", - a->name); + tail[0] = c; + /* FIXME: not sure how important this is to restore + if (!S_ISLNK(path)) { + if (error_number) *error_number = 0; + if (error_string) + archive_string_sprintf(error_string, + "Removing symlink %s", + path); } + */ /* Symlink gone. No more problem! */ - pn[0] = c; - return (0); - } else if (a->flags & ARCHIVE_EXTRACT_UNLINK) { + res = ARCHIVE_OK; + break; + } else if (flags & ARCHIVE_EXTRACT_UNLINK) { /* User asked us to remove problems. */ - if (unlink(a->name) != 0) { - archive_set_error(&a->archive, 0, - "Cannot remove intervening symlink %s", - a->name); - pn[0] = c; - return (ARCHIVE_FAILED); + if (unlink(head) != 0) { + tail[0] = c; + if (error_number) *error_number = 0; + if (error_string) + archive_string_sprintf(error_string, + "Cannot remove intervening symlink %s", + path); + res = ARCHIVE_FAILED; + break; } - a->pst = NULL; + tail[0] = c; } else { - archive_set_error(&a->archive, 0, - "Cannot extract through symlink %s", - a->name); - pn[0] = c; - return (ARCHIVE_FAILED); + tail[0] = c; + if (error_number) *error_number = 0; + if (error_string) + archive_string_sprintf(error_string, + "Cannot extract through symlink %s", + path); + res = ARCHIVE_FAILED; + break; } } - pn[0] = c; - if (pn[0] != '\0') - pn++; /* Advance to the next segment. */ + /* be sure to always maintain this */ + tail[0] = c; + if (tail[0] != '\0') + tail++; /* Advance to the next segment. */ + } + /* Catches loop exits via break */ + tail[0] = c; +#ifdef HAVE_FCHDIR + /* If we changed directory above, restore it here. */ + if (restore_pwd >= 0) { + r = fchdir(restore_pwd); + if (r != 0) { + if(error_number) *error_number = errno; + if(error_string) + archive_string_sprintf(error_string, + "chdir() failure"); + } + close(restore_pwd); + restore_pwd = -1; + if (r != 0) { + res = (ARCHIVE_FATAL); + } } - pn[0] = c; - /* We've checked and/or cleaned the whole path, so remember it. */ - archive_strcpy(&a->path_safe, a->name); - return (ARCHIVE_OK); +#endif + /* TODO: reintroduce a safe cache here? */ + return res; #endif } +/* + * Check a->name for symlinks, returning ARCHIVE_OK if its clean, otherwise + * calls archive_set_error and returns ARCHIVE_{FATAL,FAILED} + */ +static int +check_symlinks(struct archive_write_disk *a) +{ + struct archive_string error_string; + int error_number; + int rc; + archive_string_init(&error_string); + rc = check_symlinks_fsobj(a->name, &error_number, &error_string, a->flags); + if (rc != ARCHIVE_OK) { + archive_set_error(&a->archive, error_number, "%s", error_string.s); + } + archive_string_free(&error_string); + a->pst = NULL; /* to be safe */ + return rc; +} + + #if defined(__CYGWIN__) /* * 1. Convert a path separator from '\' to '/' . @@ -2534,15 +2688,17 @@ cleanup_pathname_win(struct archive_write_disk *a) * is set) if the path is absolute. */ static int -cleanup_pathname(struct archive_write_disk *a) +cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags) { char *dest, *src; char separator = '\0'; - dest = src = a->name; + dest = src = path; if (*src == '\0') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Invalid empty pathname"); + if (error_number) *error_number = ARCHIVE_ERRNO_MISC; + if (error_string) + archive_string_sprintf(error_string, + "Invalid empty pathname"); return (ARCHIVE_FAILED); } @@ -2551,9 +2707,11 @@ cleanup_pathname(struct archive_write_disk *a) #endif /* Skip leading '/'. */ if (*src == '/') { - if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Path is absolute"); + if (flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) { + if (error_number) *error_number = ARCHIVE_ERRNO_MISC; + if (error_string) + archive_string_sprintf(error_string, + "Path is absolute"); return (ARCHIVE_FAILED); } @@ -2580,10 +2738,11 @@ cleanup_pathname(struct archive_write_disk *a) } else if (src[1] == '.') { if (src[2] == '/' || src[2] == '\0') { /* Conditionally warn about '..' */ - if (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "Path contains '..'"); + if (flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) { + if (error_number) *error_number = ARCHIVE_ERRNO_MISC; + if (error_string) + archive_string_sprintf(error_string, + "Path contains '..'"); return (ARCHIVE_FAILED); } } @@ -2614,7 +2773,7 @@ cleanup_pathname(struct archive_write_disk *a) * We've just copied zero or more path elements, not including the * final '/'. */ - if (dest == a->name) { + if (dest == path) { /* * Nothing got copied. The path must have been something * like '.' or '/' or './' or '/././././/./'. @@ -2629,6 +2788,21 @@ cleanup_pathname(struct archive_write_disk *a) return (ARCHIVE_OK); } +static int +cleanup_pathname(struct archive_write_disk *a) +{ + struct archive_string error_string; + int error_number; + int rc; + archive_string_init(&error_string); + rc = cleanup_pathname_fsobj(a->name, &error_number, &error_string, a->flags); + if (rc != ARCHIVE_OK) { + archive_set_error(&a->archive, error_number, "%s", error_string.s); + } + archive_string_free(&error_string); + return rc; +} + /* * Create the parent directory of the specified path, assuming path * is already in mutable storage. @@ -3487,6 +3661,9 @@ exit_xattr: static int copy_acls(struct archive_write_disk *a, int tmpfd, int dffd) { +#ifndef HAVE_SYS_ACL_H + return 0; +#else acl_t acl, dfacl = NULL; int acl_r, ret = ARCHIVE_OK; @@ -3514,6 +3691,7 @@ exit_acl: if (dfacl) acl_free(dfacl); return (ret); +#endif } static int diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index cb3e54e..c20e088 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -436,7 +436,7 @@ struct iso_option { * Type : string * Default: Auto detect * : We check a size of boot image; - * : If ths size is just 1.22M/1.44M/2.88M, + * : If the size is just 1.22M/1.44M/2.88M, * : we assume boot_type is 'fd'; * : otherwise boot_type is 'no-emulation'. * COMPAT : diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c index 484ab34..797b533 100644 --- a/libarchive/archive_write_set_format_ustar.c +++ b/libarchive/archive_write_set_format_ustar.c @@ -307,7 +307,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry) * case getting WCS failed. On POSIX, this is a * normal operation. */ - if (p != NULL && p[strlen(p) - 1] != '/') { + if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') { struct archive_string as; archive_string_init(&as); diff --git a/libarchive/config_freebsd.h b/libarchive/config_freebsd.h index 2073431..d3ce373 100644 --- a/libarchive/config_freebsd.h +++ b/libarchive/config_freebsd.h @@ -28,6 +28,7 @@ /* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_FD_NP 1 #define HAVE_ACL_GET_LINK_NP 1 #define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt index 124aa3a..1cb21f9 100644 --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@ -6,7 +6,7 @@ IF(ENABLE_TEST) SET(libarchive_test_SOURCES ../../test_utils/test_utils.c - main.c + main.c read_open_memory.c test.h test_acl_freebsd_nfs4.c @@ -138,6 +138,7 @@ IF(ENABLE_TEST) test_read_format_lha_bugfix_0.c test_read_format_lha_filename.c test_read_format_mtree.c + test_read_format_mtree_crash747.c test_read_format_pax_bz2.c test_read_format_rar.c test_read_format_rar_encryption_data.c @@ -164,6 +165,7 @@ IF(ENABLE_TEST) test_read_format_zip_encryption_header.c test_read_format_zip_encryption_partially.c test_read_format_zip_filename.c + test_read_format_zip_high_compression.c test_read_format_zip_mac_metadata.c test_read_format_zip_malformed.c test_read_format_zip_msdos.c @@ -198,6 +200,9 @@ IF(ENABLE_TEST) test_write_disk_no_hfs_compression.c test_write_disk_perms.c test_write_disk_secure.c + test_write_disk_secure744.c + test_write_disk_secure745.c + test_write_disk_secure746.c test_write_disk_sparse.c test_write_disk_symlink.c test_write_disk_times.c @@ -295,7 +300,7 @@ IF(ENABLE_TEST) # Experimental new test handling ADD_CUSTOM_TARGET(run_libarchive_test - COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR}) + COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR} -vv) ADD_DEPENDENCIES(run_all_tests run_libarchive_test) ENDIF(ENABLE_TEST) diff --git a/libarchive/test/list.h b/libarchive/test/list.h index 89b22c6..4ddccbc 100644 --- a/libarchive/test/list.h +++ b/libarchive/test/list.h @@ -1,5 +1,6 @@ DEFINE_TEST(test_acl_freebsd_nfs4) -DEFINE_TEST(test_acl_freebsd_posix1e) +DEFINE_TEST(test_acl_freebsd_posix1e_restore) +DEFINE_TEST(test_acl_freebsd_posix1e_read) DEFINE_TEST(test_acl_nfs4) DEFINE_TEST(test_acl_pax) DEFINE_TEST(test_acl_posix1e) @@ -260,6 +261,7 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v1_form) DEFINE_TEST(test_read_format_mtree_nomagic_v2_form) DEFINE_TEST(test_read_format_mtree_nomagic_v2_netbsd_form) DEFINE_TEST(test_read_format_mtree_nonexistent_contents_file) +DEFINE_TEST(test_read_format_mtree_crash747) DEFINE_TEST(test_read_format_pax_bz2) DEFINE_TEST(test_read_format_rar_basic) DEFINE_TEST(test_read_format_rar_subblock) @@ -321,6 +323,8 @@ DEFINE_TEST(test_read_format_zip_filename_CP866_CP1251_win) DEFINE_TEST(test_read_format_zip_filename_KOI8R_CP1251) DEFINE_TEST(test_read_format_zip_filename_UTF8_CP1251) DEFINE_TEST(test_read_format_zip_filename_KOI8R_UTF8_2) +DEFINE_TEST(test_read_format_zip_high_compression) +DEFINE_TEST(test_read_format_zip_high_compression2) DEFINE_TEST(test_read_format_zip_mac_metadata) DEFINE_TEST(test_read_format_zip_malformed) DEFINE_TEST(test_read_format_zip_msdos) @@ -379,6 +383,10 @@ DEFINE_TEST(test_write_disk_lookup) DEFINE_TEST(test_write_disk_mac_metadata) DEFINE_TEST(test_write_disk_no_hfs_compression) DEFINE_TEST(test_write_disk_perms) +DEFINE_TEST(test_write_disk_secure744) +DEFINE_TEST(test_write_disk_secure745) +DEFINE_TEST(test_write_disk_secure746a) +DEFINE_TEST(test_write_disk_secure746b) DEFINE_TEST(test_write_disk_secure) DEFINE_TEST(test_write_disk_sparse) DEFINE_TEST(test_write_disk_symlink) diff --git a/libarchive/test/main.c b/libarchive/test/main.c index 0f50e94..32a1f78 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -128,6 +128,13 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1155,6 +1162,35 @@ assertion_file_contains_lines_any_order(const char *file, int line, return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1292,6 +1328,11 @@ assertion_file_time(const char *file, int line, switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1359,6 +1400,33 @@ assertion_file_birthtime_recent(const char *file, int line, return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1398,7 +1466,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1577,8 +1645,12 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode) if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1627,6 +1699,12 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + close(fd); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1639,10 +1717,12 @@ assertion_make_file(const char *file, int line, failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } diff --git a/libarchive/test/test.h b/libarchive/test/test.h index 1117d6a..a48c426 100644 --- a/libarchive/test/test.h +++ b/libarchive/test/test.h @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,8 +244,10 @@ int assertion_file_atime_recent(const char *, int, const char *); int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); @@ -326,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; diff --git a/libarchive/test/test_acl_freebsd_nfs4.c b/libarchive/test/test_acl_freebsd_nfs4.c index fd2301d..89861d6 100644 --- a/libarchive/test/test_acl_freebsd_nfs4.c +++ b/libarchive/test/test_acl_freebsd_nfs4.c @@ -93,7 +93,7 @@ static struct myacl_t acls_reg[] = { static struct myacl_t acls_dir[] = { /* For this test, we need to be able to read and write the ACL. */ - { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ACL, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_READ_ACL, ARCHIVE_ENTRY_ACL_USER_OBJ, -1, ""}, /* An entry for each type. */ diff --git a/libarchive/test/test_acl_freebsd_posix1e.c b/libarchive/test/test_acl_freebsd_posix1e.c index 36f9499..2eb0a00 100644 --- a/libarchive/test/test_acl_freebsd_posix1e.c +++ b/libarchive/test/test_acl_freebsd_posix1e.c @@ -70,15 +70,9 @@ set_acls(struct archive_entry *ae, struct myacl_t *acls) } static int -acl_match(acl_entry_t aclent, struct myacl_t *myacl) -{ - gid_t g, *gp; - uid_t u, *up; - acl_tag_t tag_type; - acl_permset_t opaque_ps; +acl_entry_get_perm(acl_entry_t aclent) { int permset = 0; - - acl_get_tag_type(aclent, &tag_type); + acl_permset_t opaque_ps; /* translate the silly opaque permset to a bitmap */ acl_get_permset(aclent, &opaque_ps); @@ -88,10 +82,61 @@ acl_match(acl_entry_t aclent, struct myacl_t *myacl) permset |= ARCHIVE_ENTRY_ACL_WRITE; if (acl_get_perm_np(opaque_ps, ACL_READ)) permset |= ARCHIVE_ENTRY_ACL_READ; + return permset; +} + +#if 0 +static int +acl_get_specific_entry(acl_t acl, acl_tag_t requested_tag_type, int requested_tag) { + int entry_id = ACL_FIRST_ENTRY; + acl_entry_t acl_entry; + acl_tag_t acl_tag_type; + + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* If this matches, return perm mask */ + acl_get_tag_type(acl_entry, &acl_tag_type); + if (acl_tag_type == requested_tag_type) { + switch (acl_tag_type) { + case ACL_USER_OBJ: + if ((uid_t)requested_tag == *(uid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_GROUP_OBJ: + if ((gid_t)requested_tag == *(gid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_USER: + case ACL_GROUP: + case ACL_OTHER: + return acl_entry_get_perm(acl_entry); + default: + failure("Unexpected ACL tag type"); + assert(0); + } + } + - if (permset != myacl->permset) + } + return -1; +} +#endif + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + gid_t g, *gp; + uid_t u, *up; + acl_tag_t tag_type; + + if (myacl->permset != acl_entry_get_perm(aclent)) return (0); + acl_get_tag_type(aclent, &tag_type); switch (tag_type) { case ACL_USER_OBJ: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); @@ -190,7 +235,7 @@ compare_acls(acl_t acl, struct myacl_t *myacls) * Verify ACL restore-to-disk. This test is FreeBSD-specific. */ -DEFINE_TEST(test_acl_freebsd_posix1e) +DEFINE_TEST(test_acl_freebsd_posix1e_restore) { #if !defined(__FreeBSD__) skipping("FreeBSD-specific ACL restore test"); @@ -263,3 +308,111 @@ DEFINE_TEST(test_acl_freebsd_posix1e) acl_free(acl); #endif } + +/* + * Verify ACL reaed-from-disk. This test is FreeBSD-specific. + */ +DEFINE_TEST(test_acl_freebsd_posix1e_read) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL read test"); +#elif __FreeBSD__ < 5 + skipping("ACL read supported only on FreeBSD 5.0 and later"); +#else + struct archive *a; + struct archive_entry *ae; + int n, fd; + const char *acl1_text, *acl2_text; + acl_t acl1, acl2; + + /* + * Manually construct a directory and two files with + * different ACLs. This also serves to verify that ACLs + * are supported on the local filesystem. + */ + + /* Create a test file f1 with acl1 */ + acl1_text = "user::rwx,group::rwx,other::rwx,user:1:rw-,group:15:r-x,mask::rwx"; + acl1 = acl_from_text(acl1_text); + assert((void *)acl1 != NULL); + fd = open("f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl1); + return; + } + n = acl_set_fd(fd, acl1); + acl_free(acl1); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + assertMakeDir("d", 0700); + + /* + * Create file d/f1 with acl2 + * + * This differs from acl1 in the u:1: and g:15: permissions. + * + * This file deliberately has the same name but a different ACL. + * Github Issue #777 explains how libarchive's directory traversal + * did not always correctly enter directories before attempting + * to read ACLs, resulting in reading the ACL from a like-named + * file in the wrong directory. + */ + acl2_text = "user::rwx,group::rwx,other::---,user:1:r--,group:15:r--,mask::rwx"; + acl2 = acl_from_text(acl2_text); + assert((void *)acl2 != NULL); + fd = open("d/f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl2); + return; + } + n = acl_set_fd(fd, acl2); + acl_free(acl2); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + /* Create a read-from-disk object. */ + assert(NULL != (a = archive_read_disk_new())); + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, ".")); + assert(NULL != (ae = archive_entry_new())); + + /* Walk the dir until we see both of the files */ + while (ARCHIVE_OK == archive_read_next_header2(a, ae)) { + archive_read_disk_descend(a); + if (strcmp(archive_entry_pathname(ae), "./f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl1_text); + + } else if (strcmp(archive_entry_pathname(ae), "./d/f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl2_text); + } + } + + archive_free(a); +#endif +} diff --git a/libarchive/test/test_archive_string_conversion.c b/libarchive/test/test_archive_string_conversion.c index fea141d..e86f97c 100644 --- a/libarchive/test/test_archive_string_conversion.c +++ b/libarchive/test/test_archive_string_conversion.c @@ -800,8 +800,8 @@ DEFINE_TEST(test_archive_string_conversion) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assert((fp = fopen(testdata, "w")) != NULL); while ((size = archive_read_data(a, buff, 512)) > 0) - fwrite(buff, 1, size, fp); - fclose(fp); + assertEqualInt(size, fwrite(buff, 1, size, fp)); + assertEqualInt(0, fclose(fp)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); test_archive_string_normalization_nfc(testdata); diff --git a/libarchive/test/test_fuzz.c b/libarchive/test/test_fuzz.c index 76fda62..602b894 100644 --- a/libarchive/test/test_fuzz.c +++ b/libarchive/test/test_fuzz.c @@ -110,13 +110,17 @@ test_fuzz(const struct files *filesets) for (i = 0; filesets[n].names[i] != NULL; ++i) { tmp = slurpfile(&size, filesets[n].names[i]); - rawimage = (char *)realloc(rawimage, oldsize + size); + char *newraw = (char *)realloc(rawimage, oldsize + size); + if (!assert(newraw != NULL)) + { + free(rawimage); + continue; + } + rawimage = newraw; memcpy(rawimage + oldsize, tmp, size); oldsize += size; size = oldsize; free(tmp); - if (!assert(rawimage != NULL)) - continue; } } if (size == 0) diff --git a/libarchive/test/test_read_format_mtree_crash747.c b/libarchive/test/test_read_format_mtree_crash747.c new file mode 100644 index 0000000..9500bba --- /dev/null +++ b/libarchive/test/test_read_format_mtree_crash747.c @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2003-2016 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 "test.h" + + +/* + * Reproduce the crash reported in Github Issue #747. + */ +DEFINE_TEST(test_read_format_mtree_crash747) +{ + const char *reffile = "test_read_format_mtree_crash747.mtree.bz2"; + struct archive *a; + + if (archive_bzlib_version() == NULL) { + skipping("This test requires bzlib"); + return; + } + + extract_reference_file(reffile); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_bzip2(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_mtree(a)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_open_filename(a, reffile, 10240)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + diff --git a/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu b/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu new file mode 100644 index 0000000..84f3895 --- /dev/null +++ b/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu @@ -0,0 +1,6 @@ +begin 600 test_read_format_mtree_crash747.mtree.bz2 +M0EIH.3%!62936:OH@(@``'/[@,`0`@!``'^```)A@9\`$`@@`'4)049!IIH! +MM021-0,F@&@6````9%>$(K!GIC*XFR0`$```J0+:$XP```!D-F)H[#SE9+2' +4+E"L=ASXUI%R(I"HD'ZA(5?1`Q`` +` +end diff --git a/libarchive/test/test_read_format_rar.c b/libarchive/test/test_read_format_rar.c index 5870323..6392d8f 100644 --- a/libarchive/test/test_read_format_rar.c +++ b/libarchive/test/test_read_format_rar.c @@ -3603,7 +3603,7 @@ DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files) assertEqualIntA(a, 0, archive_read_data(a, buff, sizeof(buff))); /* - * Eigth header. + * Eighth header. */ assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("testdir/testsymlink6", archive_entry_pathname(ae)); diff --git a/libarchive/test/test_read_format_zip_high_compression.c b/libarchive/test/test_read_format_zip_high_compression.c new file mode 100644 index 0000000..42faed3 --- /dev/null +++ b/libarchive/test/test_read_format_zip_high_compression.c @@ -0,0 +1,153 @@ +/*- + * Copyright (c) 2016 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 "test.h" +__FBSDID("$FreeBSD"); + +#include + + +/* + * Github Issue 748 reported problems with end-of-entry handling + * with highly-compressible data. This resulted in the end of the + * data being truncated (extracted as zero bytes). + */ + +/* + * Extract the specific test archive that was used to diagnose + * Issue 748: + */ +DEFINE_TEST(test_read_format_zip_high_compression) +{ + const char *refname = "test_read_format_zip_high_compression.zip"; + char *p; + size_t archive_size; + struct archive *a; + struct archive_entry *entry; + + const void *pv; + size_t s; + int64_t o; + + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + + extract_reference_file(refname); + p = slurpfile(&archive_size, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, archive_size, 16 * 1024)); + assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry)); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(262144, s); + assertEqualInt(0, o); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(160, s); + assertEqualInt(262144, o); + + assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); + + assertEqualInt(ARCHIVE_OK, archive_free(a)); + free(p); +} + +/* + * Synthesize a lot of varying inputs that are highly compressible. + */ +DEFINE_TEST(test_read_format_zip_high_compression2) +{ + const size_t body_size = 1024 * 1024; + const size_t buff_size = 2 * 1024 * 1024; + char *body, *body_read, *buff; + int n; + + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + + assert((body = malloc(body_size)) != NULL); + assert((body_read = malloc(body_size)) != NULL); + assert((buff = malloc(buff_size)) != NULL); + + /* Highly-compressible data: all bytes 255, except for a + * single 1 byte. + * The body is always 256k + 6 bytes long (the internal deflation + * buffer is exactly 256k). + */ + + for(n = 1024; n < (int)body_size; n += 1024) { + struct archive *a; + struct archive_entry *entry; + size_t used = 0; + const void *pv; + size_t s; + int64_t o; + + memset(body, 255, body_size); + body[n] = 1; + + /* Write an archive with a single entry of n bytes. */ + assert((a = archive_write_new()) != NULL); + assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, buff_size, &used)); + + entry = archive_entry_new2(a); + archive_entry_set_pathname(entry, "test"); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_size(entry, 262150); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry)); + archive_entry_free(entry); + assertEqualInt(262150, archive_write_data(a, body, 262150)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Read back the entry and verify the contents. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 17)); + assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry)); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(262144, s); + assertEqualInt(0, o); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(6, s); + assertEqualInt(262144, o); + + assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); + + assertEqualInt(ARCHIVE_OK, archive_free(a)); + } + + free(body); + free(body_read); + free(buff); +} diff --git a/libarchive/test/test_read_format_zip_high_compression.zip.uu b/libarchive/test/test_read_format_zip_high_compression.zip.uu new file mode 100644 index 0000000..0942880 --- /dev/null +++ b/libarchive/test/test_read_format_zip_high_compression.zip.uu @@ -0,0 +1,18 @@ +begin 644 test_read_format_zip_high_compression.zip +M4$L#!!0`"``(`*=Y]4@``````````*``!``(`"``8VAA +MD5>>))%7GB215W5X"P`!!/8!```$%````.W=06K#,!`%T&E)P8LL?*2XC@N% +M)#5QO>AM@9WDJ6!%\6$K/Q6T3LAX]N/GQ'Z9G&KA^*K1'S +M.`[GOIM*[TP_Q_>O0[G_:3X.Y\^^V/X2<>))%7=7@+``$$]@$```04````4$L%!@`````!``$`5@````L"```` +!```` +` +end diff --git a/libarchive/test/test_read_set_format.c b/libarchive/test/test_read_set_format.c index 9208833..fb5e004 100644 --- a/libarchive/test/test_read_set_format.c +++ b/libarchive/test/test_read_set_format.c @@ -133,11 +133,12 @@ DEFINE_TEST(test_read_append_filter) assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); r = archive_read_append_filter(a, ARCHIVE_FILTER_GZIP); - if (r == ARCHIVE_WARN && !canGzip()) { - skipping("gzip reading not fully supported on this platform"); + if (r != ARCHIVE_OK && archive_zlib_version() == NULL && !canGzip()) { + skipping("gzip tests require zlib or working gzip command"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); return; } + assertEqualIntA(a, ARCHIVE_OK, r); assertEqualInt(ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -200,14 +201,28 @@ DEFINE_TEST(test_read_append_filter_wrong_program) { struct archive_entry *ae; struct archive *a; +#if !defined(_WIN32) || defined(__CYGWIN__) + FILE * fp; + int fd; + fpos_t pos; +#endif /* * If we have "bunzip2 -q", try using that. */ - if (!canRunCommand("bunzip2 -V")) { + if (!canRunCommand("bunzip2 -h")) { skipping("Can't run bunzip2 program on this platform"); return; } + +#if !defined(_WIN32) || defined(__CYGWIN__) + /* bunzip2 will write to stderr, redirect it to a file */ + fflush(stderr); + fgetpos(stderr, &pos); + fd = dup(fileno(stderr)); + fp = freopen("stderr1", "w", stderr); +#endif + assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); assertEqualIntA(a, ARCHIVE_OK, @@ -217,4 +232,16 @@ DEFINE_TEST(test_read_append_filter_wrong_program) assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN)); assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + +#if !defined(_WIN32) || defined(__CYGWIN__) + /* restore stderr and verify results */ + if (fp != NULL) { + fflush(stderr); + dup2(fd, fileno(stderr)); + close(fd); + clearerr(stderr); + fsetpos(stderr, &pos); + } + assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1"); +#endif } diff --git a/libarchive/test/test_write_disk_secure744.c b/libarchive/test/test_write_disk_secure744.c new file mode 100644 index 0000000..08c725e --- /dev/null +++ b/libarchive/test/test_write_disk_secure744.c @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2003-2007,2016 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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #744 describes a bug in the sandboxing code that + * causes very long pathnames to not get checked for symlinks. + */ + +DEFINE_TEST(test_write_disk_secure744) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + size_t buff_size = 8192; + char *buff = malloc(buff_size); + char *p = buff; + int n = 0; + int t; + + assert(buff != NULL); + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + while (p + 500 < buff + buff_size) { + memset(p, 'x', 100); + p += 100; + p[0] = '\0'; + + buff[0] = ((n / 1000) % 10) + '0'; + buff[1] = ((n / 100) % 10)+ '0'; + buff[2] = ((n / 10) % 10)+ '0'; + buff[3] = ((n / 1) % 10)+ '0'; + buff[4] = '_'; + ++n; + + /* Create a symlink pointing to the testworkdir */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, buff); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_copy_symlink(ae, testworkdir); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + *p++ = '/'; + sprintf(p, "target%d", n); + + /* Try to create a file through the symlink, should fail. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, buff); + archive_entry_set_mode(ae, S_IFDIR | 0777); + + t = archive_write_header(a, ae); + archive_entry_free(ae); + failure("Attempt to create target%d via %d-character symlink should have failed", n, (int)strlen(buff)); + if(!assertEqualInt(ARCHIVE_FAILED, t)) { + break; + } + } + archive_free(a); + free(buff); +#endif +} diff --git a/libarchive/test/test_write_disk_secure745.c b/libarchive/test/test_write_disk_secure745.c new file mode 100644 index 0000000..870b064 --- /dev/null +++ b/libarchive/test/test_write_disk_secure745.c @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2003-2007,2016 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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #745 describes a bug in the sandboxing code that + * allows one to use a symlink to edit the permissions on a file or + * directory outside of the sandbox. + */ + +DEFINE_TEST(test_write_disk_secure745) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + /* The target dir: The one we're going to try to change permission on */ + assertMakeDir("target", 0700); + + /* The sandbox dir we're going to run inside of. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create a symlink pointing to the target directory */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "sym"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_copy_symlink(ae, "../target"); + assert(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Try to alter the target dir through the symlink; this should fail. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "sym"); + archive_entry_set_mode(ae, S_IFDIR | 0777); + assert(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Permission of target dir should not have changed. */ + assertFileMode("../target", 0700); + + assert(0 == archive_write_close(a)); + archive_write_free(a); +#endif +} diff --git a/libarchive/test/test_write_disk_secure746.c b/libarchive/test/test_write_disk_secure746.c new file mode 100644 index 0000000..460aafe --- /dev/null +++ b/libarchive/test/test_write_disk_secure746.c @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2003-2007,2016 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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #746 describes a problem in which hardlink targets are + * not adequately checked and can be used to modify entries outside of + * the sandbox. + */ + +/* + * Verify that ARCHIVE_EXTRACT_SECURE_NODOTDOT disallows '..' in hardlink + * targets. + */ +DEFINE_TEST(test_write_disk_secure746a) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* The target directory we're going to try to affect. */ + assertMakeDir("target", 0700); + assertMakeFile("target/foo", 0700, "unmodified"); + + /* The sandbox dir we're going to work within. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NODOTDOT); + + /* Attempt to hardlink to the target directory. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "bar"); + archive_entry_set_mode(ae, AE_IFREG | 0777); + archive_entry_set_size(ae, 8); + archive_entry_copy_hardlink(ae, "../target/foo"); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + assertEqualInt(ARCHIVE_FATAL, archive_write_data(a, "modified", 8)); + archive_entry_free(ae); + + /* Verify that target file contents are unchanged. */ + assertTextFileContents("unmodified", "../target/foo"); +#endif +} + +/* + * Verify that ARCHIVE_EXTRACT_SECURE_NOSYMLINK disallows symlinks in hardlink + * targets. + */ +DEFINE_TEST(test_write_disk_secure746b) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* The target directory we're going to try to affect. */ + assertMakeDir("target", 0700); + assertMakeFile("target/foo", 0700, "unmodified"); + + /* The sandbox dir we're going to work within. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + /* Create a symlink to the target directory. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "symlink"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_copy_symlink(ae, "../target"); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Attempt to hardlink to the target directory via the symlink. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "bar"); + archive_entry_set_mode(ae, AE_IFREG | 0777); + archive_entry_set_size(ae, 8); + archive_entry_copy_hardlink(ae, "symlink/foo"); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_write_data(a, "modified", 8)); + archive_entry_free(ae); + + /* Verify that target file contents are unchanged. */ + assertTextFileContents("unmodified", "../target/foo"); + + assertEqualIntA(a, ARCHIVE_FATAL, archive_write_close(a)); + archive_write_free(a); +#endif +} diff --git a/libarchive/test/test_write_format_gnutar_filenames.c b/libarchive/test/test_write_format_gnutar_filenames.c index 38b4ca9..655e998 100644 --- a/libarchive/test/test_write_format_gnutar_filenames.c +++ b/libarchive/test/test_write_format_gnutar_filenames.c @@ -42,6 +42,7 @@ DEFINE_TEST(test_write_format_gnutar_filenames) struct archive_entry *ae, *template; struct archive *a; size_t used; + int i; buff = malloc(buffsize); /* million bytes of work area */ assert(buff != NULL); @@ -55,7 +56,7 @@ DEFINE_TEST(test_write_format_gnutar_filenames) archive_entry_set_mode(template, S_IFREG | 0755); archive_entry_set_size(template, 8); - for (int i = 0; i < 2000; ++i) { + for (i = 0; i < 2000; ++i) { filename[i] = 'a'; filename[i + 1] = '\0'; archive_entry_copy_pathname(template, filename); @@ -97,6 +98,11 @@ DEFINE_TEST(test_write_format_gnutar_linknames) struct archive_entry *ae, *template; struct archive *a; size_t used; + int i; + +#ifdef S_IFLNK + assertEqualInt(S_IFLNK, AE_IFLNK); +#endif buff = malloc(buffsize); /* million bytes of work area */ assert(buff != NULL); @@ -107,10 +113,10 @@ DEFINE_TEST(test_write_format_gnutar_linknames) archive_entry_set_birthtime(template, 3, 30); archive_entry_set_ctime(template, 4, 40); archive_entry_set_mtime(template, 5, 50); - archive_entry_set_mode(template, S_IFLNK | 0755); + archive_entry_set_mode(template, AE_IFLNK | 0755); archive_entry_copy_pathname(template, "link"); - for (int i = 0; i < 2000; ++i) { + for (i = 0; i < 2000; ++i) { filename[i] = 'a'; filename[i + 1] = '\0'; archive_entry_copy_symlink(template, filename); diff --git a/libarchive/test/test_write_format_iso9660.c b/libarchive/test/test_write_format_iso9660.c index 1ea69a1..ee6db6f 100644 --- a/libarchive/test/test_write_format_iso9660.c +++ b/libarchive/test/test_write_format_iso9660.c @@ -117,8 +117,8 @@ DEFINE_TEST(test_write_format_iso9660) */ dirname[0] = '\0'; strcpy(dir, "/dir0"); - for (i = 0; i < 10; i++) { - dir[4] = '0' + i; + for (i = 0; i < 13; i++) { + dir[4] = "0123456789ABCDEF"[i]; if (i == 0) strcat(dirname, dir+1); else @@ -134,6 +134,19 @@ DEFINE_TEST(test_write_format_iso9660) archive_entry_free(ae); } + strcat(dirname, "/file"); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 20); + archive_entry_set_birthtime(ae, 3, 30); + archive_entry_set_ctime(ae, 4, 40); + archive_entry_set_mtime(ae, 5, 50); + archive_entry_copy_pathname(ae, dirname); + archive_entry_set_mode(ae, S_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9)); + /* * "dir0/dir1/file1" has 8 bytes of data. */ @@ -333,6 +346,45 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -386,6 +438,21 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", archive_entry_pathname(ae)); + assert((AE_IFREG | 0555) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -580,29 +647,65 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "hardlnk" + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "file" + * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("file", archive_entry_pathname(ae)); - assertEqualString("hardlnk", archive_entry_hardlink(ae)); + assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); @@ -625,6 +728,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -746,6 +865,42 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "rr_moved/dir7/dir8/dir9/dira" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dira/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "dir0" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -827,33 +982,35 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "file" + * Read "hardlink" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "hardlink" + * Read "file" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("HARDLNK", archive_entry_pathname(ae)); - assertEqualString("FILE", archive_entry_hardlink(ae)); + assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); + /* * Read longname */ @@ -871,6 +1028,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC/FILE", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c index 1eae0b8..8c38ad7 100644 --- a/libarchive_fe/passphrase.c +++ b/libarchive_fe/passphrase.c @@ -121,16 +121,21 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) #else /* _WIN32 && !__CYGWIN__ */ -#include -#include +#include #include #include #ifdef HAVE_PATHS_H #include #endif +#include #include +#include #include +#ifndef _PATH_TTY +#define _PATH_TTY "/dev/tty" +#endif + #ifdef TCSASOFT # define _T_FLUSH (TCSAFLUSH|TCSASOFT) #else @@ -142,11 +147,18 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) # define _POSIX_VDISABLE VDISABLE #endif -static volatile sig_atomic_t *signo; +#define M(a,b) (a > b ? a : b) +#define MAX_SIGNO M(M(M(SIGALRM, SIGHUP), \ + M(SIGINT, SIGPIPE)), \ + M(M(SIGQUIT, SIGTERM), \ + M(M(SIGTSTP, SIGTTIN), SIGTTOU))) + +static volatile sig_atomic_t signo[MAX_SIGNO + 1]; static void handler(int s) { + assert(s <= MAX_SIGNO); signo[s] = 1; } @@ -166,12 +178,8 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) return(NULL); } - if (signo == NULL) { - signo = calloc(SIGRTMAX, sizeof(sig_atomic_t)); - } - restart: - for (i = 0; i < SIGRTMAX; i++) + for (i = 0; i <= MAX_SIGNO; i++) signo[i] = 0; nr = -1; save_errno = 0; @@ -198,6 +206,7 @@ restart: sigemptyset(&sa.sa_mask); sa.sa_flags = 0; /* don't restart system calls */ sa.sa_handler = handler; + /* Keep this list in sync with MAX_SIGNO! */ (void)sigaction(SIGALRM, &sa, &savealrm); (void)sigaction(SIGHUP, &sa, &savehup); (void)sigaction(SIGINT, &sa, &saveint); @@ -237,11 +246,11 @@ restart: if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; - if (isalpha(ch)) { + if (isalpha((unsigned char)ch)) { if ((flags & RPP_FORCELOWER)) - ch = (char)tolower(ch); + ch = (char)tolower((unsigned char)ch); if ((flags & RPP_FORCEUPPER)) - ch = (char)toupper(ch); + ch = (char)toupper((unsigned char)ch); } *p++ = ch; } @@ -276,7 +285,7 @@ restart: * If we were interrupted by a signal, resend it to ourselves * now that we have restored the signal handlers. */ - for (i = 0; i < SIGRTMAX; i++) { + for (i = 0; i <= MAX_SIGNO; i++) { if (signo[i]) { kill(getpid(), i); switch (i) { diff --git a/tar/cmdline.c b/tar/cmdline.c index fd0712a..c87741c 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -68,6 +68,7 @@ static const struct bsdtar_option { { "auto-compress", 0, 'a' }, { "b64encode", 0, OPTION_B64ENCODE }, { "block-size", 1, 'b' }, + { "blocking-factor", 1, 'b' }, { "bunzip2", 0, 'j' }, { "bzip", 0, 'j' }, { "bzip2", 0, 'j' }, diff --git a/tar/subst.c b/tar/subst.c index 4710e06..39c54ac 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -84,6 +84,7 @@ add_substitution(struct bsdtar *bsdtar, const char *rule_text) if (rule == NULL) lafe_errc(1, errno, "Out of memory"); rule->next = NULL; + rule->result = NULL; if (subst->last_rule == NULL) subst->first_rule = rule; diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt index f19a5f6..0d2da36 100644 --- a/tar/test/CMakeLists.txt +++ b/tar/test/CMakeLists.txt @@ -100,7 +100,8 @@ IF(ENABLE_TAR AND ENABLE_TEST) # Experimental new test handling ADD_CUSTOM_TARGET(run_bsdtar_test COMMAND bsdtar_test -p $ - -r ${CMAKE_CURRENT_SOURCE_DIR}) + -r ${CMAKE_CURRENT_SOURCE_DIR} + -vv) ADD_DEPENDENCIES(run_bsdtar_test bsdtar) ADD_DEPENDENCIES(run_all_tests run_bsdtar_test) diff --git a/tar/test/main.c b/tar/test/main.c index 08ac627..d35d335 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -130,6 +130,13 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1157,6 +1164,35 @@ assertion_file_contains_lines_any_order(const char *file, int line, return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1294,6 +1330,11 @@ assertion_file_time(const char *file, int line, switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1361,6 +1402,33 @@ assertion_file_birthtime_recent(const char *file, int line, return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1400,7 +1468,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1579,8 +1647,12 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode) if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1629,6 +1701,12 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + close(fd); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1641,10 +1719,12 @@ assertion_make_file(const char *file, int line, failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } diff --git a/tar/test/test.h b/tar/test/test.h index 704a137..3a23a05 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,8 +244,10 @@ int assertion_file_atime_recent(const char *, int, const char *); int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); @@ -326,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; diff --git a/tar/test/test_missing_file.c b/tar/test/test_missing_file.c index e2e5da5..808e384 100644 --- a/tar/test/test_missing_file.c +++ b/tar/test/test_missing_file.c @@ -27,11 +27,15 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_missing_file) { + const char * invalid_stderr[] = { "INTERNAL ERROR", NULL }; assertMakeFile("file1", 0644, "file1"); assertMakeFile("file2", 0644, "file2"); assert(0 == systemf("%s -cf archive.tar file1 file2 2>stderr1", testprog)); assertEmptyFile("stderr1"); assert(0 != systemf("%s -cf archive.tar file1 file2 file3 2>stderr2", testprog)); + assertFileContainsNoInvalidStrings("stderr2", invalid_stderr); assert(0 != systemf("%s -cf archive.tar 2>stderr3", testprog)); - assert(0 != systemf("%s -cf archive.tar file3 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr3", invalid_stderr); + assert(0 != systemf("%s -cf archive.tar file3 file4 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr4", invalid_stderr); } diff --git a/tar/test/test_option_H_upper.c b/tar/test/test_option_H_upper.c index 7ddd917..adc294b 100644 --- a/tar/test/test_option_H_upper.c +++ b/tar/test/test_option_H_upper.c @@ -83,10 +83,10 @@ DEFINE_TEST(test_option_H_upper) assertChdir("test3"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); + assertIsDir("ld1", umasked(0755)); assertIsSymlink("d1/linkX", "fileX"); assertIsSymlink("d1/link1", "file1"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); } diff --git a/tar/test/test_option_L_upper.c b/tar/test/test_option_L_upper.c index 57abe41..f5a3c5a 100644 --- a/tar/test/test_option_L_upper.c +++ b/tar/test/test_option_L_upper.c @@ -69,10 +69,10 @@ DEFINE_TEST(test_option_L_upper) assertChdir("test2"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); - assertIsReg("d1/link1", 0644); + assertIsDir("ld1", umasked(0755)); + assertIsReg("d1/link1", umasked(0644)); assertIsSymlink("d1/linkX", "fileX"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); @@ -83,10 +83,10 @@ DEFINE_TEST(test_option_L_upper) assertChdir("test3"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); - assertIsReg("d1/link1", 0644); + assertIsDir("ld1", umasked(0755)); + assertIsReg("d1/link1", umasked(0644)); assertIsSymlink("d1/linkX", "fileX"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); } diff --git a/tar/test/test_option_U_upper.c b/tar/test/test_option_U_upper.c index 4d77cb0..2c43e00 100644 --- a/tar/test/test_option_U_upper.c +++ b/tar/test/test_option_U_upper.c @@ -135,7 +135,7 @@ DEFINE_TEST(test_option_U_upper) assertMakeSymlink("d1/file1", "d1/realfile1"); assertEqualInt(0, systemf("%s -xf ../archive.tar d1/file1 >test.out 2>test.err", testprog)); - assertIsReg("d1/file1", 0644); + assertIsReg("d1/file1", umasked(0644)); assertFileContents("d1/file1", 8, "d1/file1"); assertFileContents("realfile1", 9, "d1/realfile1"); assertEmptyFile("test.out"); @@ -150,7 +150,7 @@ DEFINE_TEST(test_option_U_upper) assertMakeSymlink("d1/file1", "d1/realfile1"); assertEqualInt(0, systemf("%s -xPUf ../archive.tar d1/file1 >test.out 2>test.err", testprog)); - assertIsReg("d1/file1", 0644); + assertIsReg("d1/file1", umasked(0644)); assertFileContents("d1/file1", 8, "d1/file1"); assertFileContents("realfile1", 9, "d1/realfile1"); assertEmptyFile("test.out"); diff --git a/tar/test/test_option_b.c b/tar/test/test_option_b.c index 81f50be..7c2f604 100644 --- a/tar/test/test_option_b.c +++ b/tar/test/test_option_b.c @@ -33,7 +33,7 @@ DEFINE_TEST(test_option_b) assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { - skipping("Platform doesn't have cat"); + skipping("This test requires a `cat` program"); return; } testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1); diff --git a/tar/test/test_option_n.c b/tar/test/test_option_n.c index 4017dd9..18ab614 100644 --- a/tar/test/test_option_n.c +++ b/tar/test/test_option_n.c @@ -55,7 +55,7 @@ DEFINE_TEST(test_option_n) systemf("%s -xf archive.tar >x.out 2>x.err", testprog)); assertEmptyFile("x.out"); assertEmptyFile("x.err"); - assertIsDir("d1", 0755); + assertIsDir("d1", umasked(0755)); assertFileNotExists("d1/file1"); assertChdir(".."); } diff --git a/tar/test/test_symlink_dir.c b/tar/test/test_symlink_dir.c index f6e9966..25bd8b1 100644 --- a/tar/test/test_symlink_dir.c +++ b/tar/test/test_symlink_dir.c @@ -63,7 +63,7 @@ DEFINE_TEST(test_symlink_dir) /* "dir2" is a symlink to a non-existing "real_dir2" */ assertMakeSymlink("dest1/dir2", "real_dir2"); } else { - skipping("some symlink checks"); + skipping("Symlinks are not supported on this platform"); } /* "dir3" is a symlink to an existing "non_dir3" */ assertMakeFile("dest1/non_dir3", 0755, "abcdef"); diff --git a/tar/test/test_version.c b/tar/test/test_version.c index 5474261..04d9e6c 100644 --- a/tar/test/test_version.c +++ b/tar/test/test_version.c @@ -88,7 +88,7 @@ DEFINE_TEST(test_version) if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; /* Skip arbitrary third-party version numbers. */ - while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { ++q; --s; } diff --git a/tar/util.c b/tar/util.c index 9ff22f2..2b4aebe 100644 --- a/tar/util.c +++ b/tar/util.c @@ -182,7 +182,7 @@ safe_fprintf(FILE *f, const char *fmt, ...) } /* If our output buffer is full, dump it and keep going. */ - if (i > (sizeof(outbuff) - 20)) { + if (i > (sizeof(outbuff) - 128)) { outbuff[i] = '\0'; fprintf(f, "%s", outbuff); i = 0; diff --git a/tar/write.c b/tar/write.c index 2d076f4..da5a128 100644 --- a/tar/write.c +++ b/tar/write.c @@ -886,6 +886,8 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) "%s", archive_error_string(disk)); if (r == ARCHIVE_FATAL || r == ARCHIVE_FAILED) { bsdtar->return_value = 1; + archive_entry_free(entry); + archive_read_close(disk); return; } else if (r < ARCHIVE_WARN) continue; -- 2.7.4