Rizin
unix-like reverse engineering framework and cli tools
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include "zipint.h"
Go to the source code of this file.
void _zip_cdir_free | ( | zip_cdir_t * | cd | ) |
Definition at line 49 of file zip_dirent.c.
References _zip_entry_finalize(), _zip_string_free(), cd, free(), and i.
Referenced by _zip_cdir_new(), _zip_find_central_dir(), and _zip_read_cdir().
bool _zip_cdir_grow | ( | zip_cdir_t * | cd, |
zip_uint64_t | additional_entries, | ||
zip_error_t * | error | ||
) |
Definition at line 88 of file zip_dirent.c.
References _zip_entry_init(), cd, error(), i, NULL, realloc(), SIZE_MAX, ZIP_ER_MEMORY, and zip_error_set().
Referenced by _zip_cdir_new(), and _zip_read_cdir().
zip_cdir_t* _zip_cdir_new | ( | zip_uint64_t | nentry, |
zip_error_t * | error | ||
) |
Definition at line 64 of file zip_dirent.c.
References _zip_cdir_free(), _zip_cdir_grow(), cd, error(), malloc(), NULL, ZIP_ER_MEMORY, and zip_error_set().
Referenced by _zip_read_eocd(), and _zip_read_eocd64().
zip_int64_t _zip_cdir_write | ( | zip_t * | za, |
const zip_filelist_t * | filelist, | ||
zip_uint64_t | survivors | ||
) |
Definition at line 121 of file zip_dirent.c.
References _zip_buffer_data(), _zip_buffer_free(), _zip_buffer_new(), _zip_buffer_offset(), _zip_buffer_ok(), _zip_buffer_put(), _zip_buffer_put_16(), _zip_buffer_put_32(), _zip_buffer_put_64(), _zip_dirent_write(), _zip_error_set_from_source(), _zip_write(), zip::comment_changed, zip::comment_changes, zip::comment_orig, zip::entry, EOCD64_MAGIC, EOCD64LEN, EOCD64LOC_MAGIC, EOCD64LOCLEN, EOCD_MAGIC, EOCDLEN, zip::error, i, zip_filelist::idx, zip_string::length, NULL, off, zip_string::raw, zip::src, za, ZIP_ER_INTERNAL, ZIP_ER_MEMORY, zip_error_set(), ZIP_FL_CENTRAL, zip_source_tell_write(), ZIP_UINT16_MAX, and ZIP_UINT32_MAX.
Referenced by write_cdir().
time_t _zip_d2u_time | ( | zip_uint16_t | dtime, |
zip_uint16_t | ddate | ||
) |
Definition at line 1004 of file zip_dirent.c.
References memset().
Referenced by _zip_dirent_read(), and zip_file_set_dostime().
void _zip_dirent_apply_attributes | ( | zip_dirent_t * | de, |
zip_file_attributes_t * | attributes, | ||
bool | force_zip64, | ||
zip_uint32_t | changed | ||
) |
Definition at line 1117 of file zip_dirent.c.
References _zip_dirent_needs_zip64(), _zip_string_length(), zip_file_attributes::ascii, zip_dirent::bitflags, zip_dirent::comp_method, zip_dirent::encryption_method, zip_dirent::ext_attrib, zip_file_attributes::external_file_attributes, zip_dirent::filename, zip_file_attributes::general_purpose_bit_flags, zip_file_attributes::general_purpose_bit_mask, zip_file_attributes::host_system, zip_dirent::int_attrib, length, mask, zip_string::raw, zip_file_attributes::valid, zip_dirent::version_madeby, zip_file_attributes::version_needed, zip_dirent::version_needed, ZIP_CM_BZIP2, ZIP_CM_DEFLATE, ZIP_CM_LZMA, ZIP_DIRENT_ATTRIBUTES, ZIP_EM_AES_128, ZIP_EM_AES_192, ZIP_EM_AES_256, ZIP_EM_TRAD_PKWARE, ZIP_FILE_ATTRIBUTES_ASCII, ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES, ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS, ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK, ZIP_FILE_ATTRIBUTES_HOST_SYSTEM, ZIP_FILE_ATTRIBUTES_VERSION_NEEDED, and ZIP_MAX.
Referenced by add_data().
zip_dirent_t* _zip_dirent_clone | ( | const zip_dirent_t * | sde | ) |
Definition at line 215 of file zip_dirent.c.
References _zip_dirent_init(), zip_dirent::changed, zip_dirent::cloned, malloc(), memcpy(), and NULL.
Referenced by _zip_file_extra_field_prepare_for_change(), _zip_file_replace(), _zip_set_name(), zip_close(), zip_file_set_comment(), zip_file_set_encryption(), zip_file_set_external_attributes(), zip_file_set_mtime(), and zip_set_file_compression().
void _zip_dirent_finalize | ( | zip_dirent_t * | zde | ) |
Definition at line 234 of file zip_dirent.c.
References _zip_crypto_clear, _zip_ef_free(), _zip_string_free(), zip_dirent::changed, zip_dirent::cloned, zip_dirent::comment, zip_dirent::extra_fields, zip_dirent::filename, free(), NULL, zip_dirent::password, ZIP_DIRENT_COMMENT, ZIP_DIRENT_EXTRA_FIELD, ZIP_DIRENT_FILENAME, and ZIP_DIRENT_PASSWORD.
Referenced by _zip_checkcons(), and _zip_dirent_free().
void _zip_dirent_free | ( | zip_dirent_t * | zde | ) |
Definition at line 258 of file zip_dirent.c.
References _zip_dirent_finalize(), free(), and NULL.
Referenced by _zip_entry_finalize(), _zip_set_name(), _zip_unchange(), _zip_unchange_data(), zip_file_set_comment(), zip_file_set_encryption(), zip_file_set_external_attributes(), and zip_set_file_compression().
void _zip_dirent_init | ( | zip_dirent_t * | de | ) |
Definition at line 268 of file zip_dirent.c.
References zip_dirent::bitflags, zip_dirent::changed, zip_dirent::cloned, zip_dirent::comment, zip_dirent::comp_method, zip_dirent::comp_size, zip_dirent::compression_level, zip_dirent::crc, zip_dirent::crc_valid, zip_dirent::disk_number, zip_dirent::encryption_method, zip_dirent::ext_attrib, zip_dirent::extra_fields, zip_dirent::filename, zip_dirent::int_attrib, zip_dirent::last_mod, zip_dirent::local_extra_fields_read, NULL, zip_dirent::offset, zip_dirent::password, zip_dirent::uncomp_size, zip_dirent::version_madeby, zip_dirent::version_needed, ZIP_CM_DEFAULT, ZIP_EM_NONE, ZIP_EXT_ATTRIB_DEFAULT, and ZIP_OPSYS_DEFAULT.
Referenced by _zip_checkcons(), _zip_dirent_clone(), _zip_dirent_new(), and _zip_dirent_read().
bool _zip_dirent_needs_zip64 | ( | const zip_dirent_t * | de, |
zip_flags_t | flags | ||
) |
Definition at line 296 of file zip_dirent.c.
References zip_dirent::comp_size, flags, zip_dirent::offset, zip_dirent::uncomp_size, ZIP_FL_CENTRAL, and ZIP_UINT32_MAX.
Referenced by _zip_dirent_apply_attributes(), _zip_dirent_write(), _zip_file_get_end(), and zip_close().
zip_dirent_t* _zip_dirent_new | ( | void | ) |
Definition at line 305 of file zip_dirent.c.
References _zip_dirent_init(), malloc(), and NULL.
Referenced by _zip_read_cdir().
|
static |
Definition at line 604 of file zip_dirent.c.
References _zip_buffer_free(), _zip_buffer_get(), _zip_buffer_get_32(), _zip_buffer_get_8(), _zip_buffer_left(), _zip_buffer_new(), _zip_ef_get_by_id(), _zip_string_crc32(), _zip_string_free(), _zip_string_new(), zip_dirent::extra_fields, len, NULL, cmd_descs_generate::str, ZIP_EF_BOTH, and ZIP_FL_ENC_UTF_8.
Referenced by _zip_dirent_read().
|
static |
Definition at line 639 of file zip_dirent.c.
References _zip_buffer_free(), _zip_buffer_get(), _zip_buffer_get_16(), _zip_buffer_get_8(), _zip_buffer_new(), _zip_ef_get_by_id(), zip_dirent::comp_method, zip_dirent::crc_valid, ef, zip_dirent::encryption_method, error(), zip_dirent::extra_fields, NULL, ZIP_CM_WINZIP_AES, ZIP_EF_BOTH, ZIP_EF_WINZIP_AES, ZIP_EM_AES_128, ZIP_EM_AES_192, ZIP_EM_AES_256, ZIP_ER_DETAIL_INVALID_WINZIPAES_EF, ZIP_ER_ENCRNOTSUPP, ZIP_ER_INCONS, ZIP_ER_INTERNAL, and zip_error_set().
Referenced by _zip_dirent_read().
zip_int64_t _zip_dirent_read | ( | zip_dirent_t * | zde, |
zip_source_t * | src, | ||
zip_buffer_t * | buffer, | ||
bool | local, | ||
zip_error_t * | error | ||
) |
Definition at line 327 of file zip_dirent.c.
References _zip_buffer_eof(), _zip_buffer_free(), _zip_buffer_get(), _zip_buffer_get_16(), _zip_buffer_get_32(), _zip_buffer_get_64(), _zip_buffer_left(), _zip_buffer_new(), _zip_buffer_new_from_source(), _zip_buffer_ok(), _zip_buffer_set_offset(), _zip_buffer_skip(), _zip_d2u_time(), _zip_dirent_init(), _zip_dirent_process_ef_utf_8(), _zip_dirent_process_winzip_aes(), _zip_ef_get_by_id(), _zip_ef_parse(), _zip_ef_remove_internal(), _zip_guess_encoding(), _zip_read_data(), _zip_read_string(), zip_dirent::bitflags, CDENTRYSIZE, CENTRAL_MAGIC, zip_dirent::comment, zip_dirent::comp_method, zip_dirent::comp_size, zip_dirent::crc, zip_dirent::disk_number, EFBIG, zip_dirent::encryption_method, error(), zip_dirent::ext_attrib, zip_dirent::extra_fields, zip_dirent::filename, free(), zip_dirent::int_attrib, zip_dirent::last_mod, LENTRYSIZE, local, zip_dirent::local_extra_fields_read, LOCAL_MAGIC, NULL, zip_dirent::offset, ok, src, zip_dirent::uncomp_size, zip_dirent::version_madeby, zip_dirent::version_needed, ZIP_EF_CENTRAL, ZIP_EF_LOCAL, ZIP_EF_UTF_8_COMMENT, ZIP_EF_UTF_8_NAME, ZIP_EF_ZIP64, ZIP_EM_NONE, ZIP_EM_TRAD_PKWARE, ZIP_EM_UNKNOWN, ZIP_ENCODING_ERROR, ZIP_ENCODING_UTF8_KNOWN, ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT, ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME, ZIP_ER_DETAIL_INVALID_ZIP64_EF, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW, ZIP_ER_EOF, ZIP_ER_INCONS, ZIP_ER_INTERNAL, ZIP_ER_MEMORY, ZIP_ER_NOZIP, ZIP_ER_SEEK, zip_error_code_zip(), zip_error_set(), ZIP_GPBF_ENCODING_UTF_8, ZIP_GPBF_ENCRYPTED, ZIP_GPBF_STRONG_ENCRYPTION, ZIP_INT64_MAX, ZIP_UINT16_MAX, and ZIP_UINT32_MAX.
Referenced by _zip_checkcons(), and _zip_read_cdir().
zip_int32_t _zip_dirent_size | ( | zip_source_t * | src, |
zip_uint16_t | flags, | ||
zip_error_t * | error | ||
) |
Definition at line 721 of file zip_dirent.c.
References _zip_buffer_eof(), _zip_buffer_free(), _zip_buffer_get_16(), _zip_buffer_new_from_source(), _zip_error_set_from_source(), b, CDENTRYSIZE, error(), flags, i, LENTRYSIZE, local, NULL, SEEK_CUR, src, ZIP_EF_LOCAL, ZIP_ER_INTERNAL, zip_error_set(), and zip_source_seek().
Referenced by _zip_file_get_offset().
int _zip_dirent_write | ( | zip_t * | za, |
zip_dirent_t * | de, | ||
zip_flags_t | flags | ||
) |
Definition at line 765 of file zip_dirent.c.
References _zip_buffer_free(), _zip_buffer_new(), _zip_buffer_offset(), _zip_buffer_ok(), _zip_buffer_put(), _zip_buffer_put_16(), _zip_buffer_put_32(), _zip_buffer_put_64(), _zip_buffer_put_8(), _zip_dirent_needs_zip64(), _zip_ef_free(), _zip_ef_new(), _zip_ef_size(), _zip_ef_utf8(), _zip_ef_write(), _zip_guess_encoding(), _zip_string_length(), _zip_string_write(), _zip_u2d_time(), _zip_write(), zip_dirent::bitflags, CDENTRYSIZE, CENTRAL_MAGIC, zip_dirent::comment, zip_dirent::comp_method, zip_dirent::comp_size, zip_dirent::crc, zip_dirent::disk_number, ef, EF_WINZIP_AES_SIZE, EFZIP64SIZE, zip_dirent::encryption_method, zip::error, zip_dirent::ext_attrib, zip_dirent::extra_fields, zip_dirent::filename, flags, zip_dirent::int_attrib, zip_dirent::last_mod, LOCAL_MAGIC, zip_extra_field::next, NULL, zip_dirent::offset, zip_dirent::uncomp_size, zip_dirent::version_madeby, zip_dirent::version_needed, za, ZIP_CM_WINZIP_AES, ZIP_EF_BOTH, ZIP_EF_UTF_8_COMMENT, ZIP_EF_UTF_8_NAME, ZIP_EF_WINZIP_AES, ZIP_EF_ZIP64, ZIP_EM_AES_128, ZIP_EM_AES_192, ZIP_EM_AES_256, ZIP_EM_NONE, ZIP_ENCODING_ASCII, ZIP_ENCODING_UNKNOWN, ZIP_ENCODING_UTF8_KNOWN, ZIP_ER_INTERNAL, ZIP_ER_MEMORY, zip_error_set(), ZIP_FL_FORCE_ZIP64, ZIP_FL_LOCAL, ZIP_GPBF_ENCODING_UTF_8, ZIP_GPBF_ENCRYPTED, ZIP_MAX, and ZIP_UINT32_MAX.
Referenced by _zip_cdir_write(), add_data(), and zip_close().
|
static |
Definition at line 1025 of file zip_dirent.c.
References _zip_buffer_data(), _zip_buffer_free(), _zip_buffer_new(), _zip_buffer_offset(), _zip_buffer_ok(), _zip_buffer_put(), _zip_buffer_put_32(), _zip_buffer_put_8(), _zip_ef_new(), _zip_string_crc32(), _zip_string_get(), ef, error(), len, NULL, cmd_descs_generate::str, ZIP_EF_BOTH, ZIP_ER_INTERNAL, ZIP_ER_INVAL, ZIP_ER_MEMORY, zip_error_set(), ZIP_FL_ENC_RAW, and ZIP_UINT16_MAX.
Referenced by _zip_dirent_write().
zip_dirent_t* _zip_get_dirent | ( | zip_t * | za, |
zip_uint64_t | idx, | ||
zip_flags_t | flags, | ||
zip_error_t * | error | ||
) |
Definition at line 1064 of file zip_dirent.c.
References zip_entry::changes, zip_entry::deleted, zip::entry, zip::error, error(), flags, setup::idx, zip::nentry, NULL, zip_entry::orig, za, ZIP_ER_DELETED, ZIP_ER_INVAL, zip_error_set(), and ZIP_FL_UNCHANGED.
Referenced by _zip_get_name(), _zip_source_zip_new(), zip_file_extra_field_delete(), zip_file_extra_field_delete_by_id(), zip_file_extra_field_get(), zip_file_extra_field_get_by_id(), zip_file_extra_field_set(), zip_file_extra_fields_count(), zip_file_extra_fields_count_by_id(), zip_file_get_comment(), zip_file_get_external_attributes(), zip_file_set_comment(), zip_file_set_external_attributes(), zip_file_set_mtime(), and zip_stat_index().
void _zip_u2d_time | ( | time_t | intime, |
zip_uint16_t * | dtime, | ||
zip_uint16_t * | ddate | ||
) |
Definition at line 1090 of file zip_dirent.c.
References NULL.
Referenced by _zip_dirent_write(), decrypt_header(), and encrypt_header().