Browse code

libclamav/scanners.c: improve scanning of mail files in raw mode (bb#2244)

Tomasz Kojm authored on 2010/12/29 22:37:55
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Dec 29 14:36:46 CET 2010 (tk)
2
+---------------------------------
3
+ * libclamav/scanners.c: improve scanning of mail files in raw mode (bb#2244)
4
+
1 5
 Tue Dec 28 18:22:30 CET 2010 (tk)
2 6
 ---------------------------------
3 7
  * clamscan: add new options --follow-(dir|file)-symlinks (bb#1870)
... ...
@@ -1869,8 +1869,10 @@ static int cli_scanraw(cli_ctx *ctx, cli_file_t type, uint8_t typercg, cli_file_
1869 1869
 	    case CL_TYPE_MAIL:
1870 1870
 		ctx->container_type = CL_TYPE_MAIL;
1871 1871
 		ctx->container_size = map->len;
1872
-		if(SCAN_MAIL && type == CL_TYPE_TEXT_ASCII && (DCONF_MAIL & MAIL_CONF_MBOX))
1872
+		if(SCAN_MAIL && type == CL_TYPE_TEXT_ASCII && (DCONF_MAIL & MAIL_CONF_MBOX)) {
1873
+		    *dettype = CL_TYPE_MAIL;
1873 1874
 		    nret = cli_scanmail(map->fd, ctx);
1875
+		}
1874 1876
 		ctx->container_type = current_container_type;
1875 1877
 		ctx->container_size = current_container_size;
1876 1878
 		break;
... ...
@@ -2347,7 +2349,7 @@ static int magic_scandesc(int desc, cli_ctx *ctx, cli_file_t type)
2347 2347
 	case CL_TYPE_TEXT_UTF8:
2348 2348
 	    if((DCONF_DOC & DOC_CONF_SCRIPT) && dettype != CL_TYPE_HTML)
2349 2349
 	        ret = cli_scanscript(ctx);
2350
-	    if(SCAN_MAIL && (DCONF_MAIL & MAIL_CONF_MBOX) && ret != CL_VIRUS && ctx->container_type == CL_TYPE_MAIL) {
2350
+	    if(SCAN_MAIL && (DCONF_MAIL & MAIL_CONF_MBOX) && ret != CL_VIRUS && (ctx->container_type == CL_TYPE_MAIL || dettype == CL_TYPE_MAIL)) {
2351 2351
 		lseek(desc, 0, SEEK_SET);
2352 2352
 		ret = cli_scandesc(desc, ctx, CL_TYPE_MAIL, 0, NULL, AC_SCAN_VIR, NULL);
2353 2353
 	    }