git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1098 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/11/16 07:58:03... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Nov 15 23:55:50 CET 2004 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * libclamav/scanners.c: mscab: pass duplicated descriptor to cabd->dsearch() |
|
4 |
+ |
|
1 | 5 |
Sun Nov 14 15:23:02 GMT 2004 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* clamav-milter: Use SCAN in more places in preference to STREAM |
... | ... |
@@ -41,6 +41,7 @@ |
41 | 41 |
#define TARGET_TABLE_SIZE 6 |
42 | 42 |
static int targettab[TARGET_TABLE_SIZE] = { 0, CL_TYPE_MSEXE, CL_TYPE_MSOLE2, CL_TYPE_HTML, CL_TYPE_MAIL, CL_TYPE_GRAPHICS }; |
43 | 43 |
|
44 |
+extern short cli_debug_flag; |
|
44 | 45 |
|
45 | 46 |
int cli_scanbuff(const char *buffer, unsigned int length, const char **virname, const struct cl_node *root, unsigned short ftype) |
46 | 47 |
{ |
... | ... |
@@ -283,6 +284,19 @@ int cli_scandesc(int desc, const char **virname, long int *scanned, const struct |
283 | 283 |
if(root->md5_hlist) { |
284 | 284 |
MD5Final(digest, &ctx); |
285 | 285 |
|
286 |
+ if(cli_debug_flag) { |
|
287 |
+ char md5str[33]; |
|
288 |
+ int i; |
|
289 |
+ |
|
290 |
+ pt = md5str; |
|
291 |
+ for(i = 0; i < 16; i++) { |
|
292 |
+ sprintf(pt, "%02x", digest[i]); |
|
293 |
+ pt += 2; |
|
294 |
+ } |
|
295 |
+ md5str[32] = 0; |
|
296 |
+ cli_dbgmsg("Calculated MD5 checksum: %s\n", md5str); |
|
297 |
+ } |
|
298 |
+ |
|
286 | 299 |
if((md5_node = cli_vermd5(digest, root))) { |
287 | 300 |
struct stat sb; |
288 | 301 |
|
... | ... |
@@ -321,10 +321,12 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const |
321 | 321 |
|
322 | 322 |
cli_dbgmsg("Zip: %s, compressed: %u, normal: %u, ratio: %d (max: %d)\n", zdirent.d_name, zdirent.d_csize, zdirent.st_size, zdirent.st_size / (zdirent.d_csize+1), limits ? limits->maxratio : -1 ); |
323 | 323 |
|
324 |
- if(!zdirent.st_size) { /* omit directories and empty files */ |
|
324 |
+ /* |
|
325 |
+ if(!zdirent.st_size) { |
|
325 | 326 |
files++; |
326 | 327 |
continue; |
327 | 328 |
} |
329 |
+ */ |
|
328 | 330 |
|
329 | 331 |
/* work-around for problematic zips (zziplib crashes with them) */ |
330 | 332 |
if(zdirent.d_csize <= 0 || zdirent.st_size < 0) { |
... | ... |
@@ -666,7 +668,7 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons |
666 | 666 |
return CL_EMSCAB; |
667 | 667 |
} |
668 | 668 |
|
669 |
- if((base = cabd->dsearch(cabd, desc)) == NULL) { |
|
669 |
+ if((base = cabd->dsearch(cabd, dup(desc))) == NULL) { |
|
670 | 670 |
cli_dbgmsg("MSCAB: I/O error or no valid cabinets found\n"); |
671 | 671 |
mspack_destroy_cab_decompressor(cabd); |
672 | 672 |
return CL_EMSCAB; |
... | ... |
@@ -1307,7 +1309,8 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const |
1307 | 1307 |
int typerec; |
1308 | 1308 |
|
1309 | 1309 |
type == CL_TYPE_UNKNOWN_TEXT ? (typerec = 1) : (typerec = 0); |
1310 |
- lseek(desc, 0, SEEK_SET); |
|
1310 |
+ if(lseek(desc, 0, SEEK_SET) < 0) |
|
1311 |
+ cli_errmsg("lseek() failed, trying to continue anyway...\n"); |
|
1311 | 1312 |
|
1312 | 1313 |
if((nret = cli_scandesc(desc, virname, scanned, root, typerec, type)) == CL_VIRUS) { |
1313 | 1314 |
cli_dbgmsg("%s found in descriptor %d.\n", *virname, desc); |