support MS cabinet files

git-svn: trunk@587
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent 9425e7ced5
commit 414abe8792
  1. 3
      clamav-devel/AUTHORS
  2. 4
      clamav-devel/ChangeLog
  3. 2
      clamav-devel/README
  4. 4
      clamav-devel/aclocal.m4
  5. 9
      clamav-devel/clamav-config.h.in
  6. 153
      clamav-devel/configure
  7. 3
      clamav-devel/configure.in
  8. 15
      clamav-devel/libclamav/Makefile.am
  9. 132
      clamav-devel/libclamav/Makefile.in
  10. 2
      clamav-devel/libclamav/clamav.h
  11. 2
      clamav-devel/libclamav/others.c
  12. 93
      clamav-devel/libclamav/scanners.c
  13. 3
      clamav-devel/libclamav/scanners.h
  14. 9
      clamav-devel/test/README
  15. 0
      clamav-devel/test/test
  16. 0
      clamav-devel/test/test-failure.rar
  17. 0
      clamav-devel/test/test-zip-noext
  18. 0
      clamav-devel/test/test.bz2
  19. BIN
      clamav-devel/test/test.cab
  20. 0
      clamav-devel/test/test.msc
  21. 0
      clamav-devel/test/test.rar
  22. 0
      clamav-devel/test/test.zip

@ -1,5 +1,5 @@
Tomasz Kojm <tkojm*clamav.net>
home page : http://www.konarski.edu.pl/~zolw
home page : http://www.mat.uni.torun.pl/~tk
gpg key : http://www.clamav.net/gpg/tkojm.gpg
GPG fingerprint = 0DCA 5A08 407D 5288 279D B434 5482 2DC8 985A 444B
Project leader.
@ -56,6 +56,7 @@ TrashScan was written by Trashware <trashware*gmx.net>.
libclamav/zziplib: Guido Draheim <guidod*gmx.de>
libclamav/unrarlib.c: Christian Scheurer and Johannes Winkelmann, see
www.unrarlib.org
libclamav/mspack: Stuart Caie
ClamAV patches were submitted by (in alphabetical order):

@ -1,3 +1,7 @@
Wed Jun 2 02:30:34 CEST 2004 (tk)
----------------------------------
* libclamav: support MS cabinet files (test/test.cab). Based on libmspack.
Tue Jun 1 10:09:02 BST 2004 (njh)
----------------------------------
* libclamav/message.c: Corrupted BinHex could still cause crash on

@ -12,7 +12,7 @@ the noteworthy changes include:
+ support nested OLE2 files
+ support Word6 macro code
+ ignore popular file types (media, graphics)
+ support compress.exe (SZDD) compression (test/test1.msc)
+ support compress.exe (SZDD) compression (test/test.msc)
+ improve virus detection in e-mails
-) clamscan:

@ -81,7 +81,7 @@ dnl there is now a CREATE_PREFIX_TARGET_H in this file as a shorthand for
dnl PREFIX_CONFIG_H from a target.h file, however w/o the target.h ever created
dnl (the prefix is a bit different, since we add an extra -target- and -host-)
dnl
dnl @version: $Id: aclocal.m4,v 1.38 2004/05/25 20:38:23 kojm Exp $
dnl @version: $Id: aclocal.m4,v 1.39 2004/06/02 00:36:04 kojm Exp $
dnl @author Guido Draheim <guidod@gmx.de> STATUS: used often
AC_DEFUN([AC_CREATE_TARGET_H],
@ -4041,7 +4041,7 @@ dnl AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
dnl AC_COMPILE_CHECK_SIZEOF(off_t, $headers)
dnl
dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu>
dnl @version $Id: aclocal.m4,v 1.38 2004/05/25 20:38:23 kojm Exp $
dnl @version $Id: aclocal.m4,v 1.39 2004/06/02 00:36:04 kojm Exp $
dnl
AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
[changequote(<<, >>)dnl

@ -78,6 +78,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
@ -93,6 +96,9 @@
/* in_port_t is defined */
#undef HAVE_IN_PORT_T
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
@ -234,6 +240,9 @@
/* endianess */
#undef WORDS_BIGENDIAN
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
/* thread safe */
#undef _REENTRANT

@ -7862,7 +7862,8 @@ fi
for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h
for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h limits.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@ -8668,6 +8669,156 @@ _ACEOF
fi
rm -f conftest.mmap
echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5
echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6
if test "${ac_cv_sys_largefile_source+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
while :; do
ac_cv_sys_largefile_source=no
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return !fseeko;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#define _LARGEFILE_SOURCE 1
#include <stdio.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return !fseeko;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sys_largefile_source=1; break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
break
done
fi
echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5
echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6
if test "$ac_cv_sys_largefile_source" != no; then
cat >>confdefs.h <<_ACEOF
#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
_ACEOF
fi
rm -f conftest*
# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
# in glibc 2.1.3, but that breaks too many other things.
# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
echo "$as_me:$LINENO: checking for fseeko" >&5
echo $ECHO_N "checking for fseeko... $ECHO_C" >&6
if test "${ac_cv_func_fseeko+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
return fseeko && fseeko (stdin, 0, 0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_fseeko=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_func_fseeko=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_fseeko" >&5
echo "${ECHO_T}$ac_cv_func_fseeko" >&6
if test $ac_cv_func_fseeko = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_FSEEKO 1
_ACEOF
fi
# Check for broken snprintf
if test "x$ac_cv_func_snprintf" = "xyes" ; then

@ -37,13 +37,14 @@ AC_DEFINE(SCANBUFF, 131072, [scan buffer size])
AC_DEFINE(FILEBUFF, 8192, [file i/o buffer size])
AC_HEADER_STDC
AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h)
AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h limits.h)
AC_TYPE_OFF_T
AC_COMPILE_CHECK_SIZEOF(short)
AC_COMPILE_CHECK_SIZEOF(int)
AC_COMPILE_CHECK_SIZEOF(long)
AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop)
AC_FUNC_MMAP
AC_FUNC_FSEEKO
# Check for broken snprintf
if test "x$ac_cv_func_snprintf" = "xyes" ; then

@ -16,7 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I@srcdir@/mspack
libclamav_la_LIBADD = @LIBCLAMAV_LIBS@
@ -83,6 +83,17 @@ libclamav_la_SOURCES = \
msexpand.c \
msexpand.h \
pe.c \
pe.h
pe.h \
mspack/cabd.c \
mspack/cab.h \
mspack/lzxd.c \
mspack/lzx.h \
mspack/mspack.h \
mspack/mszipd.c \
mspack/mszip.h \
mspack/qtmd.c \
mspack/qtm.h \
mspack/system.c \
mspack/system.h
lib_LTLIBRARIES = libclamav.la

@ -117,7 +117,7 @@ am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib
INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I@srcdir@/mspack
libclamav_la_LIBADD = @LIBCLAMAV_LIBS@
@ -184,7 +184,18 @@ libclamav_la_SOURCES = \
msexpand.c \
msexpand.h \
pe.c \
pe.h
pe.h \
mspack/cabd.c \
mspack/cab.h \
mspack/lzxd.c \
mspack/lzx.h \
mspack/mspack.h \
mspack/mszipd.c \
mspack/mszip.h \
mspack/qtmd.c \
mspack/qtm.h \
mspack/system.c \
mspack/system.h
lib_LTLIBRARIES = libclamav.la
@ -200,7 +211,7 @@ am_libclamav_la_OBJECTS = matcher.lo md5.lo others.lo readdb.lo cvd.lo \
zzip-file.lo zzip-info.lo zzip-io.lo zzip-stat.lo zzip-zip.lo \
strc.lo blob.lo mbox.lo message.lo snprintf.lo strrcpy.lo \
table.lo text.lo ole2_extract.lo vba_extract.lo msexpand.lo \
pe.lo
pe.lo cabd.lo lzxd.lo mszipd.lo qtmd.lo system.lo
libclamav_la_OBJECTS = $(am_libclamav_la_OBJECTS)
DEFS = @DEFS@
@ -210,16 +221,19 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/blob.Plo ./$(DEPDIR)/cvd.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/dsig.Plo ./$(DEPDIR)/matcher.Plo \
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/blob.Plo ./$(DEPDIR)/cabd.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/cvd.Plo ./$(DEPDIR)/dsig.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/lzxd.Plo ./$(DEPDIR)/matcher.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mbox.Plo ./$(DEPDIR)/md5.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/message.Plo ./$(DEPDIR)/msexpand.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/ole2_extract.Plo ./$(DEPDIR)/others.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/pe.Plo ./$(DEPDIR)/readdb.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mszipd.Plo ./$(DEPDIR)/ole2_extract.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/others.Plo ./$(DEPDIR)/pe.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/qtmd.Plo ./$(DEPDIR)/readdb.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/scanners.Plo ./$(DEPDIR)/snprintf.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/str.Plo ./$(DEPDIR)/strc.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/strrcpy.Plo ./$(DEPDIR)/table.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/text.Plo ./$(DEPDIR)/unrarlib.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/strrcpy.Plo ./$(DEPDIR)/system.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/table.Plo ./$(DEPDIR)/text.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/unrarlib.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/vba_extract.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/zzip-dir.Plo ./$(DEPDIR)/zzip-err.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/zzip-file.Plo ./$(DEPDIR)/zzip-info.Plo \
@ -278,6 +292,11 @@ zzip-io.lo: zziplib/zzip-io.c
zzip-stat.lo: zziplib/zzip-stat.c
zzip-zip.lo: zziplib/zzip-zip.c
strc.lo: zziplib/strc.c
cabd.lo: mspack/cabd.c
lzxd.lo: mspack/lzxd.c
mszipd.lo: mspack/mszipd.c
qtmd.lo: mspack/qtmd.c
system.lo: mspack/system.c
libclamav.la: $(libclamav_la_OBJECTS) $(libclamav_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libclamav_la_LDFLAGS) $(libclamav_la_OBJECTS) $(libclamav_la_LIBADD) $(LIBS)
@ -288,22 +307,27 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cabd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsig.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzxd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matcher.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbox.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msexpand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mszipd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ole2_extract.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/others.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qtmd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanners.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strrcpy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unrarlib.Plo@am__quote@
@ -480,6 +504,96 @@ strc.lo: zziplib/strc.c
@AMDEP_TRUE@ depfile='$(DEPDIR)/strc.Plo' tmpdepfile='$(DEPDIR)/strc.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strc.lo `test -f 'zziplib/strc.c' || echo '$(srcdir)/'`zziplib/strc.c
cabd.o: mspack/cabd.c
@AMDEP_TRUE@ source='mspack/cabd.c' object='cabd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/cabd.Po' tmpdepfile='$(DEPDIR)/cabd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cabd.o `test -f 'mspack/cabd.c' || echo '$(srcdir)/'`mspack/cabd.c
cabd.obj: mspack/cabd.c
@AMDEP_TRUE@ source='mspack/cabd.c' object='cabd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/cabd.Po' tmpdepfile='$(DEPDIR)/cabd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cabd.obj `cygpath -w mspack/cabd.c`
cabd.lo: mspack/cabd.c
@AMDEP_TRUE@ source='mspack/cabd.c' object='cabd.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/cabd.Plo' tmpdepfile='$(DEPDIR)/cabd.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cabd.lo `test -f 'mspack/cabd.c' || echo '$(srcdir)/'`mspack/cabd.c
lzxd.o: mspack/lzxd.c
@AMDEP_TRUE@ source='mspack/lzxd.c' object='lzxd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/lzxd.Po' tmpdepfile='$(DEPDIR)/lzxd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lzxd.o `test -f 'mspack/lzxd.c' || echo '$(srcdir)/'`mspack/lzxd.c
lzxd.obj: mspack/lzxd.c
@AMDEP_TRUE@ source='mspack/lzxd.c' object='lzxd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/lzxd.Po' tmpdepfile='$(DEPDIR)/lzxd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lzxd.obj `cygpath -w mspack/lzxd.c`
lzxd.lo: mspack/lzxd.c
@AMDEP_TRUE@ source='mspack/lzxd.c' object='lzxd.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/lzxd.Plo' tmpdepfile='$(DEPDIR)/lzxd.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lzxd.lo `test -f 'mspack/lzxd.c' || echo '$(srcdir)/'`mspack/lzxd.c
mszipd.o: mspack/mszipd.c
@AMDEP_TRUE@ source='mspack/mszipd.c' object='mszipd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mszipd.Po' tmpdepfile='$(DEPDIR)/mszipd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mszipd.o `test -f 'mspack/mszipd.c' || echo '$(srcdir)/'`mspack/mszipd.c
mszipd.obj: mspack/mszipd.c
@AMDEP_TRUE@ source='mspack/mszipd.c' object='mszipd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mszipd.Po' tmpdepfile='$(DEPDIR)/mszipd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mszipd.obj `cygpath -w mspack/mszipd.c`
mszipd.lo: mspack/mszipd.c
@AMDEP_TRUE@ source='mspack/mszipd.c' object='mszipd.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mszipd.Plo' tmpdepfile='$(DEPDIR)/mszipd.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mszipd.lo `test -f 'mspack/mszipd.c' || echo '$(srcdir)/'`mspack/mszipd.c
qtmd.o: mspack/qtmd.c
@AMDEP_TRUE@ source='mspack/qtmd.c' object='qtmd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/qtmd.Po' tmpdepfile='$(DEPDIR)/qtmd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o qtmd.o `test -f 'mspack/qtmd.c' || echo '$(srcdir)/'`mspack/qtmd.c
qtmd.obj: mspack/qtmd.c
@AMDEP_TRUE@ source='mspack/qtmd.c' object='qtmd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/qtmd.Po' tmpdepfile='$(DEPDIR)/qtmd.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o qtmd.obj `cygpath -w mspack/qtmd.c`
qtmd.lo: mspack/qtmd.c
@AMDEP_TRUE@ source='mspack/qtmd.c' object='qtmd.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/qtmd.Plo' tmpdepfile='$(DEPDIR)/qtmd.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o qtmd.lo `test -f 'mspack/qtmd.c' || echo '$(srcdir)/'`mspack/qtmd.c
system.o: mspack/system.c
@AMDEP_TRUE@ source='mspack/system.c' object='system.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/system.Po' tmpdepfile='$(DEPDIR)/system.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system.o `test -f 'mspack/system.c' || echo '$(srcdir)/'`mspack/system.c
system.obj: mspack/system.c
@AMDEP_TRUE@ source='mspack/system.c' object='system.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/system.Po' tmpdepfile='$(DEPDIR)/system.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system.obj `cygpath -w mspack/system.c`
system.lo: mspack/system.c
@AMDEP_TRUE@ source='mspack/system.c' object='system.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/system.Plo' tmpdepfile='$(DEPDIR)/system.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system.lo `test -f 'mspack/system.c' || echo '$(srcdir)/'`mspack/system.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:

@ -38,6 +38,7 @@ extern "C"
/* return codes */
#define CL_CLEAN 0 /* virus not found */
#define CL_VIRUS 1 /* virus found */
#define CL_EMAXREC 10 /* recursion level limit exceeded */
#define CL_EMAXSIZE 11 /* size limit exceeded */
#define CL_EMAXFILES 12 /* files limit exceeded */
@ -48,6 +49,7 @@ extern "C"
#define CL_EBZIP 104 /* bzip2 handler error */
#define CL_EOLE2 105 /* OLE2 handler error */
#define CL_EMSCOMP 106 /* compress.exe handler error */
#define CL_EMSCAB 107 /* MS CAB module error */
#define CL_EACCES 200 /* access denied */
#define CL_ENULLARG 300 /* null argument error */

@ -122,6 +122,8 @@ const char *cl_strerror(int clerror)
return "GZip module failure.";
case CL_EMSCOMP:
return "MS Expand module failure.";
case CL_EMSCAB:
return "MS CAB module failure.";
case CL_EOLE2:
return "OLE2 module failure.";
case CL_ETMPFILE:

@ -30,12 +30,16 @@
#include <fcntl.h>
#include <dirent.h>
#include <mspack.h>
#ifdef CL_THREAD_SAFE
# include <pthread.h>
pthread_mutex_t cli_scanrar_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
int cli_scanrar_inuse = 0;
extern short cli_leavetemps_flag;
#include "clamav.h"
#include "others.h"
#include "matcher.h"
@ -82,6 +86,7 @@ static const struct cli_magic_s cli_magic[] = {
{0, "\037\213", 2, "GZip", CL_GZFILE},
{0, "BZh", 3, "BZip", CL_BZFILE},
{0, "SZDD", 4, "compress.exe'd", CL_MSCFILE},
{0, "MSCF", 4, "MS CAB", CL_MSCABFILE},
/* Mail */
@ -469,7 +474,7 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
zzip_file_close(zfp);
if(fflush(tmp) != 0) {
cli_errmsg("fflush() failed: %s\n", strerror(errno));
cli_dbgmsg("fflush() failed: %s\n", strerror(errno));
ret = CL_EFSYNC;
break;
}
@ -596,7 +601,7 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
if((fs = fdopen(dup(desc), "rb")) == NULL) {
cli_errmsg("Can't fdopen() descriptor %d.\n", desc);
cli_dbgmsg("Can't fdopen() descriptor %d.\n", desc);
return CL_EBZIP;
}
@ -708,6 +713,61 @@ static int cli_scanmscomp(int desc, const char **virname, long int *scanned, con
return ret;
}
static int cli_scanmscab(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
{
struct mscab_decompressor *cabd = NULL;
struct mscabd_cabinet *base, *cab;
struct mscabd_file *file;
const char *tmpdir;
char *tempname;
int ret = CL_CLEAN;
cli_dbgmsg("in cli_scanmscab()\n");
if((cabd = mspack_create_cab_decompressor(NULL)) == NULL) {
cli_dbgmsg("Can't create libmspack CAB decompressor\n");
return CL_EMSCAB;
}
if((base = cabd->dsearch(cabd, desc)) == NULL) {
cli_dbgmsg("I/O error or no valid cabinets found\n");
mspack_destroy_cab_decompressor(cabd);
return CL_EMSCAB;
}
if((tmpdir = getenv("TMPDIR")) == NULL)
#ifdef P_tmpdir
tmpdir = P_tmpdir;
#else
tmpdir = "/tmp";
#endif
for(cab = base; cab; cab = cab->next) {
for(file = cab->files; file; file = file->next) {
tempname = cl_gentemp(tmpdir);
cli_dbgmsg("Extracting data to %s\n", tempname);
if(cabd->extract(cabd, file, tempname)) {
cli_dbgmsg("libmscab error code: %d\n", cabd->last_error(cabd));
} else {
ret = cli_scanfile(tempname, virname, scanned, root, limits, options, reclev);
}
if(!cli_leavetemps_flag)
unlink(tempname);
free(tempname);
if(ret == CL_VIRUS)
break;
}
if(ret == CL_VIRUS)
break;
}
cabd->close(cabd, base);
mspack_destroy_cab_decompressor(cabd);
return ret;
}
static int cli_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
{
DIR *dd;
@ -746,7 +806,7 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
}
}
} else {
cli_errmsg("ScanDir -> Can't open directory %s.\n", dirname);
cli_dbgmsg("ScanDir -> Can't open directory %s.\n", dirname);
return CL_EOPEN;
}
@ -772,7 +832,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
sprintf(fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
fd = open(fullname, O_RDONLY);
if(fd == -1) {
cli_errmsg("Scan->OLE2 -> Can't open file %s\n", fullname);
cli_dbgmsg("Scan->OLE2 -> Can't open file %s\n", fullname);
free(fullname);
ret = CL_EOPEN;
break;
@ -813,7 +873,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
sprintf(fullname, "%s/%s", vba_project->dir, vba_project->name[i]);
fd = open(fullname, O_RDONLY);
if(fd == -1) {
cli_errmsg("Scan->OLE2 -> Can't open file %s\n", fullname);
cli_dbgmsg("Scan->OLE2 -> Can't open file %s\n", fullname);
free(fullname);
ret = CL_EOPEN;
break;
@ -869,7 +929,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
}
}
} else {
cli_errmsg("ScanDir -> Can't open directory %s.\n", dirname);
cli_dbgmsg("ScanDir -> Can't open directory %s.\n", dirname);
return CL_EOPEN;
}
@ -885,9 +945,7 @@ static int cli_scanole2(int desc, const char **virname, long int *scanned, const
cli_dbgmsg("in cli_scanole2()\n");
tmpdir = getenv("TMPDIR");
if(tmpdir == NULL)
if((tmpdir = getenv("TMPDIR")) == NULL)
#ifdef P_tmpdir
tmpdir = P_tmpdir;
#else
@ -897,12 +955,12 @@ static int cli_scanole2(int desc, const char **virname, long int *scanned, const
/* generate the temporary directory */
dir = cl_gentemp(tmpdir);
if(mkdir(dir, 0700)) {
cli_errmsg("ScanOLE2 -> Can't create temporary directory %s\n", dir);
cli_dbgmsg("ScanOLE2 -> Can't create temporary directory %s\n", dir);
return CL_ETMPDIR;
}
if((ret = cli_ole2_extract(desc, dir))) {
cli_errmsg("ScanOLE2 -> %s\n", cl_strerror(ret));
cli_dbgmsg("ScanOLE2 -> %s\n", cl_strerror(ret));
cli_rmdirs(dir);
free(dir);
return ret;
@ -931,9 +989,7 @@ static int cli_scanmail(int desc, const char **virname, long int *scanned, const
if(*reclev > 5) /* FIXME: a temporary workaround */
return CL_CLEAN;
tmpdir = getenv("TMPDIR");
if(tmpdir == NULL)
if((tmpdir = getenv("TMPDIR")) == NULL)
#ifdef P_tmpdir
tmpdir = P_tmpdir;
#else
@ -943,7 +999,7 @@ static int cli_scanmail(int desc, const char **virname, long int *scanned, const
/* generate the temporary directory */
dir = cl_gentemp(tmpdir);
if(mkdir(dir, 0700)) {
cli_errmsg("ScanMail -> Can't create temporary directory %s\n", dir);
cli_dbgmsg("ScanMail -> Can't create temporary directory %s\n", dir);
return CL_ETMPDIR;
}
@ -970,7 +1026,7 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
if(!root) {
cli_errmsg("root == NULL\n");
cli_errmsg("CRITICAL: root == NULL\n");
return -1;
}
@ -1033,6 +1089,11 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
ret = cli_scanmscomp(desc, virname, scanned, root, limits, options, reclev);
break;
case CL_MSCABFILE:
if(SCAN_ARCHIVE)
ret = cli_scanmscab(desc, virname, scanned, root, limits, options, reclev);
break;
case CL_MAILFILE:
if(SCAN_MAIL)
ret = cli_scanmail(desc, virname, scanned, root, limits, options, reclev);

@ -30,7 +30,8 @@ typedef enum {
CL_BZFILE,
CL_RARFILE,
CL_MSCFILE,
CL_OLE2FILE
CL_OLE2FILE,
CL_MSCABFILE
} cli_file_t;
cli_file_t cli_filetype(const char *buf, size_t buflen);

@ -1,5 +1,6 @@
Test files contain ClamAV-Test-Signature.
You need unrar 3.0 to test rarfail.rar. Only clamscan is able to scan this
file (clamd only depends libclamav, which has no support for the new RAR
format). Please use clamscan --unrar, and it will automatically switch to the
unrar utility after an internal (libclamav's) RAR error.
You need unrar 3.0 to detect the test signature in test-failure.rar. Only
clamscan is able to scan this file (clamd only depends on libclamav which has
no support for the new RAR format). Please use clamscan --unrar, and it will
automatically switch to the unrar utility after an internal (libclamav's)
RAR module error.

Binary file not shown.
Loading…
Cancel
Save