aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-11 22:10:52 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-11 22:10:52 +0200
commit38d966943f5288bb1f2e7219f50a92753c730b14 (patch)
tree81c4f3651e86b8aaed94cbae0ffaec3e3fe2dbc3
parentce55284ed6f5b5303d9e45d034287c728ef9b05a (diff)
downloadbusybox-w32-38d966943f5288bb1f2e7219f50a92753c730b14.tar.gz
busybox-w32-38d966943f5288bb1f2e7219f50a92753c730b14.tar.bz2
busybox-w32-38d966943f5288bb1f2e7219f50a92753c730b14.zip
unzip: TODO for symlink support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/unzip.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 51025529d..488dcf31d 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -346,6 +346,12 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
346 return; 346 return;
347 } 347 }
348 348
349// NB: to support symlinks, need to extract symlink target. A-la:
350// xstate.mem_output_size_max = zip->fmt.ucmpsize;
351// ...unpack...
352// if (xstate.mem_output_buf) { success, xstate.mem_output_size is the size }
353// Although archives I've seen have fmt.method == 0 for symlinks.
354
349 init_transformer_state(&xstate); 355 init_transformer_state(&xstate);
350 xstate.bytes_in = zip->fmt.cmpsize; 356 xstate.bytes_in = zip->fmt.cmpsize;
351 xstate.src_fd = zip_fd; 357 xstate.src_fd = zip_fd;
@@ -685,6 +691,20 @@ int unzip_main(int argc, char **argv)
685 zip.fmt.cmpsize = cdf.fmt.cmpsize; 691 zip.fmt.cmpsize = cdf.fmt.cmpsize;
686 zip.fmt.ucmpsize = cdf.fmt.ucmpsize; 692 zip.fmt.ucmpsize = cdf.fmt.ucmpsize;
687 } 693 }
694// Seen in some zipfiles: central directory 9 byte extra field contains
695// a subfield with ID 0x5455 and 5 data bytes, which is a Unix-style UTC mtime.
696// Local header version:
697// u16 0x5455 ("UT")
698// u16 size (1 + 4 * n)
699// u8 flags: bit 0:mtime is present, bit 1:atime is present, bit 2:ctime is present
700// u32 mtime
701// u32 atime
702// u32 ctime
703// Central header version:
704// u16 0x5455 ("UT")
705// u16 size (5 (or 1?))
706// u8 flags: bit 0:mtime is present, bit 1:atime is present, bit 2:ctime is present
707// u32 mtime (CDF does not store atime/ctime)
688# else 708# else
689 /* CDF has the same data as local header, no need to read the latter... 709 /* CDF has the same data as local header, no need to read the latter...
690 * ...not really. An archive was seen with cdf.extra_len == 6 but 710 * ...not really. An archive was seen with cdf.extra_len == 6 but
@@ -699,6 +719,7 @@ int unzip_main(int argc, char **argv)
699 if ((cdf.fmt.version_made_by >> 8) == 3) { 719 if ((cdf.fmt.version_made_by >> 8) == 3) {
700 /* This archive is created on Unix */ 720 /* This archive is created on Unix */
701 dir_mode = file_mode = (cdf.fmt.external_attributes >> 16); 721 dir_mode = file_mode = (cdf.fmt.external_attributes >> 16);
722//TODO: if (S_ISLNK(file_mode)) this is a symlink
702 } 723 }
703 } 724 }
704#endif 725#endif