[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:02:39 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 846f2e21323e5e4e2fa514a4e91aa8b374a7eab4
Merge: 9d2a56bc3593f7cfb9715f6b0bb5c95b3323c63f cb680655f1590e07d11e7211b489bbd8accbf83e
Author: aCaB <acab at clamav.net>
Date: Mon Aug 31 00:12:12 2009 +0200
Merge branch 'master' into replace-mmap
diff --combined libclamav/scanners.c
index 90b8097,89a9f19..261af05
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@@ -108,7 -108,7 +108,7 @@@
static int cli_scanfile(const char *filename, cli_ctx *ctx);
- static int cli_scandir(const char *dirname, cli_ctx *ctx, cli_file_t container)
+ static int cli_scandir(const char *dirname, cli_ctx *ctx)
{
DIR *dd;
struct dirent *dent;
@@@ -120,8 -120,6 +120,6 @@@
#endif
struct stat statbuf;
char *fname;
- int fd, ret = CL_CLEAN;
- cli_file_t ftype;
if((dd = opendir(dirname)) != NULL) {
@@@ -149,7 -147,7 +147,7 @@@
/* stat the file */
if(lstat(fname, &statbuf) != -1) {
if(S_ISDIR(statbuf.st_mode) && !S_ISLNK(statbuf.st_mode)) {
- if(cli_scandir(fname, ctx, container) == CL_VIRUS) {
+ if(cli_scandir(fname, ctx) == CL_VIRUS) {
free(fname);
closedir(dd);
return CL_VIRUS;
@@@ -161,27 -159,6 +159,6 @@@
closedir(dd);
return CL_VIRUS;
}
-
- if(container == CL_TYPE_MAIL) {
- fd = open(fname, O_RDONLY|O_BINARY);
- if(fd == -1) {
- char err[128];
- cli_warnmsg("Cannot open file %s: %s, mode: %x\n", fname, cli_strerror(errno, err, sizeof(err)), statbuf.st_mode);
- free(fname);
- continue;
- }
- ftype = cli_filetype2(fd, ctx->engine);
- if(ftype >= CL_TYPE_TEXT_ASCII && ftype <= CL_TYPE_TEXT_UTF16BE) {
- lseek(fd, 0, SEEK_SET);
- ret = cli_scandesc(fd, ctx, CL_TYPE_MAIL, 0, NULL, AC_SCAN_VIR);
- }
- close(fd);
- if(ret == CL_VIRUS) {
- free(fname);
- closedir(dd);
- return CL_VIRUS;
- }
- }
}
}
}
@@@ -365,7 -342,7 +342,7 @@@ static int cli_scanrar(int desc, cli_ct
metadata = metadata_tmp = rar_state.metadata;
- if(cli_scandir(rar_state.comment_dir, ctx, 0) == CL_VIRUS)
+ if(cli_scandir(rar_state.comment_dir, ctx) == CL_VIRUS)
ret = CL_VIRUS;
cli_unrar_close(&rar_state);
@@@ -820,7 -797,7 +797,7 @@@ static int cli_vba_scandir(const char *
fd = open(vbaname, O_RDONLY|O_BINARY);
if (fd == -1) continue;
if ((fullname = cli_ppt_vba_read(fd, ctx))) {
- if(cli_scandir(fullname, ctx, 0) == CL_VIRUS) {
+ if(cli_scandir(fullname, ctx) == CL_VIRUS) {
ret = CL_VIRUS;
}
if(!ctx->engine->keeptmp)
@@@ -1007,7 -984,7 +984,7 @@@ static int cli_scanhtml(int desc, cli_c
if (ret == CL_CLEAN) {
snprintf(fullname, 1024, "%s/rfc2397", tempname);
- ret = cli_scandir(fullname, ctx, 0);
+ ret = cli_scandir(fullname, ctx);
}
if(!ctx->engine->keeptmp)
@@@ -1197,7 -1174,7 +1174,7 @@@ static int cli_scanole2(int desc, cli_c
ret = cli_vba_scandir(dir, ctx, vba);
uniq_free(vba);
if(ret != CL_VIRUS)
- if(cli_scandir(dir, ctx, 0) == CL_VIRUS)
+ if(cli_scandir(dir, ctx) == CL_VIRUS)
ret = CL_VIRUS;
ctx->recursion--;
}
@@@ -1256,7 -1233,7 +1233,7 @@@ static int cli_scanbinhex(int desc, cli
if((ret = cli_binhex(dir, desc)))
cli_dbgmsg("Binhex: %s\n", cl_strerror(ret));
else
- ret = cli_scandir(dir, ctx, 0);
+ ret = cli_scandir(dir, ctx);
if(!ctx->engine->keeptmp)
cli_rmdirs(dir);
@@@ -1293,11 -1270,11 +1270,11 @@@ static int cli_scanmschm(int desc, cli_
}
do {
- ret = cli_chm_prepare_file(desc, dir, &metadata);
+ ret = cli_chm_prepare_file(&metadata);
if (ret != CL_SUCCESS) {
break;
}
- ret = cli_chm_extract_file(desc, dir, &metadata, ctx);
+ ret = cli_chm_extract_file(dir, &metadata, ctx);
if (ret == CL_SUCCESS) {
lseek(metadata.ofd, 0, SEEK_SET);
rc = cli_magic_scandesc(metadata.ofd, ctx);
@@@ -1342,7 -1319,7 +1319,7 @@@ static int cli_scanscrenc(int desc, cli
}
if (html_screnc_decode(desc, tempname))
- ret = cli_scandir(tempname, ctx, 0);
+ ret = cli_scandir(tempname, ctx);
if(!ctx->engine->keeptmp)
cli_rmdirs(tempname);
@@@ -1504,7 -1481,7 +1481,7 @@@ static int cli_scantnef(int desc, cli_c
ret = cli_tnef(dir, desc, ctx);
if(ret == CL_CLEAN)
- ret = cli_scandir(dir, ctx, 0);
+ ret = cli_scandir(dir, ctx);
if(!ctx->engine->keeptmp)
cli_rmdirs(dir);
@@@ -1530,7 -1507,7 +1507,7 @@@ static int cli_scanuuencoded(int desc,
ret = cli_uuencode(dir, desc);
if(ret == CL_CLEAN)
- ret = cli_scandir(dir, ctx, 0);
+ ret = cli_scandir(dir, ctx);
if(!ctx->engine->keeptmp)
cli_rmdirs(dir);
@@@ -1567,7 -1544,9 +1544,9 @@@ static int cli_scanmail(int desc, cli_c
return ret;
}
- ret = cli_scandir(dir, ctx, CL_TYPE_MAIL);
+ ctx->container_type = CL_TYPE_MAIL;
+ ret = cli_scandir(dir, ctx);
+ ctx->container_type = 0;
if(!ctx->engine->keeptmp)
cli_rmdirs(dir);
@@@ -1881,6 -1860,7 +1860,7 @@@ int cli_magic_scandesc(int desc, cli_ct
cli_file_t type, dettype = 0;
struct stat sb;
uint8_t typercg = 1;
+ cli_file_t current_container = ctx->container_type; /* TODO: container tracking code TBD - bb#1293 */
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);
@@@ -1934,8 -1914,8 +1914,8 @@@
lseek(desc, 0, SEEK_SET);
}
+ ctx->container_type = 0;
ctx->recursion++;
-
switch(type) {
case CL_TYPE_IGNORED:
break;
@@@ -2131,6 -2111,7 +2111,7 @@@
break;
}
ctx->recursion--;
+ ctx->container_type = current_container;
if(ret == CL_VIRUS)
return CL_VIRUS;
@@@ -2157,6 -2138,8 +2138,8 @@@
case CL_TYPE_TEXT_UTF8:
if((DCONF_DOC & DOC_CONF_SCRIPT) && dettype != CL_TYPE_HTML)
ret = cli_scanscript(desc, ctx);
+ if(ret != CL_VIRUS && ctx->container_type == CL_TYPE_MAIL)
+ ret = cli_scandesc(desc, ctx, CL_TYPE_MAIL, 0, NULL, AC_SCAN_VIR);
break;
/* Due to performance reasons all executables were first scanned
* in raw mode. Now we will try to unpack them
@@@ -2194,6 -2177,7 +2177,7 @@@ int cl_scandesc(int desc, const char **
ctx.scanned = scanned;
ctx.options = scanoptions;
ctx.found_possibly_unwanted = 0;
+ ctx.container_type = 0;
ctx.dconf = (struct cli_dconf *) engine->dconf;
rc = cli_magic_scandesc(desc, &ctx);
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list