]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Better archive_read_has_encrypted_entries function 51/head
authorKonrad Kleine <konrad.wilhelm.kleine@gmail.com>
Wed, 9 Oct 2013 11:53:15 +0000 (13:53 +0200)
committerKonrad Kleine <konrad.wilhelm.kleine@gmail.com>
Wed, 9 Oct 2013 11:53:15 +0000 (13:53 +0200)
These are the possible return values:
=====================================

ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED (-2):
------------------------------------------------
This is the default return value for reader that don't support
encrpytion detection at all. When this value is returned you can be sure
that it will always be returned even on later calls to
archive_read_has_encrypted_entries.

ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW (-1):
----------------------------------------------
This is the default return value for readers that support encryption. It
means that the reader is not yet ready (e.g. not enough data was read so
far) to say that there are encrypted entries in the archive. Over time
as more data was consumed by a reader this value might change to 0 or 1.

0:
--
No encrypted entries were found yet (maybe there will be one when
reading the next header). When 0 is returned, it might be that on a
later call 1 will be returned.

1:
--
At least one encrypted entry was found. Once 1 is returned. It will
always be returned even if the another entry is not encrypted.

NOTE:
=====
If the metadata/header of an archive is also encrypted, you
cannot rely on the number of encrypted entries. That is why this
function does not return the number of encrypted entries but
just 1 to show that there are some. Also, two distinct readers might
detect the number of entries and their encryption status at different
times. If one reader can say how many files are encrypted after reading
the first header another reader might need more data. In the end the
number of encrypted entries might be the same in two archives while the
appropriate readers output different results at different points in
time. This is more confusing than helpful.

69 files changed:
libarchive/archive.h
libarchive/archive_entry.h
libarchive/archive_read.c
libarchive/archive_read_private.h
libarchive/archive_read_support_format_7zip.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_zip.c
libarchive/test/test_read_format_7zip.c
libarchive/test/test_read_format_7zip_encryption_data.c
libarchive/test/test_read_format_7zip_encryption_header.c
libarchive/test/test_read_format_7zip_encryption_partially.c
libarchive/test/test_read_format_ar.c
libarchive/test/test_read_format_cab.c
libarchive/test/test_read_format_cab_filename.c
libarchive/test/test_read_format_cpio_afio.c
libarchive/test/test_read_format_cpio_bin.c
libarchive/test/test_read_format_cpio_bin_Z.c
libarchive/test/test_read_format_cpio_bin_be.c
libarchive/test/test_read_format_cpio_bin_bz2.c
libarchive/test/test_read_format_cpio_bin_gz.c
libarchive/test/test_read_format_cpio_bin_lzip.c
libarchive/test/test_read_format_cpio_bin_lzma.c
libarchive/test/test_read_format_cpio_bin_xz.c
libarchive/test/test_read_format_cpio_filename.c
libarchive/test/test_read_format_cpio_odc.c
libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
libarchive/test/test_read_format_cpio_svr4_gzip.c
libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
libarchive/test/test_read_format_cpio_svr4c_Z.c
libarchive/test/test_read_format_empty.c
libarchive/test/test_read_format_gtar_filename.c
libarchive/test/test_read_format_gtar_gz.c
libarchive/test/test_read_format_gtar_lzma.c
libarchive/test/test_read_format_gtar_sparse.c
libarchive/test/test_read_format_iso_Z.c
libarchive/test/test_read_format_iso_multi_extent.c
libarchive/test/test_read_format_iso_xorriso.c
libarchive/test/test_read_format_isojoliet_bz2.c
libarchive/test/test_read_format_isojoliet_long.c
libarchive/test/test_read_format_isojoliet_rr.c
libarchive/test/test_read_format_isojoliet_versioned.c
libarchive/test/test_read_format_isorr_bz2.c
libarchive/test/test_read_format_isorr_ce.c
libarchive/test/test_read_format_isorr_new_bz2.c
libarchive/test/test_read_format_isorr_rr_moved.c
libarchive/test/test_read_format_isozisofs_bz2.c
libarchive/test/test_read_format_lha.c
libarchive/test/test_read_format_lha_filename.c
libarchive/test/test_read_format_mtree.c
libarchive/test/test_read_format_pax_bz2.c
libarchive/test/test_read_format_rar_encryption_data.c
libarchive/test/test_read_format_rar_encryption_header.c
libarchive/test/test_read_format_rar_encryption_partially.c
libarchive/test/test_read_format_raw.c
libarchive/test/test_read_format_tar.c
libarchive/test/test_read_format_tar_empty_filename.c
libarchive/test/test_read_format_tar_empty_pax.c
libarchive/test/test_read_format_tar_filename.c
libarchive/test/test_read_format_tbz.c
libarchive/test/test_read_format_tgz.c
libarchive/test/test_read_format_tlz.c
libarchive/test/test_read_format_txz.c
libarchive/test/test_read_format_tz.c
libarchive/test/test_read_format_ustar_filename.c
libarchive/test/test_read_format_xar.c
libarchive/test/test_read_format_zip_comment_stored.c
libarchive/test/test_read_format_zip_encryption_data.c
libarchive/test/test_read_format_zip_encryption_header.c
libarchive/test/test_read_format_zip_encryption_partially.c

index 0d3ed8f40beb9f57079aec6a3cad733d8ef2077f..cae01c60f5a5d1ab62e97b7f12474e6632984b4a 100644 (file)
@@ -297,6 +297,18 @@ typedef int archive_switch_callback(struct archive *, void *_client_data1,
 #define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0)  /* reader can detect encrypted data */
 #define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1)  /* reader can detect encryptable metadata (pathname, mtime, etc.) */
 
+/*
+ * Codes returned by archive_read_has_encrypted_entries().
+ *
+ * In case the archive does not support encryption detection at all
+ * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader
+ * for some other reason (e.g. not enough bytes read) cannot say if
+ * there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW
+ * is returned.
+ */
+#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2
+#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1
+
 /*-
  * Basic outline for reading an archive:
  *   1) Ask archive_read_new for an archive reader object.
@@ -478,8 +490,25 @@ __LA_DECL int archive_read_next_header2(struct archive *,
  */
 __LA_DECL __LA_INT64_T          archive_read_header_position(struct archive *);
 
-/* Returns "true" (non-zero) if the archive contains encrypted entries; otherwise 0 is returned. */
-__LA_DECL int           archive_read_has_encrypted_entries(struct archive *);
+/*
+ * Returns 1 if the archive contains at least one encrypted entry.
+ * If the archive format not support encryption at all
+ * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned.
+ * If for any other reason (e.g. not enough data read so far)
+ * we cannot say whether there are encrypted entries, then
+ * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned.
+ * In general, this function will return values below zero when the
+ * reader is uncertain or totally uncapable of encryption support.
+ * When this function returns 0 you can be sure that the reader
+ * supports encryption detection but no encrypted entries have
+ * been found yet.
+ *
+ * NOTE: If the metadata/header of an archive is also encrypted, you
+ * cannot rely on the number of encrypted entries. That is why this
+ * function does not return the number of encrypted entries but#
+ * just shows that there are some.
+ */
+__LA_DECL char archive_read_has_encrypted_entries(struct archive *);
 
 /*
  * Returns a bitmask of capabilities that are supported by the archive format reader.
index ebd85d9796d196ccd731e46fa3e77cbbaa5e01b6..590b501a441e426fb9a20260f24c46f76a0d6fe9 100644 (file)
@@ -309,8 +309,8 @@ __LA_DECL void      archive_entry_set_uname(struct archive_entry *, const char *);
 __LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
 __LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
 __LA_DECL int  archive_entry_update_uname_utf8(struct archive_entry *, const char *);
-__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char encrypted);
-__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char encrypted);
+__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char is_encrypted);
+__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char is_encrypted);
 /*
  * Routines to bulk copy fields to/from a platform-native "struct
  * stat."  Libarchive used to just store a struct stat inside of each
index 77293837d25265c5ecc602bee3b13dc9d30e2173..43e1d258cb7b940d341d66736b5c8e80c917ad2b 100644 (file)
@@ -746,15 +746,43 @@ archive_read_header_position(struct archive *_a)
        return (a->header_position);
 }
 
-/* Returns "true" (non-zero) if the archive contains encrypted entries; otherwise 0 is returned. */
-int
+/*
+ * Returns 1 if the archive contains at least one encrypted entry.
+ * If the archive format not support encryption at all
+ * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned.
+ * If for any other reason (e.g. not enough data read so far)
+ * we cannot say whether there are encrypted entries, then
+ * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned.
+ * In general, this function will return values below zero when the
+ * reader is uncertain or totally uncapable of encryption support.
+ * When this function returns 0 you can be sure that the reader
+ * supports encryption detection but no encrypted entries have
+ * been found yet.
+ *
+ * NOTE: If the metadata/header of an archive is also encrypted, you
+ * cannot rely on the number of encrypted entries. That is why this
+ * function does not return the number of encrypted entries but#
+ * just shows that there are some.
+ */
+char
 archive_read_has_encrypted_entries(struct archive *_a)
 {
        struct archive_read *a = (struct archive_read *)_a;
-       if (a && a->format && a->format->has_encrypted_entries) {
+       int format_supports_encryption = archive_read_format_capabilities(_a)
+                       & (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA | ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA);
+
+       if (!_a || !format_supports_encryption) {
+               /* Format in general doesn't support encryption */
+               return ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED;
+       }
+
+       /* A reader potentially has read enough data now. */
+       if (a->format && a->format->has_encrypted_entries) {
                return (a->format->has_encrypted_entries)(a);
        }
-       return 0;
+
+       /* For any other reason we cannot say how many entries are there. */
+       return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
 }
 
 /*
@@ -1121,7 +1149,7 @@ __archive_read_register_format(struct archive_read *a,
     int64_t (*seek_data)(struct archive_read *, int64_t, int),
     int (*cleanup)(struct archive_read *),
     int (*format_capabilities)(struct archive_read *),
-    int (*has_encrypted_entries)(struct archive_read *))
+    char (*has_encrypted_entries)(struct archive_read *))
 {
        int i, number_slots;
 
index 0dc0c776ceebcc42971374d69f8b19f387f2b0ca..5ac009b2a4bd0fa3072c24249a733da13308ab25 100644 (file)
@@ -208,7 +208,7 @@ struct archive_read {
                int64_t (*seek_data)(struct archive_read *, int64_t, int);
                int     (*cleanup)(struct archive_read *);
                int     (*format_capabilties)(struct archive_read *);
-               int     (*has_encrypted_entries)(struct archive_read *);
+               char    (*has_encrypted_entries)(struct archive_read *);
        }       formats[16];
        struct archive_format_descriptor        *format; /* Active format. */
 
@@ -220,17 +220,17 @@ struct archive_read {
 };
 
 int    __archive_read_register_format(struct archive_read *a,
-           void *format_data,
-           const char *name,
-           int (*bid)(struct archive_read *, int),
-           int (*options)(struct archive_read *, const char *, const char *),
-           int (*read_header)(struct archive_read *, struct archive_entry *),
-           int (*read_data)(struct archive_read *, const void **, size_t *, int64_t *),
-           int (*read_data_skip)(struct archive_read *),
-           int64_t (*seek_data)(struct archive_read *, int64_t, int),
-           int (*cleanup)(struct archive_read *),
-           int (*format_capabilities)(struct archive_read *),
-           int (*has_encrypted_entries)(struct archive_read *));
+               void *format_data,
+               const char *name,
+               int (*bid)(struct archive_read *, int),
+               int (*options)(struct archive_read *, const char *, const char *),
+               int (*read_header)(struct archive_read *, struct archive_entry *),
+               int (*read_data)(struct archive_read *, const void **, size_t *, int64_t *),
+               int (*read_data_skip)(struct archive_read *),
+               int64_t (*seek_data)(struct archive_read *, int64_t, int),
+               int (*cleanup)(struct archive_read *),
+               int (*format_capabilities)(struct archive_read *),
+               char (*has_encrypted_entries)(struct archive_read *));
 
 int __archive_read_get_bidder(struct archive_read *a,
     struct archive_read_filter_bidder **bidder);
index c8284792cdf25668e085b038db3fac4e4a4ecce1..13dc99af51595f4e490378b2659d43a1599efb8c 100644 (file)
@@ -326,12 +326,12 @@ struct _7zip {
        struct archive_string_conv *sconv;
 
        char                     format_name[64];
-       
+
        /* Custom value that is non-zero if this archive contains encrypted entries. */
        char has_encrypted_entries;
 };
 
-static int     archive_read_format_7zip_has_encrypted_entries(struct archive_read *);
+static char    archive_read_format_7zip_has_encrypted_entries(struct archive_read *);
 static int     archive_read_support_format_7zip_capabilities(struct archive_read *a);
 static int     archive_read_format_7zip_bid(struct archive_read *, int);
 static int     archive_read_format_7zip_cleanup(struct archive_read *);
@@ -410,6 +410,13 @@ archive_read_support_format_7zip(struct archive *_a)
                return (ARCHIVE_FATAL);
        }
 
+       /*
+        * Until enough data has been read, we cannot tell about
+        * any encrypted entries yet.
+        */
+       zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
+
+
        r = __archive_read_register_format(a,
            zip,
            "7zip",
@@ -437,16 +444,15 @@ archive_read_support_format_7zip_capabilities(struct archive_read * a)
 }
 
 
-static int
-archive_read_format_7zip_has_encrypted_entries(struct archive_read *_a)
+static char archive_read_format_7zip_has_encrypted_entries(struct archive_read *_a)
 {
        if (_a && _a->format) {
                struct _7zip * zip = (struct _7zip *)_a->format->data;
-               if (zip && zip->has_encrypted_entries) {
-                       return 1;
+               if (zip) {
+                       return zip->has_encrypted_entries;
                }
        }
-       return 0;
+       return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
 }
 
 static int
@@ -603,6 +609,17 @@ archive_read_format_7zip_read_header(struct archive_read *a,
        struct _7z_folder *folder = 0;
        uint64_t fidx = 0;
 
+       /*
+        * It should be sufficient to call archive_read_next_header() for
+        * a reader to determine if an entry is encrypted or not. If the
+        * encryption of an entry is only detectable when calling
+        * archive_read_data(), so be it. We'll do the same check there
+        * as well.
+        */
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        a->archive.archive_format = ARCHIVE_FORMAT_7ZIP;
        if (a->archive.archive_format_name == NULL)
                a->archive.archive_format_name = "7-Zip";
@@ -657,6 +674,13 @@ archive_read_format_7zip_read_header(struct archive_read *a,
                }
        }
 
+       /* Now that we've checked for encryption, if there were still no
+        * encrypted entries found we can say for sure that there are none.
+        */
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        if (archive_entry_copy_pathname_l(entry,
            (const char *)zip_entry->utf16name,
            zip_entry->name_len, zip->sconv) != 0) {
@@ -760,6 +784,10 @@ archive_read_format_7zip_read_data(struct archive_read *a,
 
        zip = (struct _7zip *)(a->format->data);
 
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        if (zip->pack_stream_bytes_unconsumed)
                read_consume(a);
 
@@ -3323,6 +3351,13 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
                        }
                }
        }
+       /* Now that we've checked for encryption, if there were still no
+        * encrypted entries found we can say for sure that there are none.
+        */
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        if ((folder->numCoders > 2 && !found_bcj2) || found_bcj2 > 1) {
                archive_set_error(&(a->archive),
                    ARCHIVE_ERRNO_MISC,
index 88195a94f8418354cd3ac4a8c9481fc598d1de1b..03d932a1d340c5dd4613545eb7bfd4686f1ba4fb 100644 (file)
@@ -312,7 +312,7 @@ struct rar
 };
 
 static int archive_read_support_format_rar_capabilities(struct archive_read *);
-static int archive_read_format_rar_has_encrypted_entries(struct archive_read *);
+static char archive_read_format_rar_has_encrypted_entries(struct archive_read *);
 static int archive_read_format_rar_bid(struct archive_read *, int);
 static int archive_read_format_rar_options(struct archive_read *,
     const char *, const char *);
@@ -653,6 +653,12 @@ archive_read_support_format_rar(struct archive *_a)
   }
   memset(rar, 0, sizeof(*rar));
 
+       /*
+        * Until enough data has been read, we cannot tell about
+        * any encrypted entries yet.
+        */
+       rar->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
+
   r = __archive_read_register_format(a,
                                      rar,
                                      "rar",
@@ -679,16 +685,15 @@ archive_read_support_format_rar_capabilities(struct archive_read * a)
                        | ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA);
 }
 
-static int
-archive_read_format_rar_has_encrypted_entries(struct archive_read *_a)
+static char archive_read_format_rar_has_encrypted_entries(struct archive_read *_a)
 {
        if (_a && _a->format) {
                struct rar * rar = (struct rar *)_a->format->data;
-               if (rar && rar->has_encrypted_entries) {
-                       return 1;
+               if (rar) {
+                       return rar->has_encrypted_entries;
                }
        }
-       return 0;
+       return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
 }
 
 
@@ -827,6 +832,17 @@ archive_read_format_rar_read_header(struct archive_read *a,
 
   rar = (struct rar *)(a->format->data);
 
+  /*
+   * It should be sufficient to call archive_read_next_header() for
+   * a reader to determine if an entry is encrypted or not. If the
+   * encryption of an entry is only detectable when calling
+   * archive_read_data(), so be it. We'll do the same check there
+   * as well.
+   */
+  if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+         rar->has_encrypted_entries = 0;
+  }
+
   /* RAR files can be generated without EOF headers, so return ARCHIVE_EOF if
   * this fails.
   */
@@ -973,6 +989,10 @@ archive_read_format_rar_read_data(struct archive_read *a, const void **buff,
   struct rar *rar = (struct rar *)(a->format->data);
   int ret;
 
+  if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+         rar->has_encrypted_entries = 0;
+  }
+
   if (rar->bytes_unconsumed > 0) {
       /* Consume as much as the decompressor actually used. */
       __archive_read_consume(a, rar->bytes_unconsumed);
index 6a77dd7e77b13ebe6d250478f220aa52da18f307..db2c31f4470cc8dbba0cf49cf2d821c209a45eba 100644 (file)
@@ -129,7 +129,7 @@ struct zip {
 #define ZIP_CENTRAL_DIRECTORY_ENCRYPTED        (1<<13) 
 #define ZIP_UTF8_NAME  (1<<11) 
 
-static int     archive_read_format_zip_has_encrypted_entries(struct archive_read *);
+static char    archive_read_format_zip_has_encrypted_entries(struct archive_read *);
 static int     archive_read_support_format_zip_capabilities_seekable(struct archive_read *a);
 static int     archive_read_support_format_zip_capabilities_streamable(struct archive_read *a);
 static int     archive_read_format_zip_streamable_bid(struct archive_read *,
@@ -181,6 +181,12 @@ archive_read_support_format_zip_streamable(struct archive *_a)
        }
        memset(zip, 0, sizeof(*zip));
 
+       /*
+        * Until enough data has been read, we cannot tell about
+        * any encrypted entries yet.
+        */
+       zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
+
        r = __archive_read_register_format(a,
            zip,
            "zip",
@@ -217,6 +223,13 @@ archive_read_support_format_zip_seekable(struct archive *_a)
        }
        memset(zip, 0, sizeof(*zip));
 
+       /*
+        * Until enough data has been read, we cannot tell about
+        * any encrypted entries yet.
+        */
+       zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
+
+       
        r = __archive_read_register_format(a,
            zip,
            "zip",
@@ -250,16 +263,16 @@ archive_read_support_format_zip_capabilities_streamable(struct archive_read * a)
 }
 
 
-static int
+static char
 archive_read_format_zip_has_encrypted_entries(struct archive_read *_a)
 {
        if (_a && _a->format) {
                struct zip * zip = (struct zip *)_a->format->data;
-               if (zip && zip->has_encrypted_entries) {
-                       return 1;
+               if (zip) {
+                       return zip->has_encrypted_entries;
                }
        }
-       return 0;
+       return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
 }
 
 int
@@ -737,6 +750,17 @@ archive_read_format_zip_seekable_read_header(struct archive_read *a,
        struct zip_entry *rsrc;
        int r, ret = ARCHIVE_OK;
 
+       /*
+        * It should be sufficient to call archive_read_next_header() for
+        * a reader to determine if an entry is encrypted or not. If the
+        * encryption of an entry is only detectable when calling
+        * archive_read_data(), so be it. We'll do the same check there
+        * as well.
+        */
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        a->archive.archive_format = ARCHIVE_FORMAT_ZIP;
        if (a->archive.archive_format_name == NULL)
                a->archive.archive_format_name = "ZIP";
@@ -915,6 +939,17 @@ archive_read_format_zip_streamable_read_header(struct archive_read *a,
 
        zip = (struct zip *)(a->format->data);
 
+       /*
+        * It should be sufficient to call archive_read_next_header() for
+        * a reader to determine if an entry is encrypted or not. If the
+        * encryption of an entry is only detectable when calling
+        * archive_read_data(), so be it. We'll do the same check there
+        * as well.
+        */
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        /* Make sure we have a zip_entry structure to use. */
        if (zip->zip_entries == NULL) {
                zip->zip_entries = malloc(sizeof(struct zip_entry));
@@ -1251,6 +1286,10 @@ archive_read_format_zip_read_data(struct archive_read *a,
        int r;
        struct zip *zip = (struct zip *)(a->format->data);
 
+       if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
+               zip->has_encrypted_entries = 0;
+       }
+
        *offset = zip->entry_uncompressed_bytes_read;
        *size = 0;
        *buff = NULL;
index eb79852c38dcc66808103596265532a6989de1fe..6081d2bf1b95ba0a21bd2f8d4ea4c5033f4d4d38 100644 (file)
@@ -51,7 +51,7 @@ test_copy()
        assertEqualInt(86401, archive_entry_mtime(ae));
        assertEqualInt(60, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assert(archive_read_has_encrypted_entries(a) > ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(60, archive_read_data(a, buff, sizeof(buff)));
        assertEqualMem(buff, "    ", 4);
 
index 4820da7b197687873889f7cf1fe8d9aae168cb7b..adedbc5311c6043acc4f4f0c5832f6c826ad336f 100644 (file)
@@ -41,6 +41,8 @@ DEFINE_TEST(test_read_format_7zip_encryption_data)
        assertEqualIntA(a, ARCHIVE_OK, 
                archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify encrypted file "bar.txt". */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae));
index 54054c81d16034fc270476abe47216d7bec36a2c..7d2a4a8d7de4a6cadedc23ee3bbede31f43c8271 100644 (file)
@@ -42,6 +42,8 @@ DEFINE_TEST(test_read_format_7zip_encryption_header)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify regular file but with encrypted headers
           as a consequence, all meta information is invalid. */
        assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
index 31252fc75632faa6d76655d2c3522941df3a03b5..dc8d27862e58e79f92b79010fd5117a760727221 100644 (file)
@@ -42,6 +42,8 @@ DEFINE_TEST(test_read_format_7zip_encryption_partially)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify regular unencrypted file1. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae));
index 55e8b318f96a540205df925e7a71ff1710ab4431..1cc3cc0472253b0ab19c3c6cc395a4bf77d8d820 100644 (file)
@@ -50,7 +50,7 @@ DEFINE_TEST(test_read_format_ar)
        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), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* First Entry */
        assertA(0 == archive_read_next_header(a, &ae));
@@ -62,7 +62,7 @@ DEFINE_TEST(test_read_format_ar)
        assertA(8 == archive_read_data(a, buff, 10));
        assertEqualMem(buff, "55667788", 8);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Second Entry */
        assertA(0 == archive_read_next_header(a, &ae));
@@ -74,7 +74,7 @@ DEFINE_TEST(test_read_format_ar)
        assertA(4 == archive_read_data(a, buff, 10));
        assertEqualMem(buff, "3333", 4);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Third Entry */
        assertA(0 == archive_read_next_header(a, &ae));
index 8b77d898e5a058efc41d4030a8bd9c8214133ec2..55e6d978b8d5fd51cf05f7c71d6dbf0b0081a1e1 100644 (file)
@@ -205,7 +205,7 @@ verify(const char *refname, enum comp_type comp)
        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), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        if (comp != STORE) {
                /* Verify regular zero.
@@ -218,7 +218,7 @@ verify(const char *refname, enum comp_type comp)
                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), 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));
@@ -241,7 +241,7 @@ verify(const char *refname, enum comp_type comp)
        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), 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);
@@ -253,7 +253,7 @@ verify(const char *refname, enum comp_type comp)
        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), 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);
@@ -304,16 +304,16 @@ 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), 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), 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), 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));
@@ -364,21 +364,21 @@ 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), 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), 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), 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), 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));
index 885f750a07365000e51147970651fc128ed7eb0e..2f46a7e6ed05976381bfbb4088e75d5457e12348 100644 (file)
@@ -59,7 +59,7 @@ test_read_format_cab_filename_CP932_eucJP(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(5, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -68,7 +68,7 @@ test_read_format_cab_filename_CP932_eucJP(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(5, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -127,7 +127,7 @@ test_read_format_cab_filename_CP932_UTF8(const char *refname)
        assertEqualInt(5, archive_entry_size(ae));
 #endif
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -146,7 +146,7 @@ test_read_format_cab_filename_CP932_UTF8(const char *refname)
 #endif
        assertEqualInt(5, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
index f5c4a3d273797a098356bf9e1750327b78eb0d2c..16065eb0a5125354429a651dd3cf6c9c355a853b 100644 (file)
@@ -99,7 +99,7 @@ DEFINE_TEST(test_read_format_cpio_afio)
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt(17, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
        assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX);
        /*
@@ -110,7 +110,7 @@ DEFINE_TEST(test_read_format_cpio_afio)
        if (uid_size() > 4)
                assertEqualInt(65536, archive_entry_uid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
        assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_AFIO_LARGE);
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
index 26980d7a57f85bd089a03c59318a83ff5707becb..7b0fad268c0b1eb8ac01bc18365bf02ca4c3930c 100644 (file)
@@ -53,7 +53,7 @@ DEFINE_TEST(test_read_format_cpio_bin)
        assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
        assertEqualInt(1, archive_file_count(a));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
        assertEqualIntA(a, ARCHIVE_FORMAT_CPIO_BIN_LE, archive_format(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
index d6c515065f3533bc2da270b718632d3d48170385..6afe691138fb017cdf149e86c6dabcb198a47cba 100644 (file)
@@ -52,7 +52,7 @@ DEFINE_TEST(test_read_format_cpio_bin_Z)
            archive_format_name(a));
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index c114b50959a2d4efa0c64b465843f5aa117bad00..164396dab23fca6fc6bb99a5d875ab96a1220178 100644 (file)
@@ -45,7 +45,7 @@ DEFINE_TEST(test_read_format_cpio_bin_be)
        assertEqualInt(archive_entry_uid(ae), 1000);
        assertEqualInt(archive_entry_gid(ae), 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_BE);
index 58637b3a1880c482d9c995e10c074aaf4e8cd061..7497bc41a988171b75f115f7ed431bd077969d64 100644 (file)
@@ -50,7 +50,7 @@ DEFINE_TEST(test_read_format_cpio_bin_bz2)
            archive_read_open_memory(a, archive, sizeof(archive)));
        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), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assert(archive_filter_code(a, 0) == ARCHIVE_FILTER_BZIP2);
        assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
index 5aa8beb54e7bf9d51308e4401411c24ce7bbce80..3cc8f15eaee57a9df856f0318a258fa4bd825669 100644 (file)
@@ -54,7 +54,7 @@ DEFINE_TEST(test_read_format_cpio_bin_gz)
        assertEqualInt(archive_filter_code(a, 0),
            ARCHIVE_FILTER_GZIP);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
index 2f98b0084cf56a460ab78ae9806b0d52bc8494a3..d9acf095ed77fe4627ee7bc1e79ee3491da0e45b 100644 (file)
@@ -54,7 +54,7 @@ DEFINE_TEST(test_read_format_cpio_bin_lzip)
            archive_read_open_memory(a, archive, sizeof(archive)));
        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), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZIP);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
index 2b61542bfa6a04c0d22775829d4adc4fb75d9770..9a8a23ceb77cbf71558d86f0796d01b57e54008e 100644 (file)
@@ -55,7 +55,7 @@ DEFINE_TEST(test_read_format_cpio_bin_lzma)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 11546cc1c44c53f842212d1a178d144725df0abb..b19c4fae606a8998ea419602f9334356cad7ea79 100644 (file)
@@ -65,7 +65,7 @@ DEFINE_TEST(test_read_format_cpio_bin_xz)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_XZ);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index fc73c7dddcd57e0f462d9ccfc345d1d928b80d97..cc2367be823f2ee565ec18417a762334ff927814 100644 (file)
@@ -58,14 +58,14 @@ test_read_format_cpio_filename_eucJP_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(8, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae));
        assertEqualInt(4, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
index ca22a836ba3b090461f4798839c42f3fa0d58874..f433a4c916cdca29b50cb45de66b4d92030ec610 100644 (file)
@@ -58,7 +58,7 @@ DEFINE_TEST(test_read_format_cpio_odc)
        assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
        assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 7a01ee3d297b2037777be51361d6d834e30610e9..cff64d72c1eda04691b7fdd2213c7026f8c3b79f 100644 (file)
@@ -113,16 +113,16 @@ DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm)
        assertEqualString("./etc/file3", archive_entry_pathname(ae));
        assertEqualInt(86401, archive_entry_mtime(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify the end-of-archive. */
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
-  
+
        /* Verify that the format detection worked. */
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_BZIP2);
        assertEqualString(archive_filter_name(a, 0), "bzip2");
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
+
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 0874be92c6d90e159c9a99ed7bfb01434c5ddc69..cb813d24f5d460110eb4ce6938c8588267d3f513 100644 (file)
@@ -55,7 +55,7 @@ DEFINE_TEST(test_read_format_cpio_svr4_gzip)
        assertEqualInt(archive_format(a),
            ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 3e6ae3146dbeb813f61f2edc2d98ab7c4714e910..345760c1014ffb676b96660875b4c194684ffaa8 100644 (file)
@@ -113,7 +113,7 @@ DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm)
        assertEqualString("./etc/file3", archive_entry_pathname(ae));
        assertEqualInt(86401, archive_entry_mtime(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify the end-of-archive. */
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
index cc4ded5fe3c2688b3f5569d045f15a57a62765e4..29aa2c6341e6970a07ee0aecaa9482e388e1bbe8 100644 (file)
@@ -52,7 +52,7 @@ DEFINE_TEST(test_read_format_cpio_svr4c_Z)
        failure("archive_format_name(a)=\"%s\"", archive_format_name(a));
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 63a5e560820987a655862af5da6dfd79c512235b..2556503acdf518c48d084a86d3d9a6ca5c89fa46 100644 (file)
@@ -39,7 +39,7 @@ DEFINE_TEST(test_read_format_empty)
        assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
        assertA(archive_format(a) == ARCHIVE_FORMAT_EMPTY);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 64dc222edcdf6e81c7a7858853d80e6881083e67..41d4f8f1e4640538c152f1278801ecabb152d78c 100644 (file)
@@ -63,7 +63,7 @@ test_read_format_gtar_filename_eucJP_UTF8(const char *refname)
        assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae));
        assertEqualInt(4, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
index 7d5576eff1d54866c15e220f069d8d330b99ca71..2541f992621625ca958a31524bd5bf3b755bfc7f 100644 (file)
@@ -55,7 +55,7 @@ DEFINE_TEST(test_read_format_gtar_gz)
            ARCHIVE_FILTER_GZIP);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 8b66ef321c6d88b93afb4adae3346d804e1e674b..280a089fd391e9964166bd23c7544da4f0ba8166 100644 (file)
@@ -67,7 +67,7 @@ DEFINE_TEST(test_read_format_gtar_lzma)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
 finish:
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
index a7542314bebf071b58474660def90b616450e18d..7ab13c1109a0282af1b83e258235979c55744bfa 100644 (file)
@@ -201,7 +201,7 @@ verify_archive_file(const char *name, struct archive_contents *ac)
                failure("Name mismatch in archive %s", name);
                assertEqualString(ac->filename, archive_entry_pathname(ae));
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
                expect = *cts++;
                while (0 == (err = archive_read_data_block(a,
index 74f2181e21b1f1358457b18ce13b729751fdd516..6492706c3df64dbe79c1e6c7a2c515783dec9734 100644 (file)
@@ -48,7 +48,7 @@ test1(void)
            ARCHIVE_FILTER_COMPRESS);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
@@ -91,7 +91,7 @@ test2(void)
            ARCHIVE_FILTER_COMPRESS);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 54b0c600fc88704209349d20871b6c233ccc825e..dafbfd38d681e9a18c5dd030709efc9dc9b338a2 100644 (file)
@@ -74,7 +74,7 @@ DEFINE_TEST(test_read_format_iso_multi_extent)
                        assertEqualInt(1, archive_entry_uid(ae));
                        assertEqualInt(2, archive_entry_gid(ae));
                        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-                       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+                       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
                } else {
                        failure("Saw a file that shouldn't have been there");
                        assertEqualString(archive_entry_pathname(ae), "");
index 8303c6bf6ab56436805634efcd0b076d398f46ce..ce71a560a01c5bdafc4c25a00defb2e7dc48c1ac 100644 (file)
@@ -87,8 +87,8 @@ DEFINE_TEST(test_read_format_iso_xorriso)
                assertEqualInt(0, archive_read_next_header(a, &ae));
 
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
-               
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
+
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
                        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
index 8f35d3f17cc40dd13b1256ba73630d51b2d0a1a2..eb33c0b4f82994c7bc5b1ff3ef00e60a56443c7c 100644 (file)
@@ -84,7 +84,7 @@ DEFINE_TEST(test_read_format_isojoliet_bz2)
            archive_read_data_block(a, &p, &size, &offset));
        assertEqualInt((int)size, 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A directory. */
        assertEqualInt(0, archive_read_next_header(a, &ae));
@@ -94,7 +94,7 @@ DEFINE_TEST(test_read_format_isojoliet_bz2)
        assertEqualInt(86401, archive_entry_mtime(ae));
        assertEqualInt(86401, archive_entry_atime(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A regular file with two names ("hardlink" gets returned
         * first, so it's not marked as a hardlink). */
@@ -126,7 +126,7 @@ DEFINE_TEST(test_read_format_isojoliet_bz2)
        assertEqualInt(172802, archive_entry_mtime(ae));
        assertEqualInt(172802, archive_entry_atime(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* End of archive. */
        assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
index aad54e330f2ba265e54b774190c34d3c9ae832ac..4283c399fbb478ee51d00bcf88a05fbe6819655f 100644 (file)
@@ -92,7 +92,7 @@ DEFINE_TEST(test_read_format_isojoliet_long)
            archive_read_data_block(a, &p, &size, &offset));
        assertEqualInt((int)size, 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A directory. */
        pathname[100] = 'd';
@@ -106,7 +106,7 @@ DEFINE_TEST(test_read_format_isojoliet_long)
        assertEqualInt(86401, archive_entry_mtime(ae));
        assertEqualInt(86401, archive_entry_atime(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A regular file with two names (pathname gets returned
         * first, so it's not marked as a hardlink). */
@@ -124,7 +124,7 @@ DEFINE_TEST(test_read_format_isojoliet_long)
        assertEqualInt(0, offset);
        assertEqualMem(p, "hello\n", 6);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Second name for the same regular file (this happens to be
         * returned second, so does get marked as a hardlink). */
@@ -134,7 +134,7 @@ DEFINE_TEST(test_read_format_isojoliet_long)
        assertEqualString("hardlink", archive_entry_hardlink(ae));
        assert(!archive_entry_size_is_set(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* End of archive. */
        assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
index b5562f9193464f88d835bf4f9705ff7d26e3bf0a..3c19516d614d335f1813a3362cb7359678b64ba2 100644 (file)
@@ -84,7 +84,7 @@ DEFINE_TEST(test_read_format_isojoliet_rr)
            archive_read_data_block(a, &p, &size, &offset));
        assertEqualInt((int)size, 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A directory. */
        assertEqualInt(0, archive_read_next_header(a, &ae));
@@ -97,7 +97,7 @@ DEFINE_TEST(test_read_format_isojoliet_rr)
        assertEqualInt(1, archive_entry_uid(ae));
        assertEqualInt(2, archive_entry_gid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A regular file with two names ("hardlink" gets returned
         * first, so it's not marked as a hardlink). */
@@ -121,7 +121,7 @@ DEFINE_TEST(test_read_format_isojoliet_rr)
        assertEqualInt(1, archive_entry_uid(ae));
        assertEqualInt(2, archive_entry_gid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Second name for the same regular file (this happens to be
         * returned second, so does get marked as a hardlink). */
@@ -139,7 +139,7 @@ DEFINE_TEST(test_read_format_isojoliet_rr)
        assertEqualInt(1, archive_entry_uid(ae));
        assertEqualInt(2, archive_entry_gid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A symlink to the regular file. */
        assertEqualInt(0, archive_read_next_header(a, &ae));
@@ -154,7 +154,7 @@ DEFINE_TEST(test_read_format_isojoliet_rr)
        assertEqualInt(1, archive_entry_uid(ae));
        assertEqualInt(2, archive_entry_gid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* End of archive. */
        assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
index 1b38f118c38d9c9cc31937bfaf072f9ed47bcf4d..011b5e296b944bf3136ceac7116e534579464454 100644 (file)
@@ -59,7 +59,7 @@ DEFINE_TEST(test_read_format_isojoliet_versioned)
        assertEqualString("test", archive_entry_pathname(ae));
        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* A regular file which is called test.txt and has
         * ;1 appended to it because apparently Nero always
@@ -72,7 +72,7 @@ DEFINE_TEST(test_read_format_isojoliet_versioned)
            archive_entry_pathname(ae));
        assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* End of archive. */
        assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
index 4c0e792f04cedb757635363af634573d57fb900c..d2dfa2e5f7937207ce2b6132631a9dddf74b5354 100644 (file)
@@ -75,7 +75,7 @@ DEFINE_TEST(test_read_format_isorr_bz2)
                assertEqualInt(0, archive_read_next_header(a, &ae));
                
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
index d0c1c5b63fa007b8f23347eec12b68c41ba85581..1e57acb7668bd4c07b0c4827c44ce8c3e68c28e6 100644 (file)
@@ -111,7 +111,7 @@ DEFINE_TEST(test_read_format_isorr_ce)
                assertEqualInt(0, archive_read_next_header(a, &ae));
                
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
index f5c21410f230538866756b6e13136177b21795e0..4c1b5692e9eff05b13a401162222a33c5426fa0e 100644 (file)
@@ -76,7 +76,7 @@ DEFINE_TEST(test_read_format_isorr_new_bz2)
                assertEqualInt(0, archive_read_next_header(a, &ae));
                
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
index db9c736955d57a562482a340ba3852aaaaa8e3a5..693caef621f233f681017d05d08d95059bca2dd1 100644 (file)
@@ -81,8 +81,8 @@ DEFINE_TEST(test_read_format_isorr_rr_moved)
                assertEqualInt(0, archive_read_next_header(a, &ae));
 
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
-               
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
+
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
                        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
index 4c12fa14c77a5dbdf0660ff8337fe1014f9817cd..adf9624274e03845ccaff6d2e152583ceecac18c 100644 (file)
@@ -74,8 +74,8 @@ DEFINE_TEST(test_read_format_isozisofs_bz2)
                assertEqualInt(0, archive_read_next_header(a, &ae));
 
                assertEqualInt(archive_entry_is_encrypted(ae), 0);
-               assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
-               
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
+
                if (strcmp(".", archive_entry_pathname(ae)) == 0) {
                        /* '.' root directory. */
                        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
index 7f443394b45615ca25cb429745f68f50e86b42bc..6a53976c2a75d04579fb35b442a5f890e8fb3ce0 100644 (file)
@@ -170,7 +170,7 @@ verify(const char *refname, int posix)
            archive_read_data_block(a, &pv, &s, &o));
        assertEqualInt(s, 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify directory2.  */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -184,7 +184,7 @@ verify(const char *refname, int posix)
            archive_read_data_block(a, &pv, &s, &o));
        assertEqualInt(s, 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        if (posix) {
                /* Verify symbolic link file1. */
@@ -197,7 +197,7 @@ verify(const char *refname, int posix)
                assertEqualInt(gid, 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), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
                /* Verify symbolic link file2. */
                assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -209,7 +209,7 @@ verify(const char *refname, int posix)
                assertEqualInt(gid, 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), 0);
+               assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        }
 
        /* Verify regular file1. */
@@ -223,7 +223,7 @@ verify(const char *refname, int posix)
        assertEqualInt(file1_size, archive_read_data(a, buff, file1_size));
        assertEqualMem(buff, file1, file1_size);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 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));
@@ -239,7 +239,7 @@ verify(const char *refname, int posix)
        assertEqualInt(file2_size, archive_read_data(a, buff, file2_size));
        assertEqualMem(buff, file2, file2_size);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify the number of files read. */
        if (posix) {
@@ -257,10 +257,10 @@ verify(const char *refname, int posix)
        } else {
                assertEqualInt(4, archive_file_count(a));
        }
-       
+
        /* Verify encryption status */
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify archive format. */
        assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
index 1c068193589eca30bd7883f99edc7f31b93834ed..126a8704ce4a58ce6d36f4039cb8e725d199d04a 100644 (file)
@@ -69,14 +69,14 @@ test_read_format_lha_filename_CP932_eucJP(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(8, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("\xC9\xBD\x2E\x74\x78\x74", archive_entry_pathname(ae));
        assertEqualInt(4, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 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));
index 3a02c4410035e7e5bb076457df0566556014adca..830fa0a9cf40dd906378bc3cf5ef164f1baaf2ad 100644 (file)
@@ -77,96 +77,96 @@ test_read_format_mtree1(void)
        assertEqualInt(3, archive_read_data(a, buff, 3));
        assertEqualMem(buff, "hi\n", 3);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir");
        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir/file with space");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "file with space");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3a");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3a/indir3a");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/fullindir2");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/indir2");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3b");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/indir3b");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "notindir");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/emptyfile");
        assertEqualInt(archive_entry_size(ae), 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/smallfile");
        assertEqualInt(archive_entry_size(ae), 1);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
        assertEqualInt(archive_entry_size(ae), -1);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/bigfile");
        assertEqualInt(archive_entry_size(ae), max_int64);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/toobigfile");
        /* Size in mtree is max_int64 + 1; should return max_int64. */
        assertEqualInt(archive_entry_size(ae), max_int64);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/veryoldfile");
@@ -178,7 +178,7 @@ test_read_format_mtree1(void)
        t = min_time - 1;
        assert(t > 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* toooldfile is 1 sec older, which should overflow and get returned
         * with the same value. */
@@ -186,7 +186,7 @@ test_read_format_mtree1(void)
        assertEqualString(archive_entry_pathname(ae), "dir2/toooldfile");
        assertEqualInt(archive_entry_mtime(ae), min_time);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(19, archive_file_count(a));
@@ -215,7 +215,7 @@ test_read_format_mtree2(void)
        assertEqualString(archive_entry_pathname(ae), "d");
        assertEqualInt(archive_entry_filetype(ae), AE_IFDIR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(1, archive_file_count(a));
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
@@ -251,17 +251,17 @@ test_read_format_mtree3(void)
        assertEqualString(archive_entry_pathname(ae), "a");
        assertEqualInt(archive_entry_filetype(ae), AE_IFREG);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "b");
        assertEqualInt(archive_entry_filetype(ae), AE_IFLNK);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "c");
        assertEqualInt(archive_entry_filetype(ae), AE_IFREG);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(3, archive_file_count(a));
@@ -304,32 +304,32 @@ DEFINE_TEST(test_read_format_mtree_filenames_only)
        assertEqualString(archive_entry_pathname(ae), "./a");   
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./b");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./c");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./d");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./e");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./f");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0444);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(6, archive_file_count(a));
@@ -372,21 +372,21 @@ DEFINE_TEST(test_read_format_mtree_nochange)
        assertEqualInt(archive_entry_mtime(ae), 123);
        assertEqualInt(archive_entry_size(ae), 5);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./b");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_mtime(ae), 234);
        assertEqualInt(archive_entry_size(ae), 6);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./c");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_mtime(ae), 345);
        assertEqualInt(archive_entry_size(ae), 7);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(3, archive_file_count(a));
@@ -416,7 +416,7 @@ DEFINE_TEST(test_read_format_mtree_nochange)
        assertEqualInt(archive_entry_mtime(ae), 234);
        assertEqualInt(archive_entry_size(ae), 6);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "./c");
 #if !defined(_WIN32) || defined(__CYGWIN__)
@@ -425,7 +425,7 @@ DEFINE_TEST(test_read_format_mtree_nochange)
        assert(archive_entry_mtime(ae) != 345);
        assertEqualInt(archive_entry_size(ae), 7);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(3, archive_file_count(a));
@@ -468,64 +468,64 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v1_form)
        assertEqualInt(3, archive_read_data(a, buff, 3));
        assertEqualMem(buff, "hi\n", 3);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir");
        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir/file with space");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "file with space");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3a");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3a/indir3a");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/fullindir2");
        assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/indir2");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3b");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/indir3b");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "notindir");
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(12, archive_file_count(a));
index f26b04ed5a59ea5885f624d13052c3780c66fef5..8c5d28ec05d6f6ab953fce8fecd78bbf740f6257 100644 (file)
@@ -61,7 +61,7 @@ DEFINE_TEST(test_read_format_pax_bz2)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_BZIP2);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a,ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 14de888ad7609541d54267d5adeee92acec1b63d..2e7b5fad9dcf38bb3ef29adc1393d715a6a92cb3 100644 (file)
@@ -41,6 +41,8 @@ DEFINE_TEST(test_read_format_rar_encryption_data)
        assertEqualIntA(a, ARCHIVE_OK, 
                archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify encrypted file "foo.txt" */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae));
index 71de49de56700b002cc42807644f666a495ec5e8..81965eb6787fb409d296eaf37c26b682e7645722 100644 (file)
@@ -41,6 +41,8 @@ DEFINE_TEST(test_read_format_rar_encryption_header)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify regular file but with encrypted headers
           as a consequence, all meta information is invalid. */
        assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
index 3b13103bdb86a9c2099c063e2edce4d72bd63853..733f162300d561f5555fd3ecf3a265ac44bdf036 100644 (file)
@@ -42,6 +42,8 @@ DEFINE_TEST(test_read_format_rar_encryption_partially)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify encrypted file "foo.txt". */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae));
index ed130bf5070d29578c78ef3ba9e3c4661ca567ae..1310090cbc68047af282b33f62cfb05210b72ce4 100644 (file)
@@ -54,7 +54,7 @@ DEFINE_TEST(test_read_format_raw)
        assert(!archive_entry_ctime_is_set(ae));
        assert(!archive_entry_mtime_is_set(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(4, archive_read_data(a, buff, 32));
        assertEqualMem(buff, "foo\n", 4);
 
@@ -77,7 +77,7 @@ DEFINE_TEST(test_read_format_raw)
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("data", archive_entry_pathname(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        /* Most fields should be unset (unknown) */
        assert(!archive_entry_size_is_set(ae));
        assert(!archive_entry_atime_is_set(ae));
index aa0735b827bc771cbbe087e3a62a717eab2f2841..7c7cadd0a38b91ab96c7e9c16b24aca7e233e8eb 100644 (file)
@@ -75,7 +75,7 @@ static void verifyEmpty(void)
        failure("512 zero bytes should be recognized as a tar archive.");
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
@@ -442,7 +442,7 @@ static void verify(unsigned char *d, size_t s,
        assertEqualInt(archive_filter_code(a, 0), compression);
        assertEqualInt(archive_format(a), format);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify the only entry. */
        f(ae);
index ec047834ef6cfc7d760674ac44092c80ddd29851..b1a1a4e1c8217630b17fa9c97a2c8bdeb17cf5cc 100644 (file)
@@ -50,7 +50,7 @@ DEFINE_TEST(test_read_format_tar_empty_filename)
        assertEqualString("wheel", archive_entry_gname(ae));
        assertEqualInt(040775, archive_entry_mode(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify the end-of-archive. */
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
index fcdc48e352d35ae33d46f9bbb4fc3dc6cd9747db..5416021947e01f55546a5230af253d98b00a1ec4 100644 (file)
@@ -50,7 +50,7 @@ DEFINE_TEST(test_read_format_tar_empty_pax)
            archive_read_open_filename(a, refname, 10240));
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0));
        assertEqualInt(ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, archive_format(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
index e50880a833191f8498e5a28aa6baae57bd7f7716..9ee8e813f737550eef7ebf89275de03c73064dce 100644 (file)
@@ -81,7 +81,7 @@ test_read_format_tar_filename_KOI8R_CP866(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular second file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -89,7 +89,7 @@ test_read_format_tar_filename_KOI8R_CP866(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -128,7 +128,7 @@ next_test:
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /*
         * Verify regular second file.
@@ -139,7 +139,7 @@ next_test:
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -188,7 +188,7 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -196,11 +196,11 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify encryption status */
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 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));
@@ -212,7 +212,7 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname)
        
        /* Verify encryption status */
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Close the archive. */
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
@@ -242,7 +242,7 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname)
        
        /* Verify encryption status */
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /*
         * Verify regular second file.
@@ -310,7 +310,7 @@ test_read_format_tar_filename_KOI8R_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular second file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -318,7 +318,7 @@ test_read_format_tar_filename_KOI8R_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -356,7 +356,7 @@ next_test:
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /*
         * Verify regular second file.
@@ -366,7 +366,7 @@ next_test:
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
index 3047051041c88f28f1321a0a42b2d19c23882e82..331955fd9c3905a640d43f232e105d51de3dfe9f 100644 (file)
@@ -54,7 +54,7 @@ DEFINE_TEST(test_read_format_tbz)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_BZIP2);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 3294c318b0744683e12b650af1997a595abe6590..9fba89657e92692c5bc1d3ecbe6afaa1095981be 100644 (file)
@@ -55,7 +55,7 @@ DEFINE_TEST(test_read_format_tgz)
            ARCHIVE_FILTER_GZIP);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK,archive_read_free(a));
 }
index f7c4b06c5ea15b7bbd2f24d9b14acfe66b930bb0..7c7a1431903cf8d6836ee99e3e7136caebda4f33 100644 (file)
@@ -57,7 +57,7 @@ DEFINE_TEST(test_read_format_tlz)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index d570465377e3e7cfe25215011b38e318d2f831dc..c082d7e5e7be14581e7e24011d3a9d5aca3c11ca 100644 (file)
@@ -60,7 +60,7 @@ DEFINE_TEST(test_read_format_txz)
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_XZ);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index d2240dbae0edd639c446fbdd5b101f2b692702d3..4ba7bcb3f9c6ca1a969a06214925aada67af6ec4 100644 (file)
@@ -52,7 +52,7 @@ DEFINE_TEST(test_read_format_tz)
        failure("archive_format_name(a)=\"%s\"", archive_format_name(a));
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index b32047f5edff59dec0ea9da4524181472c7f6f6c..5c2717cdf2c0d97f2fd5e106e1cde267f034a6a3 100644 (file)
@@ -58,15 +58,15 @@ test_read_format_ustar_filename_eucJP_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(8, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae));
        assertEqualInt(4, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 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));
@@ -113,7 +113,7 @@ test_read_format_ustar_filename_CP866_KOI8R(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -121,8 +121,7 @@ test_read_format_ustar_filename_CP866_KOI8R(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 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));
@@ -168,7 +167,7 @@ test_read_format_ustar_filename_CP866_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -176,7 +175,7 @@ test_read_format_ustar_filename_CP866_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -224,7 +223,7 @@ test_read_format_ustar_filename_KOI8R_CP866(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -232,7 +231,7 @@ test_read_format_ustar_filename_KOI8R_CP866(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -279,7 +278,7 @@ test_read_format_ustar_filename_KOI8R_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -287,7 +286,7 @@ test_read_format_ustar_filename_KOI8R_UTF8(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -334,14 +333,14 @@ test_read_format_ustar_filename_eucJP_CP932(const char *refname)
        assertEqualString("\x8a\xbf\x8e\x9a.txt", archive_entry_pathname(ae));
        assertEqualInt(8, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("\x95\x5c.txt", archive_entry_pathname(ae));
        assertEqualInt(4, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -389,7 +388,7 @@ test_read_format_ustar_filename_CP866_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -397,7 +396,7 @@ test_read_format_ustar_filename_CP866_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -445,7 +444,7 @@ test_read_format_ustar_filename_CP866_CP1251_win(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -453,7 +452,7 @@ test_read_format_ustar_filename_CP866_CP1251_win(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
@@ -500,7 +499,7 @@ test_read_format_ustar_filename_KOI8R_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
        /* Verify regular file. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
@@ -508,7 +507,7 @@ test_read_format_ustar_filename_KOI8R_CP1251(const char *refname)
            archive_entry_pathname(ae));
        assertEqualInt(6, archive_entry_size(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 
 
        /* End of archive. */
index e6bc3511babc9de4302d5a6c679b1cf8b89415a2..b7189eb259e6d77adfea77aa0baf2bcfb8c5f3dd 100644 (file)
@@ -664,7 +664,7 @@ static void verify(unsigned char *d, size_t s,
        assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE);
        assertEqualInt(archive_format(a), ARCHIVE_FORMAT_XAR);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        /* Verify the only entry. */
        f1(a, ae);
        if (f2) {
index 5d7014d9d4256101a53ab0c372e0c570b5ab092a..d2b935de2d44f745793cf6ebfb44a7d408aac883 100644 (file)
@@ -59,10 +59,10 @@ verify(const char *refname)
        assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+       assertEqualInt(archive_entry_is_encrypted(ae), 0);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
-       assertEqualInt(archive_entry_is_encrypted(ae), 0);
-       assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
 }
 
 DEFINE_TEST(test_read_format_zip_comment_stored)
index c4585a18801d8351c941eacd490e99df9e8334cb..771d7f7b46d583bee5c4a3d3f5fc9be13a5c3955 100644 (file)
@@ -39,7 +39,9 @@ DEFINE_TEST(test_read_format_zip_encryption_data)
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
        assertEqualIntA(a, ARCHIVE_OK, 
-               archive_read_open_filename(a, refname, 10240));
+               archive_read_open_filename(a, refname, 10240));
+
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
 
        /* Verify encrypted file "bar.txt" */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
index 5776db8b3d84672776ef4a8943bc6494b89b6f5f..f40e1f5cb8da5b2b15669909f1623f38c32b93a7 100644 (file)
@@ -41,6 +41,8 @@ DEFINE_TEST(test_read_format_zip_encryption_header)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify regular file but with encrypted headers
           as a consequence, all meta information is invalid. */
        assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
index 330497a8c22cb2d6ffd2665e074e0db726732aeb..7724721ff339f175a47beb7f6172b7a89e4d6f0d 100644 (file)
@@ -42,6 +42,8 @@ DEFINE_TEST(test_read_format_zip_encryption_partially)
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, refname, 10240));
 
+       assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
+
        /* Verify unencrypted file "bar.txt". */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt((AE_IFREG | 0666), archive_entry_mode(ae));