git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@649 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/07/04 00:24:43... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sat Jul 3 17:20:45 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: use new method to detect mail files |
|
4 |
+ |
|
1 | 5 |
Sat Jul 3 00:37:28 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav: matcher: add support for file type detection via signature |
... | ... |
@@ -115,6 +115,10 @@ static const struct cli_smagic_s cli_smagic[] = { |
115 | 115 |
/* <html>*<body> */ |
116 | 116 |
{"3c68746d6c3e*3c626f64793e", "HTML data", CL_HTMLFILE}, |
117 | 117 |
|
118 |
+ /* "From: " * "Content-Type: " */ |
|
119 |
+ {"46726f6d3a20*436f6e74656e742d547970653a20", "Mail file", CL_MAILFILE}, |
|
120 |
+ |
|
121 |
+ |
|
118 | 122 |
{NULL, NULL, CL_UNKNOWN_TYPE} |
119 | 123 |
}; |
120 | 124 |
|
... | ... |
@@ -27,7 +27,6 @@ typedef enum { |
27 | 27 |
CL_UNKNOWN_TYPE = CL_TYPENO, |
28 | 28 |
CL_DOSEXE, |
29 | 29 |
CL_DATAFILE, |
30 |
- CL_MAILFILE, |
|
31 | 30 |
CL_GZFILE, |
32 | 31 |
CL_ZIPFILE, |
33 | 32 |
CL_BZFILE, |
... | ... |
@@ -36,8 +35,9 @@ typedef enum { |
36 | 36 |
CL_OLE2FILE, |
37 | 37 |
CL_MSCABFILE, |
38 | 38 |
|
39 |
- /* file types recognized on-the-fly: bigger numbers have bigger priority */ |
|
40 |
- CL_HTMLFILE |
|
39 |
+ /* bigger numbers have higher priority (in o-t-f detection) */ |
|
40 |
+ CL_HTMLFILE, /* on the fly */ |
|
41 |
+ CL_MAILFILE /* magic + on the fly */ |
|
41 | 42 |
|
42 | 43 |
} cli_file_t; |
43 | 44 |
|
... | ... |
@@ -1010,6 +1010,7 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, |
1010 | 1010 |
} |
1011 | 1011 |
|
1012 | 1012 |
if(!options) { /* raw mode (stdin, etc.) */ |
1013 |
+ cli_dbgmsg("Raw mode: no support for archives.\n"); |
|
1013 | 1014 |
if((ret = cli_scandesc(desc, virname, scanned, root, 0) == CL_VIRUS)) |
1014 | 1015 |
cli_dbgmsg("%s virus found in descriptor %d.\n", *virname, desc); |
1015 | 1016 |
return ret; |
... | ... |
@@ -1027,6 +1028,7 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, |
1027 | 1027 |
lseek(desc, 0, SEEK_SET); |
1028 | 1028 |
|
1029 | 1029 |
if(bread != MAGIC_BUFFER_SIZE) { |
1030 |
+ cli_dbgmsg("File recognition failed: bread != MAGIC_BUFFER_SIZE (%d != %d)\n", bread, MAGIC_BUFFER_SIZE); |
|
1030 | 1031 |
/* short read: No need to do magic */ |
1031 | 1032 |
if((ret = cli_scandesc(desc, virname, scanned, root, 0) == CL_VIRUS)) |
1032 | 1033 |
cli_dbgmsg("%s virus found in descriptor %d.\n", *virname, desc); |
... | ... |
@@ -1115,6 +1117,12 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, |
1115 | 1115 |
if(cli_scanhtml(desc, virname, scanned, root, limits, options, reclev) == CL_VIRUS) |
1116 | 1116 |
return CL_VIRUS; |
1117 | 1117 |
break; |
1118 |
+ |
|
1119 |
+ case CL_MAILFILE: |
|
1120 |
+ if(SCAN_MAIL) |
|
1121 |
+ if(cli_scanmail(desc, virname, scanned, root, limits, options, reclev) == CL_VIRUS) |
|
1122 |
+ return CL_VIRUS; |
|
1123 |
+ break; |
|
1118 | 1124 |
} |
1119 | 1125 |
} |
1120 | 1126 |
} |
... | ... |
@@ -1134,7 +1142,6 @@ static int cli_scanfile(const char *filename, const char **virname, unsigned lon |
1134 | 1134 |
int fd, ret; |
1135 | 1135 |
|
1136 | 1136 |
/* internal version of cl_scanfile with reclev preserved */ |
1137 |
- |
|
1138 | 1137 |
if((fd = open(filename, O_RDONLY)) == -1) |
1139 | 1138 |
return CL_EOPEN; |
1140 | 1139 |
|
... | ... |
@@ -1148,6 +1155,7 @@ int cl_scanfile(const char *filename, const char **virname, unsigned long int *s |
1148 | 1148 |
{ |
1149 | 1149 |
int fd, ret; |
1150 | 1150 |
|
1151 |
+ |
|
1151 | 1152 |
if((fd = open(filename, O_RDONLY)) == -1) |
1152 | 1153 |
return CL_EOPEN; |
1153 | 1154 |
|