git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@847 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/09/13 09:27:39... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Mon Sep 13 02:22:31 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamscan: fix miscounting when trying to scan inaccessible archives |
|
4 |
+ (thanks to Robert Hogan <robert*roberthogan.net>) |
|
5 |
+ |
|
1 | 6 |
Mon Sep 13 01:41:48 CEST 2004 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/untar.c: return with CL_EFORMAT instead of CL_EDSIG |
... | ... |
@@ -359,6 +359,15 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
359 | 359 |
return 0; |
360 | 360 |
} |
361 | 361 |
|
362 |
+ if(geteuid()) |
|
363 |
+ if(checkaccess(filename, NULL, R_OK) != 1) { |
|
364 |
+ if(!printinfected) |
|
365 |
+ mprintf("%s: Access denied.\n", filename); |
|
366 |
+ return 0; |
|
367 |
+ } |
|
368 |
+ |
|
369 |
+ claminfo.files++; |
|
370 |
+ |
|
362 | 371 |
/* |
363 | 372 |
* check the extension - this is a special case, normally we don't need to |
364 | 373 |
* do this (libclamav detects archive by its magic string), but here we |
... | ... |
@@ -387,7 +396,6 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
387 | 387 |
return 0; |
388 | 388 |
/* in other case try to continue with external archivers */ |
389 | 389 |
options &= ~CL_ARCHIVE; /* and disable decompression for the below checkfile() */ |
390 |
- claminfo.files--; /* don't count it */ |
|
391 | 390 |
} |
392 | 391 |
|
393 | 392 |
if((cli_strbcasestr(filename, ".zip") && optl(opt, "unzip")) |
... | ... |
@@ -430,12 +438,6 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
430 | 430 |
} |
431 | 431 |
} |
432 | 432 |
|
433 |
- if(geteuid()) |
|
434 |
- if(checkaccess(filename, NULL, R_OK) != 1) { |
|
435 |
- if(!printinfected) |
|
436 |
- mprintf("%s: Access denied.\n", filename); |
|
437 |
- return 0; |
|
438 |
- } |
|
439 | 433 |
|
440 | 434 |
if((ret = checkfile(filename, root, limits, options)) == CL_VIRUS) { |
441 | 435 |
if(optl(opt, "remove")) { |
... | ... |
@@ -762,8 +764,6 @@ int checkfile(const char *filename, const struct cl_node *root, const struct cl_ |
762 | 762 |
return 54; |
763 | 763 |
} |
764 | 764 |
|
765 |
- claminfo.files++; |
|
766 |
- |
|
767 | 765 |
if((ret = cl_scandesc(fd, &virname, &claminfo.blocks, root, limits, options)) == CL_VIRUS) { |
768 | 766 |
mprintf("%s: %s FOUND\n", filename, virname); |
769 | 767 |
logg("%s: %s FOUND\n", filename, virname); |