early-access version 1255

This commit is contained in:
pineappleEA
2020-12-28 15:15:37 +00:00
parent 84b39492d1
commit 78b48028e1
6254 changed files with 1868140 additions and 0 deletions
+219
View File
@@ -0,0 +1,219 @@
CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
IF(NOT HAVE_GETOPT)
SET(SRC_EXTRA_FILES ../src/getopt.c)
ENDIF()
SET(TEST_PROGRAMS
add_from_filep
fopen_unchanged
fseek
nonrandomopentest
)
SET(GETOPT_USERS
fread
tryopen
)
ADD_EXECUTABLE(can_clone_file can_clone_file.c)
SET(ENV{srcdir} ${CMAKE_CURRENT_SOURCE_DIR})
FOREACH(PROGRAM ${TEST_PROGRAMS})
ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}.c)
TARGET_LINK_LIBRARIES(${PROGRAM} zip)
ENDFOREACH()
ADD_EXECUTABLE(hole hole.c ${SRC_EXTRA_FILES} source_hole.c)
TARGET_LINK_LIBRARIES(hole zip)
ADD_EXECUTABLE(ziptool_regress ziptool_regress.c ${SRC_EXTRA_FILES} source_hole.c)
TARGET_LINK_LIBRARIES(ziptool_regress zip)
#ADD_LIBRARY(malloc MODULE malloc.c)
#TARGET_LINK_LIBRARIES(malloc ${CMAKE_DL_LIBS})
ADD_LIBRARY(nonrandomopen MODULE nonrandomopen.c)
TARGET_LINK_LIBRARIES(nonrandomopen ${CMAKE_DL_LIBS})
FOREACH(PROGRAM ${GETOPT_USERS})
ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}.c ${SRC_EXTRA_FILES})
TARGET_LINK_LIBRARIES(${PROGRAM} zip)
ENDFOREACH()
# for appveyor builds
#SET(CMAKE_MSVCIDE_RUN_PATH C:/projects/libzip/vstudio/zlib/installed/bin;C:/projects/libzip/vstudio/zlib/installed/lib;C:/projects/libzip/build/lib/Release)
ADD_CUSTOM_TARGET(cleanup
COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cleanup.cmake
)
ADD_CUSTOM_TARGET(testinput
ALL
VERBATIM
COMMAND cmake -E tar x ${CMAKE_CURRENT_SOURCE_DIR}/manyfiles-zip.zip
COMMAND cmake -E tar x ${CMAKE_CURRENT_SOURCE_DIR}/bigzero-zip.zip
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manyfiles-zip.zip ${CMAKE_CURRENT_SOURCE_DIR}/bigzero-zip.zip
)
SET_PROPERTY(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
bigzero.zip
manyfiles-133000.zip
manyfiles-65536.zip
manyfiles-fewer.zip
manyfiles-more.zip
manyfiles-zip64-modulo.zip
manyfiles-zip64.zip
manyfiles.zip
)
SET(EXTRA_TESTS
add_dir.test
add_from_buffer.test
add_from_file.test
add_from_file_duplicate.test
add_from_file_twice_duplicate.test
add_from_filep.test
add_from_stdin.test
add_from_zip_closed.test
add_from_zip_deflated.test
add_from_zip_deflated2.test
add_from_zip_partial_deflated.test
add_from_zip_partial_stored.test
add_from_zip_stored.test
add_stored.test
add_stored_in_memory.test
buffer-fragment-read.test
buffer-fragment-write.test
clone-buffer-add.test
clone-buffer-delete.test
clone-buffer-replace.test
clone-fs-add.test
clone-fs-delete.test
clone-fs-replace.test
cm-default.test
count_entries.test
decrypt-correct-password-aes128.test
decrypt-correct-password-aes192.test
decrypt-correct-password-aes256.test
decrypt-correct-password-pkware.test
decrypt-no-password-aes256.test
decrypt-wrong-password-aes128.test
decrypt-wrong-password-aes192.test
decrypt-wrong-password-aes256.test
decrypt-wrong-password-pkware.test
delete_add_same.test
delete_invalid.test
delete_last.test
delete_multiple_last.test
delete_multiple_partial.test
delete_renamed_rename.test
encrypt.test
encryption-nonrandom-aes128.test
encryption-nonrandom-aes192.test
encryption-nonrandom-aes256.test
encryption-remove.test
extra_add.test
extra_add_multiple.test
extra_count.test
extra_count_by_id.test
extra_count_ignore_zip64.test
extra_delete.test
extra_delete_by_id.test
extra_field_align.test
extra_get.test
extra_get_by_id.test
extra_set.test
extra_set_modify_c.test
extra_set_modify_l.test
fdopen_ok.test
file_comment_encmismatch.test
fopen_unchanged.test
fread.test
fseek_deflated.test
fseek_fail.test
fseek_ok.test
get_comment.test
junk_at_end.test
junk_at_start.test
name_locate.test
open_cons_extrabytes.test
open_empty.test
open_empty_2.test
open_extrabytes.test
open_file_count.test
open_filename_duplicate.test
open_filename_duplicate_consistency.test
open_filename_duplicate_empty.test
open_filename_duplicate_empty_consistency.test
open_filename_empty.test
open_incons.test
open_many_fail.test
open_many_ok.test
open_multidisk.test
open_new_but_exists.test
open_new_ok.test
open_nonarchive.test
open_nosuchfile.test
open_ok.test
open_too_short.test
open_truncate.test
open_zip64_3mf.test
open_zip64_ok.test
preload.test
progress.test
rename_ascii.test
rename_cp437.test
rename_deleted.test
rename_fail.test
rename_ok.test
rename_utf8.test
rename_utf8_encmismatch.test
set_comment_all.test
set_comment_localonly.test
set_comment_removeglobal.test
set_comment_revert.test
set_compression_bzip2_to_deflate.test
set_compression_deflate_to_bzip2.test
set_compression_deflate_to_deflate.test
set_compression_deflate_to_store.test
set_compression_store_to_bzip2.test
set_compression_store_to_deflate.test
set_compression_store_to_store.test
set_compression_store_to_xz.test
set_compression_unknown.test
set_compression_xz_to_store.test
stat_index_cp437_guess.test
stat_index_cp437_raw.test
stat_index_cp437_strict.test
stat_index_fileorder.test
stat_index_streamed.test
stat_index_streamed_zip64.test
stat_index_utf8_guess.test
stat_index_utf8_raw.test
stat_index_utf8_strict.test
stat_index_utf8_unmarked_strict.test
stat_index_zip64.test
utf-8-standardization.test
zip-in-archive-comment.test
zip64_creation.test
zip64_stored_creation.test
)
set(path "$<TARGET_FILE_DIR:zip>;$ENV{PATH}")
if (TARGET zlib)
set(path "$<TARGET_FILE_DIR:zlib>;${path}")
endif()
string(REPLACE ";" "\\;" path "${path}")
FOREACH(CASE ${EXTRA_TESTS})
ADD_TEST(NAME ${CASE} COMMAND perl ${CMAKE_CURRENT_BINARY_DIR}/runtest ${CMAKE_CURRENT_SOURCE_DIR}/${CASE})
SET_TESTS_PROPERTIES(${CASE} PROPERTIES SKIP_RETURN_CODE 77)
SET_TESTS_PROPERTIES(${CASE} PROPERTIES ENVIRONMENT "PATH=${path}")
ENDFOREACH()
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/..)
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
ADD_EXECUTABLE(fuzz_main fuzz_main.c)
TARGET_LINK_LIBRARIES(fuzz_main zip)
+1448
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
# add directories to zip
return 0
args testdir.zip add_dir testdir/ add_dir testdir-noslash
file-new testdir.zip testdir.zip
+4
View File
@@ -0,0 +1,4 @@
# add buffer contents as file to zip
return 0
args testbuffer.zip add teststring.txt "This is a test, and it seems to have been successful.\n"
file-new testbuffer.zip testbuffer.zip
+5
View File
@@ -0,0 +1,5 @@
# add file to zip
return 0
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
file-new testfile.zip testfile.zip
+6
View File
@@ -0,0 +1,6 @@
# add already existing file to zip, making duplicate names
return 1
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
file testfile.zip testfile.zip testfile.zip
stderr can't add file 'testfile.txt': File already exists
+6
View File
@@ -0,0 +1,6 @@
# add file to zip twice, making duplicate names
return 1
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
file-new testfile.zip testfile.zip
stderr can't add file 'testfile.txt': File already exists
+97
View File
@@ -0,0 +1,97 @@
/*
add_from_filep.c -- test case for adding file to archive
Copyright (C) 1999-2018 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
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.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zip.h"
static const char *prg;
int
main(int argc, char *argv[]) {
const char *archive;
const char *file;
const char *name;
zip_t *za;
zip_source_t *zs;
int err;
FILE *fp;
prg = argv[0];
if (argc != 3) {
fprintf(stderr, "usage: %s archive file\n", prg);
return 1;
}
archive = argv[1];
file = argv[2];
if ((za = zip_open(archive, ZIP_CREATE, &err)) == NULL) {
zip_error_t error;
zip_error_init_with_code(&error, err);
fprintf(stderr, "%s: can't open zip archive '%s': %s\n", prg, archive, zip_error_strerror(&error));
zip_error_fini(&error);
return 1;
}
if ((fp = fopen(file, "r")) == NULL) {
fprintf(stderr, "%s: can't open input file '%s': %s\n", prg, file, strerror(errno));
return 1;
}
if ((zs = zip_source_filep(za, fp, 0, -1)) == NULL) {
fprintf(stderr, "%s: error creating file source for '%s': %s\n", prg, file, zip_strerror(za));
return 1;
}
if ((name = strrchr(file, '/')) == NULL)
name = file;
if (zip_add(za, name, zs) == -1) {
zip_source_free(zs);
fprintf(stderr, "%s: can't add file '%s': %s\n", prg, file, zip_strerror(za));
return 1;
}
if (zip_close(za) == -1) {
fprintf(stderr, "%s: can't close zip archive '%s': %s\n", prg, archive, zip_strerror(za));
return 1;
}
return 0;
}
+6
View File
@@ -0,0 +1,6 @@
# add file to zip
program add_from_filep
return 0
args testfile.zip testfile.txt
file testfile.txt testfile.txt testfile.txt
file-new testfile.zip testfile.zip
+5
View File
@@ -0,0 +1,5 @@
# add stdin to zip
pipein echo This is a test, and it seems to have been successful.
args -- teststdin.zip add_file teststring.txt /dev/stdin 0 -1
return 0
file-new teststdin.zip teststdin.zip
+5
View File
@@ -0,0 +1,5 @@
# add deflated file from zip to zip, but close the source before it can be read
return 1
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 zin_close 0
file testdeflated.zzip testdeflated.zip testdeflated.zip
stderr can't close zip archive 'testfile.zip': Containing zip archive was closed
+5
View File
@@ -0,0 +1,5 @@
# add deflated file from zip to zip
return 0
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1
file testdeflated.zzip testdeflated.zip testdeflated.zip
file-new testfile.zip testdeflated.zip
+5
View File
@@ -0,0 +1,5 @@
# add deflated files from zip to zip
return 0
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 add_from_zip abac-repeat2.txt testdeflated.zzip 0 0 -1
file testdeflated.zzip testdeflated.zip testdeflated.zip
file-new testfile.zip testdeflated2.zip
+5
View File
@@ -0,0 +1,5 @@
# add parts of a file from zip to zip
return 0
args -- testfile.zip add_from_zip first firstsecond.zzip 0 0 9 add_from_zip second firstsecond.zzip 0 9 -1
file firstsecond.zzip firstsecond.zip firstsecond.zip
file-new testfile.zip firstsecond-split-stored.zip
+5
View File
@@ -0,0 +1,5 @@
# add parts of a file from zip to zip
return 0
args -- testfile.zip add_from_zip first firstsecond.zzip 1 0 9 add_from_zip second firstsecond.zzip 1 9 -1
file firstsecond.zzip firstsecond.zip firstsecond.zip
file-new testfile.zip firstsecond-split-stored.zip
+5
View File
@@ -0,0 +1,5 @@
# add stored file from zip to zip
return 0
args -- testfile.zip add_from_zip abac-repeat.txt teststored.zzip 0 0 -1
file teststored.zzip teststored.zip teststored.zip
file-new testfile.zip testdeflated.zip
+4
View File
@@ -0,0 +1,4 @@
# add file, set compression method to ZIP_CM_STORE
return 0
args -n test.zip add foo foo set_file_compression 0 store 0
file-new test.zip foo-stored.zip
+4
View File
@@ -0,0 +1,4 @@
# add file, set compression method to ZIP_CM_STORE
return 0
args -mn test.zip add foo foo set_file_compression 0 store 0
file-new test.zip foo-stored.zip
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
bogus data
BIN
View File
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
# test reading from a buffer fragment source
return 0
args -mF 1024 test.zip cat 1
file test.zip cm-default.zip cm-default.zip
stdout uncompressable
+4
View File
@@ -0,0 +1,4 @@
# rename file inside zip archive
return 0
args -mF 100 rename.zip rename 1 notfile2
file rename.zip testcomment.zip rename_ok.zip
+124
View File
@@ -0,0 +1,124 @@
/*
can_clone_file.c -- does the current filesystem support cloning
Copyright (C) 1999-2018 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
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.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#ifdef HAVE_CLONEFILE
#include <sys/attr.h>
#include <sys/mount.h>
#include <sys/param.h>
#include <unistd.h>
#elif defined(HAVE_FICLONERANGE)
#include <linux/fs.h>
#include <sys/ioctl.h>
#include <unistd.h>
#endif
int
main(int argc, char *argv[]) {
#ifdef HAVE_CLONEFILE
struct statfs fs;
struct attrlist attribute_list;
struct {
uint32_t size;
vol_capabilities_attr_t capabilities;
} volume_attributes;
if (statfs(".", &fs) < 0) {
fprintf(stderr, "%s: can't get mount point of current directory: %s\n", argv[0], strerror(errno));
exit(1);
}
/* Not all volumes support clonefile(). A volume can be tested for
clonefile() support by using getattrlist(2) to get the volume
capabilities attribute ATTR_VOL_CAPABILITIES, and then testing the
VOL_CAP_INT_CLONE flag. */
memset(&attribute_list, 0, sizeof(attribute_list));
attribute_list.bitmapcount = ATTR_BIT_MAP_COUNT;
attribute_list.volattr = ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES;
memset(&volume_attributes, 0, sizeof(volume_attributes));
if (getattrlist(fs.f_mntonname, &attribute_list, &volume_attributes, sizeof(volume_attributes), 0) < 0) {
fprintf(stderr, "%s: can't get volume capabilities of '%s': %s\n", argv[0], fs.f_mntonname, strerror(errno));
exit(1);
}
if (volume_attributes.capabilities.capabilities[VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_CLONE) {
exit(0);
}
#elif defined(HAVE_FICLONERANGE)
char namea[32] = "a.fioclone.XXXXXX";
char nameb[32] = "b.fioclone.XXXXXX";
int fda, fdb, ret;
struct file_clone_range range;
if ((fda = mkstemp(namea)) < 0) {
fprintf(stderr, "can't create temp file a: %s\n", strerror(errno));
exit(1);
}
if ((fdb = mkstemp(nameb)) < 0) {
fprintf(stderr, "can't create temp file b: %s\n", strerror(errno));
(void)close(fda);
(void)remove(namea);
exit(1);
}
if (write(fda, "test\n", 5) < 0) {
fprintf(stderr, "can't write temp file a: %s\n", strerror(errno));
(void)close(fda);
(void)remove(namea);
close(fdb);
(void)remove(nameb);
exit(1);
}
range.src_fd = fda;
range.src_offset = 0;
range.src_length = 0;
range.dest_offset = 0;
ret = ioctl(fdb, FICLONERANGE, &range);
(void)close(fda);
(void)close(fdb);
(void)remove(namea);
(void)remove(nameb);
if (ret >= 0) {
exit(0);
}
#endif
exit(1);
}
+7
View File
@@ -0,0 +1,7 @@
# expect variable DIR
FILE(GLOB CLEANDIRS "${DIR}/sandbox-*.d[0-9]*")
IF (CLEANDIRS)
MESSAGE(STATUS "Removing ${CLEANDIRS}")
FILE(REMOVE_RECURSE ${CLEANDIRS})
ENDIF()
+4
View File
@@ -0,0 +1,4 @@
# test cloning archive from buffer, add new file
return 0
args -mF 100 test.zzip add new "A new file." set_file_mtime 3 1512998132
file test.zzip gap.zip gap-add.zip
+4
View File
@@ -0,0 +1,4 @@
# test cloning archive from buffer, deleteing a file
return 0
args -mF 100 test.zzip delete 2
file test.zzip gap.zip gap-delete.zip
+4
View File
@@ -0,0 +1,4 @@
# test cloning archive from buffer, replacing a file
return 0
args -mF 100 test.zzip replace_file_contents 2 "A changed file." set_file_mtime 2 1512998082
file test.zzip gap.zip gap-replace.zip
+5
View File
@@ -0,0 +1,5 @@
# test cloning archive from filesystem, add new file
precheck ./can_clone_file
return 0
args test.zzip add new "A new file." set_file_mtime 3 1512998132
file test.zzip gap.zip gap-add.zip
+5
View File
@@ -0,0 +1,5 @@
# test cloning archive from filesystem, deleteing a file
precheck ./can_clone_file
return 0
args test.zzip delete 2
file test.zzip gap.zip gap-delete.zip
+5
View File
@@ -0,0 +1,5 @@
# test cloning archive from filesystem, replacing a file
precheck ./can_clone_file
return 0
args test.zzip replace_file_contents 2 "A changed file." set_file_mtime 2 1512998082
file test.zzip gap.zip gap-replace.zip
+5
View File
@@ -0,0 +1,5 @@
# test default compression stores if smaller
return 0
args -n test.zip add compressable aaaaaaaaaaaaaa add uncompressable uncompressable add_nul large-compressable 8200 add_file large-uncompressable large-uncompressable 0 -1
file-new test.zip cm-default.zip
file large-uncompressable large-uncompressable large-uncompressable
BIN
View File
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
# zip_open: count entries for archive with >65k entries
args manyfiles.zip get_num_entries 0
return 0
file manyfiles.zip manyfiles.zip manyfiles.zip
stdout 70000 entries in archive
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using correct password
features CRYPTO
return 0
args encrypt.zzip set_password foofoofoo cat 1
file encrypt.zzip encrypt-aes128.zip encrypt-aes128.zip
stdout encrypted
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using correct password
features CRYPTO
return 0
args encrypt.zzip set_password foofoofoo cat 1
file encrypt.zzip encrypt-aes192.zip encrypt-aes192.zip
stdout encrypted
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using correct password
features CRYPTO
return 0
args encrypt.zzip set_password foofoofoo cat 1
file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip
stdout encrypted
+5
View File
@@ -0,0 +1,5 @@
# test decryption support, extract file using correct password
return 0
args encrypt.zzip set_password foo cat 0
file encrypt.zzip encrypt.zip encrypt.zip
stdout foo
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, no password provided
features CRYPTO
return 1
args encrypt.zzip cat 1
file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip
stderr can't open file at index '1': No password provided
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using wrong password
features CRYPTO
return 1
args encrypt.zzip set_password notfoonotfoo cat 1
file encrypt.zzip encrypt-aes128.zip encrypt-aes128.zip
stderr can't open file at index '1': Wrong password provided
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using wrong password
features CRYPTO
return 1
args encrypt.zzip set_password notfoonotfoo cat 1
file encrypt.zzip encrypt-aes192.zip encrypt-aes192.zip
stderr can't open file at index '1': Wrong password provided
+6
View File
@@ -0,0 +1,6 @@
# test AES decryption support, extract file using wrong password
features CRYPTO
return 1
args encrypt.zzip set_password notfoonotfoo cat 1
file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip
stderr can't open file at index '1': Wrong password provided
+5
View File
@@ -0,0 +1,5 @@
# test decryption support, extract file using wrong password
return 1
args encrypt.zzip set_password notfoo cat 0
file encrypt.zzip encrypt.zip encrypt.zip
stderr can't open file at index '0': Wrong password provided
+5
View File
@@ -0,0 +1,5 @@
# delete entry in zip archive then add file of same name
# time is now(), so use zipcmp
return 0
args testfile.zip delete 0 add testfile.txt test
file testfile.zip testfile.zip test2.zip
+5
View File
@@ -0,0 +1,5 @@
# delete last entry in zip archive
return 1
args testfile.zzip delete 5
file testfile.zzip testfile.zip testfile.zip
stderr can't delete file at index '5': Invalid argument
+4
View File
@@ -0,0 +1,4 @@
# delete last entry in zip archive
return 0
args testfile.zzip delete 0
file-del testfile.zzip testfile.zip
+4
View File
@@ -0,0 +1,4 @@
# delete multiple entries in zip archive, emptying it
return 0
args testfile.zzip delete 0 delete 1 delete 2 delete 3
file-del testfile.zzip testcomment.zip
+4
View File
@@ -0,0 +1,4 @@
# delete some entries in zip archive
return 0
args testfile.zip delete 1 delete 3
file testfile.zip testcomment.zip testcomment13.zip
+5
View File
@@ -0,0 +1,5 @@
# delete renamed entry in zip archive then rename file to same name
# file date is now(), so use zipcmp
return 0
args testfile.zip rename 0 something add test test delete 0 rename 1 testfile.txt
file testfile.zip testfile.zip test2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
# test encryption support
# TODO: only checks recognition of encrypted entries for now.
return 0
args encrypt.zzip stat 0 stat 1
file encrypt.zzip encrypt.zip encrypt.zip
stdout name: 'encrypted'
stdout index: '0'
stdout size: '4'
stdout compressed size: '16'
stdout mtime: 'Mon Apr 24 2006 16:01:34'
stdout crc: '7e3265a8'
stdout compression method: '0'
stdout encryption method: '1'
stdout
stdout name: 'plain'
stdout index: '1'
stdout size: '4'
stdout compressed size: '4'
stdout mtime: 'Mon Apr 24 2006 16:01:42'
stdout crc: '7e3265a8'
stdout compression method: '0'
stdout encryption method: '0'
stdout
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
features CRYPTO
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
args encrypt.zzip set_file_encryption 1 AES-128 no-entropy
file encrypt.zzip encrypt-none.zip encrypt-aes128-noentropy.zip
+6
View File
@@ -0,0 +1,6 @@
features CRYPTO
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
args encrypt.zzip set_file_encryption 1 AES-192 no-entropy
file encrypt.zzip encrypt-none.zip encrypt-aes192-noentropy.zip
+6
View File
@@ -0,0 +1,6 @@
features CRYPTO
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
args encrypt.zzip set_file_encryption 1 AES-256 no-entropy
file encrypt.zzip encrypt-none.zip encrypt-aes256-noentropy.zip
+5
View File
@@ -0,0 +1,5 @@
# test AES decryption support, remove encryption from file that has it
features CRYPTO
return 0
args encrypt.zzip set_password foofoofoo set_file_encryption 1 none ""
file encrypt.zzip encrypt-aes128.zip encrypt-none.zip
+7
View File
@@ -0,0 +1,7 @@
# add extra field
#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent
args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 0 l
return 0
file encrypt.zip encrypt.zip encrypt_plus_extra.zip
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
+8
View File
@@ -0,0 +1,8 @@
# add extra fields
args testfile.zip set_extra 0 2345 65535 cl extra1 set_extra 0 2345 65535 cl extra2 set_extra 0 2345 0 c extra1c set_extra 0 2345 1 l extra2l get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 1 c get_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 1 l
return 0
file testfile.zip testfile.zip testfile-plus-extra.zip
stdout Extra field 0x0929: len 7, data 0x65787472613163
stdout Extra field 0x0929: len 6, data 0x657874726132
stdout Extra field 0x0929: len 6, data 0x657874726131
stdout Extra field 0x0929: len 7, data 0x6578747261326c
+10
View File
@@ -0,0 +1,10 @@
# count extra fields for index
args encrypt.zip count_extra 0 l count_extra 0 c count_extra 0 lc count_extra 1 l count_extra 1 c count_extra 1 lc
return 0
file encrypt.zip encrypt.zip encrypt.zip
stdout Extra field count: 2
stdout Extra field count: 2
stdout Extra field count: 4
stdout Extra field count: 2
stdout Extra field count: 2
stdout Extra field count: 4
+22
View File
@@ -0,0 +1,22 @@
# count extra fields for index
args encrypt.zip count_extra_by_id 0 0 l count_extra_by_id 0 1 l count_extra_by_id 0 21589 l count_extra_by_id 0 30805 l count_extra_by_id 0 21844 l count_extra_by_id 0 12345 l count_extra_by_id 0 0 c count_extra_by_id 0 1 c count_extra_by_id 0 21589 c count_extra_by_id 0 30805 c count_extra_by_id 0 21844 c count_extra_by_id 0 12345 c count_extra_by_id 0 0 cl count_extra_by_id 0 1 cl count_extra_by_id 0 21589 cl count_extra_by_id 0 30805 cl count_extra_by_id 0 21844 cl count_extra_by_id 0 12345 cl
return 0
file encrypt.zip encrypt.zip encrypt.zip
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 1
stdout Extra field count: 1
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 1
stdout Extra field count: 1
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 2
stdout Extra field count: 2
stdout Extra field count: 0
stdout Extra field count: 0
+7
View File
@@ -0,0 +1,7 @@
# count extra fields for index
args bigzero.zip count_extra 0 l count_extra 0 c count_extra 0 lc
return 0
file bigzero.zip bigzero.zip bigzero.zip
stdout Extra field count: 0
stdout Extra field count: 0
stdout Extra field count: 0
+14
View File
@@ -0,0 +1,14 @@
# delete extra field by index
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l delete_extra 0 2 c delete_extra 0 0 l get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l
file encrypt.zip encrypt_plus_extra.zip encrypt.zip
return 0
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
+6
View File
@@ -0,0 +1,6 @@
# delete extra field by id and index
#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent
args encrypt.zip delete_extra_by_id 0 2345 0 c delete_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 0 c
return 1
file encrypt.zip encrypt_plus_extra.zip encrypt.zip
stderr can't get extra field data for file at index 0, extra field id 2345, ef index 0, flags 512: No such file
+32
View File
@@ -0,0 +1,32 @@
# try opening simulated Android APK zipaligned files, and similar inconsistent files
setenv LANG C
program tryopen
file extra_field_align_1-0.zzip extra_field_align_1-0.zip extra_field_align_1-0.zip
file extra_field_align_1-ff.zzip extra_field_align_1-ff.zip extra_field_align_1-ff.zip
file extra_field_align_2-0.zzip extra_field_align_2-0.zip extra_field_align_2-0.zip
file extra_field_align_2-ff.zzip extra_field_align_2-ff.zip extra_field_align_2-ff.zip
file extra_field_align_3-0.zzip extra_field_align_3-0.zip extra_field_align_3-0.zip
file extra_field_align_3-ff.zzip extra_field_align_3-ff.zip extra_field_align_3-ff.zip
file extra_field_align_4-ff.zzip extra_field_align_4-ff.zip extra_field_align_4-ff.zip
file extra_field_align_1-ef_00.zzip extra_field_align_1-ef_00.zip extra_field_align_1-ef_00.zip
file extra_field_align_1-ef_ff.zzip extra_field_align_1-ef_ff.zip extra_field_align_1-ef_ff.zip
file extra_field_align_2-ef_00.zzip extra_field_align_2-ef_00.zip extra_field_align_2-ef_00.zip
file extra_field_align_2-ef_ff.zzip extra_field_align_2-ef_ff.zip extra_field_align_2-ef_ff.zip
file extra_field_align_3-ef_00.zzip extra_field_align_3-ef_00.zip extra_field_align_3-ef_00.zip
file extra_field_align_3-ef_ff.zzip extra_field_align_3-ef_ff.zip extra_field_align_3-ef_ff.zip
args -c extra_field_align_1-0.zzip extra_field_align_1-ff.zzip extra_field_align_2-0.zzip extra_field_align_2-ff.zzip extra_field_align_3-0.zzip extra_field_align_3-ff.zzip extra_field_align_4-ff.zzip extra_field_align_1-ef_00.zzip extra_field_align_1-ef_ff.zzip extra_field_align_2-ef_00.zzip extra_field_align_2-ef_ff.zzip extra_field_align_3-ef_00.zzip extra_field_align_3-ef_ff.zzip
return 1
stdout opening 'extra_field_align_1-0.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_1-ff.zzip' returned error 21
stdout opening 'extra_field_align_2-0.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_2-ff.zzip' returned error 21
stdout opening 'extra_field_align_3-0.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_3-ff.zzip' returned error 21
stdout opening 'extra_field_align_4-ff.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_1-ef_00.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_1-ef_ff.zzip' returned error 21
stdout opening 'extra_field_align_2-ef_00.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_2-ef_ff.zzip' returned error 21
stdout opening 'extra_field_align_3-ef_00.zzip' succeeded, 1 entries
stdout opening 'extra_field_align_3-ef_ff.zzip' returned error 21
stderr 6 errors
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
# get extra fields for index
args encrypt.zip get_extra 0 0 l get_extra 0 0 c get_extra 0 1 l get_extra 0 1 c get_extra 0 2 l
return 1
file encrypt.zip encrypt.zip encrypt.zip
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x7855: len 0
stderr can't get extra field data for file at index 0, extra field 2, flags 256: No such file
+9
View File
@@ -0,0 +1,9 @@
# get extra_by_id fields for index
args encrypt.zip get_extra_by_id 0 21589 0 l get_extra_by_id 0 30805 0 l get_extra_by_id 0 21589 0 c get_extra_by_id 0 30805 0 c get_extra_by_id 0 21544 0 c
return 1
file encrypt.zip encrypt.zip encrypt.zip
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stderr can't get extra field data for file at index 0, extra field id 21544, ef index 0, flags 512: No such file
+14
View File
@@ -0,0 +1,14 @@
# set extra field
args -- encrypt get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l set_extra 0 2345 -1 l extrafieldcontent set_extra 0 2345 -1 c extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt encrypt.zip encrypt_plus_extra.zip
return 0
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
+16
View File
@@ -0,0 +1,16 @@
# change existing central extra field
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 c Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_c.zip
return 0
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x45787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
+16
View File
@@ -0,0 +1,16 @@
# change existing local extra field
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 l Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_l.zip
return 0
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
stdout Extra field 0x5455: len 5, data 0x033dda4c44
stdout Extra field 0x7855: len 0
stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74
stdout Extra field 0x0929: len 17, data 0x45787472616669656c64636f6e74656e74
stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44
stdout Extra field 0x7855: len 4, data 0x64001400
+15
View File
@@ -0,0 +1,15 @@
# zip_fdopen: stdin opens fine
program ../src/ziptool
args /dev/stdin stat 0
pipefile test.zip
return 0
file test.zip test.zip test.zip
stdout name: 'test'
stdout index: '0'
stdout size: '5'
stdout compressed size: '5'
stdout mtime: 'Mon Oct 06 2003 15:46:42'
stdout crc: '3bb935c6'
stdout compression method: '0'
stdout encryption method: '0'
stdout
+4
View File
@@ -0,0 +1,4 @@
# set file comment to UTF-8 for CP437 encoded filename (adds InfoZIP extra field)
return 0
args testfile.zip set_file_comment 0 ÄÖÜßäöü
file testfile.zip test-cp437.zip test-cp437-comment-utf-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More