Browse code

cdb: handle mail files

Tomasz Kojm authored on 2010/01/16 00:24:16
Showing 1 changed files
... ...
@@ -29,6 +29,8 @@ static	char	const	rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $";
29 29
 #include <string.h>
30 30
 #include <errno.h>
31 31
 #include <fcntl.h>
32
+#include <sys/types.h>
33
+#include <sys/stat.h>
32 34
 
33 35
 #ifdef	HAVE_SYS_PARAM_H
34 36
 #include <sys/param.h>	/* for NAME_MAX */
... ...
@@ -619,6 +621,7 @@ fileblobScan(const fileblob *fb)
619 619
 {
620 620
 	int rc;
621 621
 	cli_file_t ftype;
622
+	struct stat sb;
622 623
 
623 624
 	if(fb->isInfected)
624 625
 		return CL_VIRUS;
... ...
@@ -635,6 +638,9 @@ fileblobScan(const fileblob *fb)
635 635
 
636 636
 	fflush(fb->fp);
637 637
 	lseek(fb->fd, 0, SEEK_SET);
638
+	fstat(fb->fd, &sb);
639
+	if(cli_matchmeta(fb->ctx, fb->b.name, sb.st_size, sb.st_size, 0, 0, 0, NULL) == CL_VIRUS)
640
+	    return CL_VIRUS;
638 641
 
639 642
 	rc = cli_magic_scandesc(fb->fd, fb->ctx);
640 643
 	if(rc == CL_VIRUS) {