[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 01:21:49 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 742b3a0e0666dc0d1363680b53a6b3b6c3ee32a4
Author: aCaB <acab at clamav.net>
Date:   Fri Mar 5 18:09:00 2010 +0100

    set dont_cache_flag on the fmap stack

diff --git a/libclamav/matcher.c b/libclamav/matcher.c
index 548e9c5..7c927ff 100644
--- a/libclamav/matcher.c
+++ b/libclamav/matcher.c
@@ -407,6 +407,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struc
 
     if((*ctx->fmap = fmap(desc, 0, 0))) {
 	ret = cli_fmap_scandesc(ctx, ftype, ftonly, ftoffset, acmode, NULL);
+	map->dont_cache_flag = (*ctx->fmap)->dont_cache_flag;
 	funmap(*ctx->fmap);
     }
     *ctx->fmap = map;
diff --git a/libclamav/scanners.c b/libclamav/scanners.c
index 5ec5e65..7c254bf 100644
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@ -1869,6 +1869,16 @@ static int cli_scanraw(cli_ctx *ctx, cli_file_t type, uint8_t typercg, cli_file_
 }
 
 
+static void emax_reached(cli_ctx *ctx) {
+    fmap_t **ctx_fmap = ctx->fmap;
+    while(*ctx_fmap) {
+	fmap_t *map = *ctx_fmap;
+	map->dont_cache_flag = 1;
+	ctx_fmap--;
+    }
+    cli_dbgmsg("emax_reached: marked parents as non cacheable\n");
+}
+
 #define LINESTR(x) #x
 #define LINESTR2(x) LINESTR(x)
 #define __AT__  " at line "LINESTR2(__LINE__)
@@ -1876,6 +1886,7 @@ static int cli_scanraw(cli_ctx *ctx, cli_file_t type, uint8_t typercg, cli_file_
     cli_dbgmsg("cli_magic_scandesc: returning %d %s\n", retcode, __AT__);	\
     return retcode;							\
     } while(0)
+
 int cli_magic_scandesc(int desc, cli_ctx *ctx)
 {
 	int ret = CL_CLEAN;
@@ -1890,7 +1901,8 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
     cli_dbgmsg("in cli_magic_scandesc (reclevel: %u/%u)\n", ctx->recursion, ctx->engine->maxreclevel);
     if(ctx->engine->maxreclevel && ctx->recursion > ctx->engine->maxreclevel) {
         cli_dbgmsg("cli_magic_scandesc: Archive recursion limit exceeded (%u, max: %u)\n", ctx->recursion, ctx->engine->maxreclevel);
-	ret_from_magicscan(CL_CLEAN); /* FIXMEDONTCACHE */
+	emax_reached(ctx);
+	ret_from_magicscan(CL_CLEAN);
     }
 
     if(fstat(desc, &sb) == -1) {
@@ -1913,8 +1925,10 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
 	ret_from_magicscan(CL_EMALFDB);
     }
 
-    if(cli_updatelimits(ctx, sb.st_size)!=CL_CLEAN)
-        ret_from_magicscan(CL_CLEAN); /* FIXMEDONTCACHE */
+    if(cli_updatelimits(ctx, sb.st_size)!=CL_CLEAN) {
+	emax_reached(ctx);
+        ret_from_magicscan(CL_CLEAN);
+    }
 
     ctx->fmap++;
     if(!(*ctx->fmap = fmap(desc, 0, sb.st_size))) {
@@ -1944,7 +1958,7 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
 	    if(ctx->recursion != ctx->engine->maxreclevel)
 		cache_add(hash, hashed_size, ctx); /* Only cache if limits are not reached */
 	    else 
-		{} /* FIXMEDONTCACHE */
+		emax_reached(ctx);
 	}
 
 	funmap(*ctx->fmap);

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list