new upstream release 6.0

This commit is contained in:
Karel Klíč 2009-11-19 08:27:27 +00:00
parent f1c1870eba
commit 1fdabb4356
18 changed files with 176 additions and 739 deletions

View File

@ -1 +1 @@
unzip552.tar.gz
unzip60.tar.gz

View File

@ -1 +1 @@
9d23919999d6eac9217d1f41472034a9 unzip552.tar.gz
62b490407489521db863b523a7f86375 unzip60.tar.gz

View File

@ -1,18 +0,0 @@
--- unzip-5.51/unix/unix.c.mmm 2004-04-12 02:29:58.000000000 +0200
+++ unzip-5.51/unix/unix.c 2005-02-03 14:59:46.280095080 +0100
@@ -1049,10 +1049,13 @@
"warning: symbolic link (%s) failed\n",
FnFilter1(G.filename)));
free(slnk_entry);
- fclose(G.outfile);
+ if (G.outfile)
+ fclose(G.outfile);
return;
}
- fclose(G.outfile); /* close "link" file for good... */
+
+ if (G.outfile)
+ fclose(G.outfile); /* close "link" file for good... */
slnk_entry->target[ucsize] = '\0';
if (QCOND2)
Info(slide, 0, ((char *)slide, "-> %s ",

View File

@ -1,10 +0,0 @@
--- unzip-5.51/unix/unix.c.morn 2005-02-08 14:40:40.187895928 +0100
+++ unzip-5.51/unix/unix.c 2005-02-08 14:44:59.025546624 +0100
@@ -1002,6 +1002,7 @@
ush z_uidgid[2];
int have_uidgid_flg;
+ fchmod(fileno(G.outfile), 0400);
fclose(G.outfile);
/*---------------------------------------------------------------------------

View File

@ -1,24 +0,0 @@
diff -up unzip-5.52/globals.h.pom unzip-5.52/globals.h
--- unzip-5.52/globals.h.pom 2008-01-22 14:54:15.000000000 +0100
+++ unzip-5.52/globals.h 2008-01-22 14:54:26.000000000 +0100
@@ -183,7 +183,7 @@ typedef struct Globals {
int newzip; /* reset in extract.c; used in crypt.c */
Z_OFF_T real_ecrec_offset;
Z_OFF_T expect_ecrec_offset;
- long csize; /* used by decompr. (NEXTBYTE): must be signed */
+ long long csize; /* used by decompr. (NEXTBYTE): must be signed */
long used_csize; /* used by extract_or_test_member(), explode() */
#ifdef DLL
diff -up unzip-5.52/process.c.pom unzip-5.52/process.c
--- unzip-5.52/process.c.pom 2008-01-22 14:54:15.000000000 +0100
+++ unzip-5.52/process.c 2008-01-22 14:54:47.000000000 +0100
@@ -1288,7 +1288,7 @@ int process_local_file_hdr(__G) /* re
G.lrec.ucsize = G.pInfo->uncompr_size;
}
- G.csize = (long)G.lrec.csize;
+ G.csize = (long long)G.lrec.csize;
return PK_COOL;

View File

@ -1,115 +0,0 @@
diff -up unzip-5.52/globals.h.pom unzip-5.52/globals.h
--- unzip-5.52/globals.h.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/globals.h 2008-01-23 14:20:11.000000000 +0100
@@ -247,9 +247,9 @@ typedef struct Globals {
#else
int zipfd; /* zipfile file handle */
#endif
- Z_OFF_T ziplen;
- Z_OFF_T cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */
- Z_OFF_T extra_bytes; /* used in unzip.c, misc.c */
+ ulg ziplen;
+ ulg cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */
+ ulg extra_bytes; /* used in unzip.c, misc.c */
uch *extra_field; /* Unix, VMS, Mac, OS/2, Acorn, ... */
uch *hold;
diff -up unzip-5.52/list.c.pom unzip-5.52/list.c
--- unzip-5.52/list.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/list.c 2008-01-23 14:20:11.000000000 +0100
@@ -62,12 +62,12 @@
"%8lu %-7s%8lu %4s %02u%c%02u%c%02u %02u:%02u %08lx %c";
static ZCONST char Far LongFileTrailer[] =
"-------- ------- --- \
- -------\n%8ju %8ju %4s %lu file%s\n";
+ -------\n%8llu %8llu %4s %lu file%s\n";
#ifdef OS2_EAS
static ZCONST char Far ShortHdrStats[] =
"%9lu %6lu %6lu %02u%c%02u%c%02u %02u:%02u %c";
static ZCONST char Far ShortFileTrailer[] = " -------- ----- ----- \
- -------\n%9ju %6lu %6lu %lu file%s\n";
+ -------\n%9llu %6lu %6lu %lu file%s\n";
static ZCONST char Far OS2ExtAttrTrailer[] =
"%lu file%s %lu bytes of OS/2 extended attributes attached.\n";
static ZCONST char Far OS2ACLTrailer[] =
diff -up unzip-5.52/unzpriv.h.pom unzip-5.52/unzpriv.h
--- unzip-5.52/unzpriv.h.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/unzpriv.h 2008-01-23 14:23:21.000000000 +0100
@@ -1903,7 +1903,7 @@ void defer_leftover_input OF((__GPRO
unsigned readbuf OF((__GPRO__ char *buf, register unsigned len));
int readbyte OF((__GPRO));
int fillinbuf OF((__GPRO));
-int seek_zipf OF((__GPRO__ Z_OFF_T abs_offset));
+int seek_zipf OF((__GPRO__ ulg abs_offset));
#ifdef FUNZIP
int flush OF((__GPRO__ ulg size)); /* actually funzip.c */
#else
diff -up unzip-5.52/fileio.c.pom unzip-5.52/fileio.c
--- unzip-5.52/fileio.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/fileio.c 2008-01-23 14:20:11.000000000 +0100
@@ -669,7 +669,7 @@ int fillinbuf(__G) /* like readbyte() ex
int seek_zipf(__G__ abs_offset)
__GDEF
- Z_OFF_T abs_offset;
+ ulg abs_offset;
{
/*
* Seek to the block boundary of the block which includes abs_offset,
@@ -690,9 +690,9 @@ int seek_zipf(__G__ abs_offset)
* PK_EOF if seeking past end of zipfile
* PK_OK when seek was successful
*/
- Z_OFF_T request = abs_offset + G.extra_bytes;
- Z_OFF_T inbuf_offset = request % INBUFSIZ;
- Z_OFF_T bufstart = request - inbuf_offset;
+ ulg request = abs_offset + G.extra_bytes;
+ ulg inbuf_offset = request % INBUFSIZ;
+ ulg bufstart = request - inbuf_offset;
if (request > (Z_OFF_T) MAX_ZIP_SIZE) {
Info(slide, 1, ((char *)slide, LoadFarStringSmall(SeekMsg),
diff -up unzip-5.52/process.c.pom unzip-5.52/process.c
--- unzip-5.52/process.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/process.c 2008-01-23 14:20:11.000000000 +0100
@@ -915,7 +915,7 @@ static int find_ecrec(__G__ searchlen)
long searchlen;
{
int i, numblks, found=FALSE;
- Z_OFF_T tail_len;
+ ulg tail_len;
ec_byte_rec byterec;
diff -up unzip-5.52/extract.c.pom unzip-5.52/extract.c
--- unzip-5.52/extract.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/extract.c 2008-01-23 14:20:11.000000000 +0100
@@ -301,16 +301,16 @@ int extract_or_test_files(__G) /* ret
__GDEF
{
unsigned i, j;
- Z_OFF_T cd_bufstart;
+ ulg cd_bufstart;
uch *cd_inptr;
int cd_incnt;
ulg filnum=0L, blknum=0L;
int reached_end, no_endsig_found;
int error, error_in_archive=PK_COOL;
int *fn_matched=NULL, *xn_matched=NULL;
- Z_OFF_T members_processed;
+ ulg members_processed;
ulg num_skipped=0L, num_bad_pwd=0L;
- Z_OFF_T old_extra_bytes = 0L;
+ ulg old_extra_bytes = 0L;
#ifdef SET_DIR_ATTRIB
unsigned num_dirs=0;
direntry *dirlist=(direntry *)NULL, **sorted_dirlist=(direntry **)NULL;
@@ -908,7 +908,7 @@ static int extract_or_test_entrylist(__G
unsigned i;
int renamed, query;
int skip_entry;
- Z_OFF_T bufstart, inbuf_offset, request;
+ ulg bufstart, inbuf_offset, request;
int error, errcode;
/* possible values for local skip_entry flag: */

View File

@ -1,42 +0,0 @@
diff -up unzip-5.52/inflate.c.pom unzip-5.52/inflate.c
--- unzip-5.52/inflate.c.pom 2005-02-27 07:08:46.000000000 +0100
+++ unzip-5.52/inflate.c 2008-03-19 14:47:58.000000000 +0100
@@ -983,6 +983,7 @@ static int inflate_dynamic(__G)
unsigned l; /* last length */
unsigned m; /* mask for bit lengths table */
unsigned n; /* number of lengths to get */
+ struct huft *tlp;
struct huft *tl; /* literal/length code table */
struct huft *td; /* distance code table */
unsigned bl; /* lookup bits for tl */
@@ -995,6 +996,7 @@ static int inflate_dynamic(__G)
register unsigned k; /* number of bits in bit buffer */
int retval = 0; /* error code returned: initialized to "no error" */
+ td = tlp = tl = (struct huft *)NULL;
/* make local bit buffer */
Trace((stderr, "\ndynamic block"));
@@ -1047,9 +1049,9 @@ static int inflate_dynamic(__G)
while (i < n)
{
NEEDBITS(bl)
- j = (td = tl + ((unsigned)b & m))->b;
+ j = (tlp = tl + ((unsigned)b & m))->b;
DUMPBITS(j)
- j = td->v.n;
+ j = tlp->v.n;
if (j < 16) /* length of code in bits (0..15) */
ll[i++] = l = j; /* save last length in l */
else if (j == 16) /* repeat last length 3 to 6 times */
@@ -1149,8 +1151,8 @@ static int inflate_dynamic(__G)
cleanup_and_exit:
/* free the decoding tables, return */
- huft_free(tl);
- huft_free(td);
+ if (tl) huft_free(tl);
+ if (td) huft_free(td);
return retval;
}

View File

@ -1,68 +0,0 @@
--- unzip-5.52/process.c.pom3 2006-02-06 10:29:02.630237064 +0100
+++ unzip-5.52/process.c 2006-02-06 10:29:02.650234024 +0100
@@ -576,16 +576,16 @@
if (lastchance && (uO.qflag < 3)) {
#if defined(UNIX) || defined(QDOS)
if (G.no_ecrec)
- Info(slide, 1, ((char *)slide,
+ Info2(slide, 1, ((char *)slide, WSIZE,
LoadFarString(CannotFindZipfileDirMsg), uO.zipinfo_mode?
LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip),
G.wildzipfn, uO.zipinfo_mode? " " : "", G.wildzipfn,
- G.zipfn));
+ G.zipfn),WSIZE);
else
- Info(slide, 1, ((char *)slide,
+ Info2(slide, 1, ((char *)slide, WSIZE,
LoadFarString(CannotFindEitherZipfile), uO.zipinfo_mode?
LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip),
- G.wildzipfn, G.wildzipfn, G.zipfn));
+ G.wildzipfn, G.wildzipfn, G.zipfn), WSIZE);
#else /* !(UNIX || QDOS) */
if (G.no_ecrec)
Info(slide, 0x401, ((char *)slide,
--- unzip-5.52/fileio.c.pom3 2006-02-06 10:29:02.000000000 +0100
+++ unzip-5.52/fileio.c 2006-02-06 10:30:59.755431328 +0100
@@ -1188,8 +1188,14 @@
#endif /* !VMS */
+/****************/
+/* Function min */
+/****************/
-
+int min (int val_i, int val_j)
+{
+ return (val_i>val_j?val_j:val_i);
+}
/*****************************/
--- unzip-5.52/unzpriv.h.pom3 2006-02-06 10:29:02.625237824 +0100
+++ unzip-5.52/unzpriv.h 2006-02-06 10:31:45.538471248 +0100
@@ -2286,6 +2286,24 @@
# endif
#endif /* !Info */
+#ifndef Info2 /* may already have been defined for redirection */
+# ifdef FUNZIP
+# define Info2(buf,flag,sprf_arg,size) \
+ fprintf((flag)&1? stderr : stdout, (char *)(sprintf sprf_arg, (buf)))
+# else
+# ifdef INT_SPRINTF /* optimized version for "int sprintf()" flavour */
+# define Info2(buf,flag,sprf_arg,size) \
+ (*G.message)((zvoid *)&G, (uch *)(buf), (ulg) min(snprintf sprf_arg, (int) size), (flag))
+# else /* generic version, does not use sprintf() return value */
+# define Info2(buf,flag,sprf_arg,size) \
+ (*G.message)((zvoid *)&G, (uch *)(buf), \
+ (ulg)(sprintf sprf_arg, strlen((char *)(buf))), (flag))
+# endif
+# endif
+#endif /* !Info */
+
+
+
/* The following macro wrappers around the fnfilter function are used many
* times to prepare archive entry names or name components for displaying
* listings and (warning/error) messages. They use sections in the upper half

View File

@ -1,10 +0,0 @@
--- unzip-5.52/unix/Makefile.pom 2007-02-06 12:56:35.000000000 +0100
+++ unzip-5.52/unix/Makefile 2007-02-06 12:57:06.000000000 +0100
@@ -415,7 +415,6 @@
unix_make:
# @echo\
# '(Ignore any errors from `make'"' due to the following command; it's harmless.)"
- -@2>&1 $(LN) unix/Makefile . > /dev/null || echo > /dev/null
# this really only works for Unix targets, unless E and O specified on cmd line
clean:

View File

@ -1,258 +0,0 @@
--- unzip-5.52/extract.c.4GB 2005-02-26 05:47:30.000000000 +0100
+++ unzip-5.52/extract.c 2005-12-22 13:39:54.903205040 +0100
@@ -308,7 +308,7 @@
int reached_end, no_endsig_found;
int error, error_in_archive=PK_COOL;
int *fn_matched=NULL, *xn_matched=NULL;
- unsigned members_processed;
+ Z_OFF_T members_processed;
ulg num_skipped=0L, num_bad_pwd=0L;
Z_OFF_T old_extra_bytes = 0L;
#ifdef SET_DIR_ATTRIB
@@ -541,7 +541,7 @@
G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd);
#else /* !USE_STRM_INPUT */
G.cur_zipfile_bufstart =
- lseek(G.zipfd, cd_bufstart, SEEK_SET);
+ lseek64(G.zipfd,(Z_OFF_T)cd_bufstart, SEEK_SET);
#endif /* ?USE_STRM_INPUT */
read(G.zipfd, (char *)G.inbuf, INBUFSIZ); /* been here before... */
G.inptr = cd_inptr;
@@ -942,7 +942,8 @@
Trace((stderr,
"debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
(long)bufstart, (long)G.cur_zipfile_bufstart));
- if (request < 0) {
+ if (request > MAX_ZIP_SIZE) { /* >2^32-8193 */
+ printf("retry - request = 0x%lu\n", (ulg)request);
Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg),
G.zipfn, LoadFarString(ReportMsg)));
error_in_archive = PK_ERR;
@@ -982,7 +983,7 @@
G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd);
#else /* !USE_STRM_INPUT */
G.cur_zipfile_bufstart =
- lseek(G.zipfd, bufstart, SEEK_SET);
+ lseek64(G.zipfd, bufstart, SEEK_SET);
#endif /* ?USE_STRM_INPUT */
if ((G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) <= 0)
{
--- unzip-5.52/unix/Makefile.4GB 2005-12-22 13:39:54.767225712 +0100
+++ unzip-5.52/unix/Makefile 2005-12-22 13:39:54.904204888 +0100
@@ -783,7 +783,7 @@
# Linux (Posix, approximately SysV): virtually any version since before 0.96,
# for any platform. Change "-O" to "-O3" or whatever, as desired...
linux_noasm: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_GNU_SOURCE -Wall -I. $(LOC)"
+ $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -Wall -I. $(LOC)"
# Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3
--- unzip-5.52/unzpriv.h.4GB 2005-02-04 00:26:42.000000000 +0100
+++ unzip-5.52/unzpriv.h 2005-12-22 13:39:54.905204736 +0100
@@ -785,9 +785,9 @@
#endif
#ifndef SSTAT
# ifdef WILD_STAT_BUG
-# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
+# define SSTAT(path,pbuf) (iswild(path) || stat64(path,pbuf))
# else
-# define SSTAT stat
+# define SSTAT stat64
# endif
#endif
#ifndef STRNICMP
--- unzip-5.52/list.c.4GB 2005-01-27 02:02:02.000000000 +0100
+++ unzip-5.52/list.c 2005-12-22 13:39:54.908204280 +0100
@@ -62,12 +62,12 @@
"%8lu %-7s%8lu %4s %02u%c%02u%c%02u %02u:%02u %08lx %c";
static ZCONST char Far LongFileTrailer[] =
"-------- ------- --- \
- -------\n%8lu %8lu %4s %lu file%s\n";
+ -------\n%8ju %8ju %4s %lu file%s\n";
#ifdef OS2_EAS
static ZCONST char Far ShortHdrStats[] =
"%9lu %6lu %6lu %02u%c%02u%c%02u %02u:%02u %c";
static ZCONST char Far ShortFileTrailer[] = " -------- ----- ----- \
- -------\n%9lu %6lu %6lu %lu file%s\n";
+ -------\n%9ju %6lu %6lu %lu file%s\n";
static ZCONST char Far OS2ExtAttrTrailer[] =
"%lu file%s %lu bytes of OS/2 extended attributes attached.\n";
static ZCONST char Far OS2ACLTrailer[] =
@@ -105,7 +105,8 @@
struct tm *t;
#endif
unsigned yr, mo, dy, hh, mm;
- ulg csiz, tot_csize=0L, tot_ucsize=0L;
+ ulg csiz;
+ unsigned long long tot_csize=0, tot_ucsize=0;
#ifdef OS2_EAS
ulg ea_size, tot_easize=0L, tot_eafiles=0L;
ulg acl_size, tot_aclsize=0L, tot_aclfiles=0L;
--- unzip-5.52/unzip.h.4GB 2005-02-26 16:23:18.000000000 +0100
+++ unzip-5.52/unzip.h 2005-12-22 13:39:54.909204128 +0100
@@ -604,6 +604,8 @@
#define UZ_ST_CONTINUE 0
#define UZ_ST_BREAK 1
+#define MAX_ZIP_SIZE 0xffffdffe
+
/*---------------------------------------------------------------------------
Prototypes for public UnZip API (DLL) functions.
--- unzip-5.52/fileio.c.4GB 2005-02-27 03:10:12.000000000 +0100
+++ unzip-5.52/fileio.c 2005-12-22 13:59:17.959393624 +0100
@@ -113,6 +113,9 @@
/* Strings used in fileio.c */
/****************************/
+static ZCONST char Far ZipFileTooBig[] =
+ "error: Zip file too big (greater than %lu bytes)\n";
+
static ZCONST char Far CannotOpenZipfile[] =
"error: cannot open zipfile [ %s ]\n %s\n";
@@ -183,6 +186,7 @@
int open_input_file(__G) /* return 1 if open failed */
__GDEF
{
+ struct stat64 sb;
/*
* open the zipfile for reading and in BINARY mode to prevent cr/lf
* translation, which would corrupt the bitstreams
@@ -201,9 +205,9 @@
G.zipfd = fopen(G.zipfn, FOPR);
#else /* !USE_STRM_INPUT */
# ifdef O_BINARY
- G.zipfd = open(G.zipfn, O_RDONLY | O_BINARY);
+ G.zipfd = open(G.zipfn, O_RDONLY | O_BINARY | O_LARGEFILE);
# else
- G.zipfd = open(G.zipfn, O_RDONLY);
+ G.zipfd = open(G.zipfn, O_RDONLY | O_LARGEFILE);
# endif
#endif /* ?USE_STRM_INPUT */
#endif /* ?CMS_MVS */
@@ -221,6 +225,12 @@
G.zipfn, strerror(errno)));
return 1;
}
+ fstat64(G.zipfd, &sb);
+ if (sb.st_size > MAX_ZIP_SIZE) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(ZipFileTooBig),
+ ((ulg)MAX_ZIP_SIZE)));
+ }
return 0;
} /* end function open_input_file() */
@@ -238,6 +248,7 @@
int open_outfile(__G) /* return 1 if fail */
__GDEF
{
+ int fd;
#ifdef DLL
if (G.redirect_data)
return (redirect_outfile(__G) == FALSE);
@@ -259,7 +270,7 @@
}
#endif /* BORLAND_STAT_BUG */
#ifdef SYMLINKS
- if (SSTAT(G.filename, &G.statbuf) == 0 || lstat(G.filename,&G.statbuf) == 0)
+ if (SSTAT(G.filename, &G.statbuf) == 0 || lstat64(G.filename,&G.statbuf) == 0)
#else
if (SSTAT(G.filename, &G.statbuf) == 0)
#endif /* ?SYMLINKS */
@@ -413,7 +424,9 @@
#endif /* NOVELL_BUG_FAILSAFE */
Trace((stderr, "open_outfile: doing fopen(%s) for writing\n",
FnFilter1(G.filename)));
- if ((G.outfile = fopen(G.filename, FOPW)) == (FILE *)NULL) {
+
+ fd = open(G.filename, O_WRONLY | O_LARGEFILE | O_CREAT);
+ if ((G.outfile = fdopen(fd, FOPW)) == (FILE *)NULL) {
Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile),
FnFilter1(G.filename)));
return 1;
@@ -682,7 +695,7 @@
Z_OFF_T inbuf_offset = request % INBUFSIZ;
Z_OFF_T bufstart = request - inbuf_offset;
- if (request < 0) {
+ if (request > (Z_OFF_T) MAX_ZIP_SIZE) {
Info(slide, 1, ((char *)slide, LoadFarStringSmall(SeekMsg),
G.zipfn, LoadFarString(ReportMsg)));
return(PK_BADERR);
@@ -694,7 +707,7 @@
fseek(G.zipfd, bufstart, SEEK_SET);
G.cur_zipfile_bufstart = ftell(G.zipfd);
#else /* !USE_STRM_INPUT */
- G.cur_zipfile_bufstart = lseek(G.zipfd, bufstart, SEEK_SET);
+ G.cur_zipfile_bufstart = lseek64(G.zipfd, bufstart, SEEK_SET);
#endif /* ?USE_STRM_INPUT */
Trace((stderr,
" request = %ld, (abs+extra) = %ld, inbuf_offset = %ld\n",
@@ -1850,7 +1863,7 @@
Trace((stderr, "check_for_newer: doing lstat(%s)\n",
FnFilter1(filename)));
/* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
- if (lstat(filename, &G.statbuf) == 0) {
+ if (lstat64(filename, &G.statbuf) == 0) {
Trace((stderr,
"check_for_newer: lstat(%s) returns 0: symlink does exist\n",
FnFilter1(filename)));
@@ -1867,7 +1880,7 @@
#ifdef SYMLINKS
/* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
- if (lstat(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) {
+ if (lstat64(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) {
Trace((stderr, "check_for_newer: %s is a symbolic link\n",
FnFilter1(filename)));
if (QCOND2 && !IS_OVERWRT_ALL)
--- unzip-5.52/process.c.4GB 2004-11-22 01:42:54.000000000 +0100
+++ unzip-5.52/process.c 2005-12-22 13:39:54.911203824 +0100
@@ -923,8 +923,8 @@
Treat case of short zipfile separately.
---------------------------------------------------------------------------*/
- if (G.ziplen <= INBUFSIZ) {
- lseek(G.zipfd, 0L, SEEK_SET);
+ if ((unsigned long)G.ziplen <= (unsigned long)INBUFSIZ) {
+ lseek64(G.zipfd, 0L, SEEK_SET);
if ((G.incnt = read(G.zipfd,(char *)G.inbuf,(unsigned int)G.ziplen))
== (int)G.ziplen)
@@ -951,7 +951,7 @@
fseek((FILE *)G.zipfd, G.ziplen-tail_len, SEEK_SET);
G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd);
#else /* !USE_STRM_INPUT */
- G.cur_zipfile_bufstart = lseek(G.zipfd, G.ziplen-tail_len,
+ G.cur_zipfile_bufstart = lseek64(G.zipfd, G.ziplen-tail_len,
SEEK_SET);
#endif /* ?USE_STRM_INPUT */
if ((G.incnt = read(G.zipfd, (char *)G.inbuf,
@@ -985,7 +985,7 @@
for (i = 1; !found && (i <= numblks); ++i) {
G.cur_zipfile_bufstart -= INBUFSIZ;
- lseek(G.zipfd, G.cur_zipfile_bufstart, SEEK_SET);
+ lseek64(G.zipfd, G.cur_zipfile_bufstart, SEEK_SET);
if ((G.incnt = read(G.zipfd,(char *)G.inbuf,INBUFSIZ))
!= INBUFSIZ)
break; /* fall through and fail */
--- unzip-5.52/globals.h.4GB 2004-11-22 01:42:00.000000000 +0100
+++ unzip-5.52/globals.h 2005-12-22 13:39:54.912203672 +0100
@@ -256,7 +256,12 @@
local_file_hdr lrec; /* used in unzip.c, extract.c */
cdir_file_hdr crec; /* used in unzip.c, extract.c, misc.c */
ecdir_rec ecrec; /* used in unzip.c, extract.c */
- struct stat statbuf; /* used by main, mapname, check_for_newer */
+#ifdef _LARGEFILE64_SOURCE
+ struct stat64 statbuf; /* used by main, mapname, check_for_newer */
+#else
+ struct stat statbuf; /* used by main, mapname, check_for_newer */
+#endif
+
int mem_mode;
uch *outbufptr; /* extract.c static */

View File

@ -1,11 +0,0 @@
--- unzip-5.52/list.c.pom 2006-02-06 09:39:47.622466528 +0100
+++ unzip-5.52/list.c 2006-02-06 09:57:00.813397632 +0100
@@ -76,7 +76,7 @@
static ZCONST char Far ShortHdrStats[] =
"%9lu %02u%c%02u%c%02u %02u:%02u %c";
static ZCONST char Far ShortFileTrailer[] = " -------- \
- -------\n%9lu %lu file%s\n";
+ -------\n%9ju %lu file%s\n";
#endif /* ?OS2_EAS */
#endif /* !WINDLL */

View File

@ -1,19 +0,0 @@
--- unzip-5.52/fileio.c.pom 2007-08-30 11:36:05.000000000 +0200
+++ unzip-5.52/fileio.c 2007-09-04 10:37:41.000000000 +0200
@@ -53,7 +53,6 @@
---------------------------------------------------------------------------*/
-
#define __FILEIO_C /* identifies this source module */
#define UNZIP_INTERNAL
#include "unzip.h"
@@ -425,7 +424,7 @@ int open_outfile(__G) /* return
Trace((stderr, "open_outfile: doing fopen(%s) for writing\n",
FnFilter1(G.filename)));
- fd = open(G.filename, O_WRONLY | O_LARGEFILE | O_CREAT);
+ fd = open(G.filename, O_WRONLY | O_LARGEFILE | O_CREAT, 0600);
if ((G.outfile = fdopen(fd, FOPW)) == (FILE *)NULL) {
Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile),
FnFilter1(G.filename)));

View File

@ -1,37 +0,0 @@
--- unzip-5.52/unix/unix.c.toctou 2005-12-20 13:28:52.000000000 +0100
+++ unzip-5.52/unix/unix.c 2005-12-20 13:52:02.773125776 +0100
@@ -1043,6 +1043,17 @@
int have_uidgid_flg;
fchmod(fileno(G.outfile), 0400);
+
+/*---------------------------------------------------------------------------
+ Change the file permissions from default ones to those stored in the
+ zipfile. It is necessary to change permissions before fclose command.
+ ---------------------------------------------------------------------------*/
+
+#ifndef NO_CHMOD
+ if (fchmod(fileno(G.outfile), 0xffff & G.pInfo->file_attr))
+ perror("chmod (file attributes) error");
+#endif
+
fclose(G.outfile);
/*---------------------------------------------------------------------------
@@ -1155,16 +1166,6 @@
#endif /* ?AOS_VS */
}
-/*---------------------------------------------------------------------------
- Change the file permissions from default ones to those stored in the
- zipfile.
- ---------------------------------------------------------------------------*/
-
-#ifndef NO_CHMOD
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
- perror("chmod (file attributes) error");
-#endif
-
} /* end function close_outfile() */
#endif /* !MTS */

View File

@ -0,0 +1,29 @@
diff -up unzip60/unix/configure.bzip2-configure unzip60/unix/configure
--- unzip60/unix/configure.bzip2-configure 2009-04-16 21:25:12.000000000 +0200
+++ unzip60/unix/configure 2009-11-18 11:22:14.598389194 +0100
@@ -640,7 +640,24 @@ else
D_USE_BZ2="-DUSE_BZIP2"
L_BZ2="${BZLF} -lbz2"
else
- echo "-- bzip2 sources not found - no bzip2 support"
+ echo " Check if OS already has bzip2 library installed"
+ cat > conftest.c << _EOF_
+#include "bzlib.h"
+int main()
+{
+ bz_stream strm;
+ BZ2_bzCompressEnd(&strm);
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
+ if test $? -eq 0; then
+ echo "-- OS supports bzip2 - linking in bzip2"
+ D_USE_BZ2="-DBZIP2_SUPPORT"
+ L_BZ2="${BZLF} -lbz2"
+ else
+ echo "-- Either bzlib.h or libbz2.a not found - no bzip2"
+ fi
fi
fi

View File

@ -1,19 +1,38 @@
diff -up unzip-5.52/unzpriv.h.err unzip-5.52/unzpriv.h
--- unzip-5.52/unzpriv.h.err 2008-02-08 14:51:52.000000000 +0100
+++ unzip-5.52/unzpriv.h 2008-02-08 14:51:52.000000000 +0100
@@ -2182,7 +2182,7 @@ char *GetLoadPath OF((__GPRO));
int SetFileSize OF((FILE *file, ulg filesize)); /* local */
diff -up unzip60/extract.c.close unzip60/extract.c
--- unzip60/extract.c.close 2009-03-14 02:32:52.000000000 +0100
+++ unzip60/extract.c 2009-11-19 08:17:23.481263496 +0100
@@ -1924,24 +1924,21 @@ static int extract_or_test_member(__G)
#ifdef VMS /* VMS: required even for stdout! (final flush) */
if (!uO.tflag) /* don't close NULL file */
- close_outfile(__G);
+ error = close_outfile(__G);
#else
#ifdef DLL
if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
if (G.redirect_data)
FINISH_REDIRECT();
else
- close_outfile(__G);
+ error = close_outfile(__G);
}
#else
if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
- close_outfile(__G);
+ error = close_outfile(__G);
#endif
#ifndef MTS /* macro in MTS */
- void close_outfile OF((__GPRO)); /* local */
+ int close_outfile OF((__GPRO)); /* local */
#endif
#ifdef SET_SYMLINK_ATTRIBS
int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */
diff -up unzip-5.52/unix/unix.c.err unzip-5.52/unix/unix.c
--- unzip-5.52/unix/unix.c.err 2008-02-08 14:51:52.000000000 +0100
+++ unzip-5.52/unix/unix.c 2008-02-08 15:04:15.000000000 +0100
@@ -1029,10 +1029,41 @@ static int get_extattribs(__G__ pzt, z_u
#endif /* VMS */
- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
-
-
if (G.disk_full) { /* set by flush() */
if (G.disk_full > 1) {
#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
diff -up unzip60/unix/unix.c.close unzip60/unix/unix.c
--- unzip60/unix/unix.c.close 2009-01-24 00:31:26.000000000 +0100
+++ unzip60/unix/unix.c 2009-11-19 08:33:25.568389171 +0100
@@ -1096,10 +1096,41 @@ static int get_extattribs(__G__ pzt, z_u
#ifndef MTS
/****************************/
@ -56,64 +75,50 @@ diff -up unzip-5.52/unix/unix.c.err unzip-5.52/unix/unix.c
__GDEF
{
union {
@@ -1041,6 +1072,7 @@ void close_outfile(__G) /* GRR: chang
@@ -1108,6 +1139,7 @@ void close_outfile(__G) /* GRR: chang
} zt;
ush z_uidgid[2];
ulg z_uidgid[2];
int have_uidgid_flg;
+ int errval = PK_OK;
fchmod(fileno(G.outfile), 0400);
@@ -1054,7 +1086,14 @@ void close_outfile(__G) /* GRR: chang
perror("chmod (file attributes) error");
#endif
- fclose(G.outfile);
+/*---------------------------------------------------------------------------
+ Check what fclose() reports from the device, this is always safer.
+ An NFS non Solaris could be full and we could be facing ENOSPC not
+ seen by write() without opening with O_SYNC or writing with fsync().
+ - jmp.
+ ---------------------------------------------------------------------------*/
+
+ errval = CloseError(G.outfile, G.filename);
have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
/*---------------------------------------------------------------------------
If symbolic links are supported, allocate storage for a symlink control
@@ -1075,14 +1114,14 @@ void close_outfile(__G) /* GRR: chang
@@ -1141,16 +1173,16 @@ void close_outfile(__G) /* GRR: chang
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: mem alloc overflow\n",
FnFilter1(G.filename)));
- fclose(G.outfile);
- return;
+ return PK_WARN;
+ errval = CloseError(G.outfile, G.filename);
+ return errval ? errval : PK_WARN;
}
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: no mem\n",
FnFilter1(G.filename)));
- fclose(G.outfile);
- return;
+ return PK_WARN;
+ errval = CloseError(G.outfile, G.filename);
+ return errval ? errval : PK_WARN;
}
slnk_entry->next = NULL;
slnk_entry->targetlen = ucsize;
@@ -1102,12 +1141,12 @@ void close_outfile(__G) /* GRR: chang
@@ -1174,10 +1206,10 @@ void close_outfile(__G) /* GRR: chang
"warning: symbolic link (%s) failed\n",
FnFilter1(G.filename)));
free(slnk_entry);
if (G.outfile)
- fclose(G.outfile);
- fclose(G.outfile);
- return;
+ errval = CloseError(G.outfile, G.filename);
+ return errval;
+ errval = CloseError(G.outfile, G.filename);
+ return errval ? errval : PK_WARN;
}
if (G.outfile)
- fclose(G.outfile); /* close "link" file for good... */
+ errval = CloseError(G.outfile, G.filename); /* close "lnk" file for good*/
- fclose(G.outfile); /* close "link" file for good... */
+ errval = CloseError(G.outfile, G.filename); /* close "link" file for good... */
slnk_entry->target[ucsize] = '\0';
if (QCOND2)
Info(slide, 0, ((char *)slide, "-> %s ",
@@ -1118,7 +1157,7 @@ void close_outfile(__G) /* GRR: chang
@@ -1188,7 +1220,7 @@ void close_outfile(__G) /* GRR: chang
else
G.slink_head = slnk_entry;
G.slink_last = slnk_entry;
@ -122,42 +127,50 @@ diff -up unzip-5.52/unix/unix.c.err unzip-5.52/unix/unix.c
}
#endif /* SYMLINKS */
@@ -1166,6 +1205,7 @@ void close_outfile(__G) /* GRR: chang
#endif /* ?AOS_VS */
@@ -1201,7 +1233,7 @@ void close_outfile(__G) /* GRR: chang
#endif
#if (defined(NO_FCHOWN))
- fclose(G.outfile);
+ errval = CloseError(G.outfile, G.filename);
#endif
/* if -X option was specified and we have UID/GID info, restore it */
@@ -1227,7 +1259,7 @@ void close_outfile(__G) /* GRR: chang
}
#if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
- fclose(G.outfile);
+ errval = CloseError(G.outfile, G.filename);
#endif
#if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
@@ -1239,7 +1271,7 @@ void close_outfile(__G) /* GRR: chang
if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
perror("fchmod (file attributes) error");
- fclose(G.outfile);
+ errval = CloseError(G.outfile, G.filename);
#endif /* !NO_FCHOWN && !NO_FCHMOD */
/* skip restoring time stamps on user's request */
@@ -1267,6 +1299,7 @@ void close_outfile(__G) /* GRR: chang
#endif
#endif /* NO_FCHOWN || NO_FCHMOD */
+ return errval;
} /* end function close_outfile() */
#endif /* !MTS */
diff -up unzip-5.52/extract.c.err unzip-5.52/extract.c
--- unzip-5.52/extract.c.err 2008-02-08 14:51:52.000000000 +0100
+++ unzip-5.52/extract.c 2008-02-08 14:51:52.000000000 +0100
@@ -1676,24 +1676,21 @@ static int extract_or_test_member(__G)
#ifdef VMS /* VMS: required even for stdout! (final flush) */
if (!uO.tflag) /* don't close NULL file */
- close_outfile(__G);
+ error = close_outfile(__G);
#else
#ifdef DLL
if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
if (G.redirect_data)
FINISH_REDIRECT();
else
- close_outfile(__G);
+ error = close_outfile(__G);
}
#else
if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
- close_outfile(__G);
+ error = close_outfile(__G);
diff -up unzip60/unzpriv.h.close unzip60/unzpriv.h
--- unzip60/unzpriv.h.close 2009-04-20 01:59:26.000000000 +0200
+++ unzip60/unzpriv.h 2009-11-19 08:19:08.610388618 +0100
@@ -2604,7 +2604,7 @@ char *GetLoadPath OF((__GPRO));
int SetFileSize OF((FILE *file, zusz_t filesize)); /* local */
#endif
#endif /* VMS */
- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
-
-
if (G.disk_full) { /* set by flush() */
if (G.disk_full > 1) {
#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
#ifndef MTS /* macro in MTS */
- void close_outfile OF((__GPRO)); /* local */
+ int close_outfile OF((__GPRO)); /* local */
#endif
#ifdef SET_SYMLINK_ATTRIBS
int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */

View File

@ -0,0 +1,10 @@
diff -up unzip60/crc_i386.S.exec-shield unzip60/crc_i386.S
--- unzip60/crc_i386.S.exec-shield 2007-01-07 06:02:58.000000000 +0100
+++ unzip60/crc_i386.S 2009-11-18 11:16:39.630389312 +0100
@@ -302,3 +302,6 @@ _crc32: /* ulg c
#endif /* i386 || _i386 || _I386 || __i386 */
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
+
+.section .note.GNU-stack, "", @progbits
+.previous

View File

@ -1,25 +1,21 @@
Summary: A utility for unpacking zip files
Name: unzip
Version: 5.52
Release: 11%{?dist}
Version: 6.0
Release: 1%{?dist}
License: BSD
Group: Applications/Archiving
Source: ftp://ftp.info-zip.org/pub/infozip/src/unzip552.tar.gz
Patch0: unzip542-rpmoptflags.patch
Patch2: unzip-5.51-link-segv.patch
Patch3: unzip-5.51-link-segv2.patch
Patch6: unzip-5.52-toctou.patch
Patch7: unzip-5.52-near-4GB.patch
Patch8: unzip-5.52-near-4GB2.patch
Patch9: unzip-5.52-long-filename.patch
Patch10: unzip-5.52-makefile.patch
Patch11: unzip-5.52-open.patch
Patch12: unzip-5.52-4GB3.patch
Patch13: unzip-5.52-4GB_types.patch
Patch14: unzip-5.52-249057.patch
Patch15: unzip-5.52-cve-2008-0888.patch
URL: http://www.info-zip.org/pub/infozip/UnZip.html
Source: http://downloads.sourceforge.net/infozip/unzip60.tar.gz
# Not sent to upstream.
Patch1: unzip-6.0-bzip2-configure.patch
# Upstream plans to do this in zip (hopefully also in unzip).
Patch2: unzip-6.0-exec-shield.patch
# Upstream plans to do similar thing.
Patch3: unzip-6.0-close.patch
URL: http://www.info-zip.org/UnZip.html
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: bzip2-devel
%description
The unzip utility is used to list, test, or extract files from a zip
@ -33,29 +29,17 @@ Install the unzip package if you need to list, test or extract files from
a zip archive.
%prep
%setup -q
%patch0 -p1 -b .rpmo
%patch2 -p1 -b .link-segv
%patch3 -p1 -b .morn
%patch6 -p1 -b .toctou
%patch7 -p1 -b .4GB
%patch8 -p1 -b .4GB2
%patch9 -p1 -b .lfn
%patch10 -p1 -b .make
%patch11 -p1 -b .open
%patch12 -p1 -b .4GB3
%patch13 -p1 -b .4BG4
%patch14 -p1 -b .err
%patch15 -p1 -b .cve-2008-0888
ln -s unix/Makefile Makefile
%setup -q -n unzip60
%patch1 -p1 -b .bzip2-configure
%patch2 -p1 -b .exec-shield
%patch3 -p1 -b .close
%build
make CFLAGS="-D_LARGEFILE64_SOURCE" linux_noasm LF2="" %{?_smp_mflags}
make -f unix/Makefile "CF_NOOPT=-I. -DUNIX $RPM_OPT_FLAGS" generic_gcc %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT/%{_mandir}/man1 INSTALL="cp -p" install LF2=""
make -f unix/Makefile prefix=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT/%{_mandir}/man1 INSTALL="cp -p" install LF2=""
%clean
rm -rf $RPM_BUILD_ROOT
@ -67,6 +51,30 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/*
%changelog
* Mon Nov 16 2009 Karel Klic <kklic@redhat.com> - 6.0-1
- New upstream version
- Compiled using `make generic_gcc` (includes asm)
- Removed unzip542-rpmoptflags.patch, because RPM_OPT_FLAGS
are provided using command line
- Removed unzip-5.51-link-segv.patch, because the link file
is not reopened in the current version
- Removed unzip-5.51-link-segv2.patch, the bug was already fixed
in open_outfile in 5.52
- Removed unzip-5.52-toctou.patch (CAN-2005-2475), the vulnerability
is fixed in the current version
- Removed unzip-5.52-near-4GB.patch, unzip-5.52-near-4GB2.patch,
unzip-5.52-4GB3.patch, and unzip-5.52-4GB_types.patch, because
the current version supports large files
- Removed unzip-5.52-long-filename.patch, the current version
fixes the vulnerability by checking the length of command line
arguments in unzip.c
- Removed unzip-5.52-makefile.patch, because we no longer create
the link manually
- Removed unzip-5.52-open.patch, the current version uses umask.
- Removed unzip-5.52-cve-2008-0888.patch, the current version
fixes this vulnerability
- Ported unzip-5.52-249057.patch to current version (unzip-6.0-close)
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.52-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

View File

@ -1,11 +0,0 @@
--- unzip-5.42/unix/Makefile.rpmoptflags Mon May 21 10:57:51 2001
+++ unzip-5.42/unix/Makefile Mon May 21 10:58:22 2001
@@ -735,7 +735,7 @@
# Linux (Posix, approximately SysV): virtually any version since before 0.96,
# for any platform. Change "-O" to "-O3" or whatever, as desired...
linux_noasm: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CF="-O -Wall -I. $(LOC)"
+ $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_GNU_SOURCE -Wall -I. $(LOC)"
# Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3