add support for Mac's HQX file format

git-svn: trunk@1110
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent 359e9faebf
commit 667ab9c61d
  1. 4
      clamav-devel/ChangeLog
  2. 13
      clamav-devel/libclamav/binhex.c
  3. 8
      clamav-devel/libclamav/binhex.h
  4. 2
      clamav-devel/libclamav/filetypes.c
  5. 1
      clamav-devel/libclamav/filetypes.h
  6. 33
      clamav-devel/libclamav/scanners.c

@ -1,3 +1,7 @@
Thu Nov 18 20:28:13 CET 2004 (tk)
---------------------------------
* libclamav: add support for Mac's HQX file format (patch by Nigel)
Thu Nov 18 11:03:14 CET 2004 (tk)
---------------------------------
* libclamav: try to detect (and mark as Suspected.Zip) zip archives with

@ -17,6 +17,9 @@
*
* Change History:
* $Log: binhex.c,v $
* Revision 1.4 2004/11/18 19:30:29 kojm
* add support for Mac's HQX file format
*
* Revision 1.3 2004/11/18 18:24:45 nigelhorne
* Added binhex.h
*
@ -24,7 +27,7 @@
* First draft of binhex.c
*
*/
static char const rcsid[] = "$Id: binhex.c,v 1.3 2004/11/18 18:24:45 nigelhorne Exp $";
static char const rcsid[] = "$Id: binhex.c,v 1.4 2004/11/18 19:30:29 kojm Exp $";
#include "clamav.h"
@ -71,8 +74,8 @@ cli_binhex(const char *dir, int desc)
fileblob *fb;
#ifndef HAVE_MMAP
cli_errmsg("Binhex decoding needs mmap() (for now)\n");
return CL_EMEM;
cli_warnmsg("File not decoded - binhex decoding needs mmap() (for now)\n");
return CL_CLEAN;
#else
if(fstat(desc, &statb) < 0)
return CL_EOPEN;
@ -99,14 +102,14 @@ cli_binhex(const char *dir, int desc)
--bytesleft;
}
printf("%d: ", length);
/* printf("%d: ", length); */
line = cli_malloc(length + 1);
memcpy(line, buf, length);
line[length] = '\0';
puts(line);
/* puts(line); */
if(messageAddStr(m, line) < 0)
break;

@ -17,9 +17,17 @@
*
* Change History:
* $Log: binhex.h,v $
* Revision 1.3 2004/11/18 19:30:29 kojm
* add support for Mac's HQX file format
*
* Revision 1.2 2004/11/18 18:24:45 nigelhorne
* Added binhex.h
*
*/
#ifndef __BINHEX_H
#define __BINHEX_H
int cli_binhex(const char *dir, int desc);
#endif

@ -63,6 +63,8 @@ static const struct cli_magic_s cli_magic[] = {
{0, "ITSF", 4, "MS CHM", CL_TYPE_MSCHM},
{257, "ustar", 5, "POSIX tar", CL_TYPE_TAR},
{0, "#@~^", 4, "SCRENC", CL_TYPE_SCRENC},
{0, "(This file must be converted with BinHex 4.0)",
45, "BinHex", CL_TYPE_BINHEX},
/* Mail */

@ -39,6 +39,7 @@ typedef enum {
CL_TYPE_MSCHM,
CL_TYPE_SCRENC,
CL_TYPE_GRAPHICS,
CL_TYPE_BINHEX,
/* bigger numbers have higher priority (in o-t-f detection) */
CL_TYPE_HTML, /* on the fly */

@ -1041,6 +1041,34 @@ static int cli_scantar(int desc, const char **virname, long int *scanned, const
return ret;
}
static int cli_scanbinhex(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
{
char *dir;
int ret = CL_CLEAN;
cli_dbgmsg("in cli_scanbinhex()\n");
/* generate temporary directory */
dir = cli_gentemp(NULL);
if(mkdir(dir, 0700)) {
cli_errmsg("Binhex: Can't create temporary directory %s\n", dir);
return CL_ETMPDIR;
}
if((ret = cli_binhex(dir, desc)))
cli_dbgmsg("Binhex: %s\n", cl_strerror(ret));
else
ret = cli_scandir(dir, virname, scanned, root, limits, options, arec, mrec);
if(!cli_leavetemps_flag)
cli_rmdirs(dir);
free(dir);
return ret;
}
static int cli_scanmschm(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
{
char *tempname;
@ -1226,6 +1254,11 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
ret = cli_scantar(desc, virname, scanned, root, limits, options, arec, mrec);
break;
case CL_TYPE_BINHEX:
if(SCAN_ARCHIVE)
ret = cli_scanbinhex(desc, virname, scanned, root, limits, options, arec, mrec);
break;
case CL_TYPE_SCRENC:
ret = cli_scanscrenc(desc, virname, scanned, root, limits, options, arec, mrec);
break;

Loading…
Cancel
Save