summaryrefslogtreecommitdiff
path: root/libarchive/test/test_read_format_cab.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/test/test_read_format_cab.c')
-rw-r--r--libarchive/test/test_read_format_cab.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/libarchive/test/test_read_format_cab.c b/libarchive/test/test_read_format_cab.c
index e09d46d23835..8f6adae66a4a 100644
--- a/libarchive/test/test_read_format_cab.c
+++ b/libarchive/test/test_read_format_cab.c
@@ -25,12 +25,6 @@
#include "test.h"
__FBSDID("$FreeBSD");
-#ifdef HAVE_LIBZ
-static const int libz_enabled = 1;
-#else
-static const int libz_enabled = 0;
-#endif
-
/*
Execute the following command to rebuild the data for this program:
tail -n +44 test_read_format_cab.c | /bin/sh
@@ -204,6 +198,8 @@ verify(const char *refname, enum comp_type comp)
assertEqualInt(0, archive_entry_uid(ae));
assertEqualInt(0, archive_entry_gid(ae));
assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
if (comp != STORE) {
/* Verify regular zero.
@@ -215,10 +211,12 @@ verify(const char *refname, enum comp_type comp)
assertEqualString("zero", archive_entry_pathname(ae));
assertEqualInt(0, archive_entry_uid(ae));
assertEqualInt(0, archive_entry_gid(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
assertEqualInt(33000, archive_entry_size(ae));
for (s = 0; s + sizeof(buff) < 33000; s+= sizeof(buff)) {
ssize_t rsize = archive_read_data(a, buff, sizeof(buff));
- if (comp == MSZIP && rsize == ARCHIVE_FATAL && !libz_enabled) {
+ if (comp == MSZIP && rsize == ARCHIVE_FATAL && archive_zlib_version() == NULL) {
skipping("Skipping CAB format(MSZIP) check: %s",
archive_error_string(a));
goto finish;
@@ -236,6 +234,8 @@ verify(const char *refname, enum comp_type comp)
assertEqualString("dir1/file1", archive_entry_pathname(ae));
assertEqualInt(0, archive_entry_uid(ae));
assertEqualInt(0, archive_entry_gid(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
assertEqualInt(file1_size, archive_entry_size(ae));
assertEqualInt(file1_size, archive_read_data(a, buff, file1_size));
assertEqualMem(buff, file1, file1_size);
@@ -246,6 +246,8 @@ verify(const char *refname, enum comp_type comp)
assertEqualString("dir2/file2", archive_entry_pathname(ae));
assertEqualInt(0, archive_entry_uid(ae));
assertEqualInt(0, archive_entry_gid(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
assertEqualInt(file2_size, archive_entry_size(ae));
assertEqualInt(file2_size, archive_read_data(a, buff, file2_size));
assertEqualMem(buff, file2, file2_size);
@@ -280,7 +282,7 @@ verify2(const char *refname, enum comp_type comp)
char buff[128];
char zero[128];
- if (comp == MSZIP && !libz_enabled) {
+ if (comp == MSZIP && archive_zlib_version() == NULL) {
skipping("Skipping CAB format(MSZIP) check for %s",
refname);
return;
@@ -295,11 +297,17 @@ verify2(const char *refname, enum comp_type comp)
/* Verify regular empty. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
if (comp != STORE) {
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
}
/* Verify regular file1. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
/* Verify regular file2. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -349,14 +357,22 @@ verify3(const char *refname, enum comp_type comp)
/* Verify regular empty. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
if (comp != STORE) {
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
}
/* Verify regular file1. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
/* Verify regular file2. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
/* End of archive. */
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));