diff --git a/README.md b/README.md index b8b3d3c..515e266 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # ncompress +The ncompress package contains the compress and uncompress file compression and decompression utilities, which are compatible with the original UNIX compress utility (.Z file extensions). +These utilities can't handle gzipped (.gz file extensions) files, but gzip can handle compressed files. + +Install ncompress if you need compression/decompression utilities which are compatible with the original UNIX compress utility. + diff --git a/ncompress-4.2.4-CVE-2006-1168.patch b/ncompress-4.2.4-CVE-2006-1168.patch new file mode 100644 index 0000000..0efd053 --- /dev/null +++ b/ncompress-4.2.4-CVE-2006-1168.patch @@ -0,0 +1,11 @@ +--- compress42.c~ 2006-07-25 10:44:51.129858888 -0600 ++++ compress42.c 2006-07-25 10:44:51.129858888 -0600 +@@ -1723,7 +1723,7 @@ + code = oldcode; + } + +- while ((cmp_code_int)code >= (cmp_code_int)256) ++ while ((cmp_code_int)code >= (cmp_code_int)256 && stackp >= htabof(0)) + { /* Generate output characters in reverse order */ + *--stackp = tab_suffixof(code); + code = tab_prefixof(code); diff --git a/ncompress-4.2.4-filenamelen.patch b/ncompress-4.2.4-filenamelen.patch new file mode 100644 index 0000000..67676c7 --- /dev/null +++ b/ncompress-4.2.4-filenamelen.patch @@ -0,0 +1,98 @@ +--- ncompress-4.2.4/compress42.c.filenamelen Wed Nov 21 12:19:38 2001 ++++ ncompress-4.2.4/compress42.c Wed Nov 21 12:20:03 2001 +@@ -140,6 +140,7 @@ + #include + #include + #include ++#include + + #ifdef DIRENT + # include +@@ -213,7 +214,7 @@ + # define OBUFSIZ BUFSIZ /* Default output buffer size */ + #endif + +-#define MAXPATHLEN 1024 /* MAXPATHLEN - maximum length of a pathname we allow */ ++#define MAXPATHLEN PATH_MAX /* MAXPATHLEN - maximum length of a pathname we allow */ + #define SIZE_INNER_LOOP 256 /* Size of the inter (fast) compress loop */ + + /* Defines for third byte of header */ +@@ -641,13 +642,11 @@ + } ; + #endif + +-void main ARGS((int,char **)); + void Usage ARGS((void)); + void comprexx ARGS((char **)); + void compdir ARGS((char *)); + void compress ARGS((int,int)); + void decompress ARGS((int,int)); +-char *rindex ARGS((char *,int)); + void read_error ARGS((void)); + void write_error ARGS((void)); + void abort_compress ARGS((void)); +@@ -694,13 +693,15 @@ + * deterministic, and can be done on the fly. Thus, the decompression + * procedure needs no input table, but tracks the way the table was built. + */ +-void ++int + main(argc, argv) + REG1 int argc; + REG2 char *argv[]; + { + REG3 char **filelist; + REG4 char **fileptr; ++ int i; ++ + + if (fgnd_flag = (signal(SIGINT, SIG_IGN) != SIG_IGN)) + signal(SIGINT, (SIG_TYPE)abort_compress); +@@ -714,7 +715,14 @@ + nomagic = 1; /* Original didn't have a magic number */ + #endif + +- filelist = fileptr = (char **)malloc(argc*sizeof(char *)); ++ for(i=0;i(MAXPATHLEN-1)){ ++ fprintf(stderr,"Filename too long\n"); ++ exit(1); ++ } ++ } ++ ++ filelist = fileptr = (char **)malloc(argc*sizeof(char *)); + *filelist = NULL; + + if((progname = rindex(argv[0], '/')) != 0) +@@ -853,8 +861,9 @@ + else + decompress(0, 1); + } +- ++ + exit((exit_code== -1) ? 1:exit_code); ++ return 0; + } + + void +@@ -1801,20 +1810,6 @@ + write_error(); + } + +-char * +-rindex(s, c) /* For those who don't have it in libc.a */ +- REG1 char *s; +- REG2 int c; +- { +- char *p; +- +- for (p = NULL; *s; s++) +- if (*s == (char)c) +- p = s; +- +- return(p); +- } +- + void + read_error() + { diff --git a/ncompress-4.2.4-lfs2.patch b/ncompress-4.2.4-lfs2.patch new file mode 100644 index 0000000..9da42eb --- /dev/null +++ b/ncompress-4.2.4-lfs2.patch @@ -0,0 +1,52 @@ +--- ncompress-4.2.4/compress42.c.lfs 2002-06-19 19:19:33.000000000 -0400 ++++ ncompress-4.2.4/compress42.c 2002-06-19 19:20:48.000000000 -0400 +@@ -130,6 +130,7 @@ + * Add variable bit length output. + * + */ ++#include + #include + #include + #include +@@ -168,30 +169,6 @@ + # define SIG_TYPE void (*)() + #endif + +-#ifndef NOFUNCDEF +- extern void *malloc LARGS((int)); +- extern void free LARGS((void *)); +-#ifndef _IBMR2 +- extern int open LARGS((char const *,int,...)); +-#endif +- extern int close LARGS((int)); +- extern int read LARGS((int,void *,int)); +- extern int write LARGS((int,void const *,int)); +- extern int chmod LARGS((char const *,int)); +- extern int unlink LARGS((char const *)); +- extern int chown LARGS((char const *,int,int)); +- extern int utime LARGS((char const *,struct utimbuf const *)); +- extern char *strcpy LARGS((char *,char const *)); +- extern char *strcat LARGS((char *,char const *)); +- extern int strcmp LARGS((char const *,char const *)); +- extern unsigned strlen LARGS((char const *)); +- extern void *memset LARGS((void *,char,unsigned int)); +- extern void *memcpy LARGS((void *,void const *,unsigned int)); +- extern int atoi LARGS((char const *)); +- extern void exit LARGS((int)); +- extern int isatty LARGS((int)); +-#endif +- + #define MARK(a) { asm(" .globl M.a"); asm("M.a:"); } + + #ifdef DEF_ERRNO +@@ -535,8 +512,8 @@ + char ofname[MAXPATHLEN]; /* Output filename */ + int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ + +-long bytes_in; /* Total number of byte from input */ +-long bytes_out; /* Total number of byte to output */ ++long long bytes_in; /* Total number of byte from input */ ++long long bytes_out; /* Total number of byte to output */ + + /* + * 8086 & 80286 Has a problem with array bigger than 64K so fake the array diff --git a/ncompress-4.2.4-make.patch b/ncompress-4.2.4-make.patch new file mode 100644 index 0000000..62eeed0 --- /dev/null +++ b/ncompress-4.2.4-make.patch @@ -0,0 +1,60 @@ +--- ncompress-4.2.4/Makefile.orig Thu Oct 31 10:38:46 1996 ++++ ncompress-4.2.4/Makefile Thu Oct 31 10:39:12 1996 +@@ -0,0 +1,57 @@ ++# Makefile generated by build. ++ ++# C complier ++CC=cc $(RPM_OPT_FLAGS) ++ ++# Install directory for binarys ++BINDIR=/usr/bin ++ ++# Install directory for manual ++MANDIR=/usr/share/man/man1 ++ ++# compiler options: ++# options is a collection of: ++# ++# -DAMIGA=1 Amiga support. ++# -DNOFUNCDEF=1 Disable libary function definitions in ++# compress42.c ++# -DDIRENT=1 Use dirent.h ++# -DSYSDIR=1 Use sys/dir.h ++# -DLSTAT=1 Use lstat for finding symlinks. ++# -DUTIME_H=1 Use utime.h ++# -DUSERMEM= Availble memory for compress (default 800k). ++# -DREGISTERS= Number of registers (default 2). ++# -DIBUFSIZ= Input buffer size (default BUFSIZ). ++# -DOBUFSIZ= Output buffer size (default BUFSIZ) ++# -DBYTEORDER= Byte order (default: unknown). ++# -DNOALLIGN=1 Data word allignment (default: yes). ++# -DDEF_ERRNO=1 Define error (not defined in errno.h). ++# -DMAXSEG_64K=1 -BITS=16 Support segment processsor like 80286. ++# ++options= -DDIRENT=1 -DSYSDIR=1 -DUTIME_H=1 -DUSERMEM=800000 -DREGISTERS=20 -DIBUFSIZ=1024 -DOBUFSIZ=1024 -DBYTEORDER=$(ENDIAN) ++ ++# libary options ++LBOPT= ++ ++ ++compress: Makefile compress42.c patchlevel.h ++ $(CC) -o compress $(options) "-DCOMPILE_DATE=\"`date`\"" compress42.c ++ ++install: compress ++ [ -f $(BINDIR)/compress ] && \ ++ { rm -f $(BINDIR)/compress.old ; \ ++ mv $(BINDIR)/compress $(BINDIR)/compress.old ; } ++ rm -f $(BINDIR)/uncompress $(BINDIR)/zcat ++ cp compress $(BINDIR)/compress ++ strip $(BINDIR)/compress ++ rm -f $(BINDIR)/uncompress ++ ln $(BINDIR)/compress $(BINDIR)/uncompress ++ rm -f $(BINDIR)/zcat ++ ln -f $(BINDIR)/compress $(BINDIR)/zcat ++ cp zcmp zdiff zmore $(BINDIR)/. ++ chmod 0755 $(BINDIR)/compress $(BINDIR)/zcmp $(BINDIR)/zdiff $(BINDIR)/zmore ++ cp compress.1 zcmp.1 zmore.1 $(MANDIR)/. ++ chmod 0644 $(MANDIR)/compress.1 $(MANDIR)/zcmp.1 $(MANDIR)/zmore.1 ++ ++cleanup: ++ rm -f compress compress.def comp.log diff --git a/ncompress.spec b/ncompress.spec new file mode 100644 index 0000000..99c0c8c --- /dev/null +++ b/ncompress.spec @@ -0,0 +1,79 @@ +Name: ncompress +Version: 4.2.4.4 +Release: 2mamba +Summary: Fast compression/decompression compatible with the original *nix compress utility +Group: Applications/Archiving +Vendor: openmamba +Distribution: openmamba +Packager: Aleph0 +URL: http://ncompress.sourceforge.net/ +Source: http://sourceforge.net/projects/ncompress/files/ncompress-%{version}.tar.gz +# note: patches from Fedora Core 2 +Patch0: %{name}-4.2.4-make.patch +Patch1: %{name}-4.2.4-lfs2.patch +Patch2: %{name}-4.2.4-filenamelen.patch +Patch3: %{name}-4.2.4-CVE-2006-1168.patch +License: Public Domain +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +The ncompress package contains the compress and uncompress file compression and decompression utilities, which are compatible with the original UNIX compress utility (.Z file extensions). +These utilities can't handle gzipped (.gz file extensions) files, but gzip can handle compressed files. + +Install ncompress if you need compression/decompression utilities which are compatible with the original UNIX compress utility. + +%prep +%setup -q +#%patch0 -p1 +%patch1 -p1 -b .lfs +#%patch2 -p1 -b .filenamelen +%patch3 -p0 -b .CVE-2006-1168 + +%build +%make CC='%{_target_platform}-gcc $(RPM_OPT_FLAGS)' + +%install +[ "%{buildroot}" != / ] && rm -rf %{buildroot} +%makeinstall BINDIR=%{_bindir} MANDIR=%{_mandir}/man1 + +for f in zcat zcmp zdiff zmore; do + rm -f %{buildroot}%{_bindir}/$f + rm -f %{buildroot}%{_mandir}/man1/$f* +done + +ln -sf compress %{buildroot}%{_bindir}/uncompress +ln -sf compress.1 %{buildroot}%{_mandir}/man1/uncompress.1 + +%clean +[ "%{buildroot}" != / ] && rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_bindir}/compress +%{_bindir}/uncompress +%{_mandir}/man1/compress.1* +%{_mandir}/man1/uncompress.1* +%doc Acknowleds +# Changes LZW.INFO README + +%changelog +* Mon Oct 29 2012 Silvan Calarco 4.2.4.4-2mamba +- remove files provided by zlib + +* Wed Oct 12 2011 Automatic Build System 4.2.4.4-1mamba +- update to 4.2.4.4 + +* Tue Nov 13 2007 Aleph0 4.2.4-4mamba +- rebuilt + +* Wed Aug 30 2006 Davide Madrisan 4.2.4-3qilnx +- security update against CVE-2006-1168 (bugtraq#223) + +* Thu Oct 06 2005 Stefano Cotta Ramusino 4.2.4-2qilnx +- added cross-compilation support + +* Tue Aug 31 2004 Davide Madrisan 4.2.4-1qilnx +- package created