]> git.ipfire.org Git - thirdparty/libarchive.git/commit
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)
commit2de568ca5b0ccdbababf6e3857e2e05eea9eb0a6
tree1a8e5ab4c68d4953b08f799543f211fae7d7b407
parentfec2ae3cd3b16ae97a8bf3ff2c8b878697e9852e
Better archive_read_has_encrypted_entries function

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