Browse code

Small bugfixes

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@233 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/02/03 10:35:25
Showing 5 changed files
... ...
@@ -1,7 +1,18 @@
1
+Tue Feb  3 02:31:55 CET 2004 (tk)
2
+---------------------------------
3
+  * libclamav: + don't report errors when archive limits are reached
4
+	       + enabled scanning of "X-UIDL" mail files
5
+  * clamscan: + don't count broken archives twice (bug reported by Przemyslaw
6
+	        Holowczyc <doozer*skc.com.pl>)
7
+	      + don't try to drop privileges in normal user mode when
8
+	        clamscan is started with --mbox in stdin scanning mode
9
+		(bug reported by Ed Ravin <eravin*panix.com>)
10
+  * freshclam: + fixed -c handling (bug reported by scsi <scsi*softland.ru>)
11
+
1 12
 Mon Feb  2 17:12:25 GMT 2004 (njh)
2 13
 ----------------------------------
3 14
   * libclamav:	Scan a rare form of bounce message identified by
4
-  	Denis De Messemacker <ddm@e-labs.org>
15
+  	Denis De Messemacker <ddm*e-labs.org>
5 16
 
6 17
 Mon Feb  2 13:46:51 GMT 2004 (njh)
7 18
 ----------------------------------
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+ *  Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
3 3
  *
4 4
  *  This program is free software; you can redistribute it and/or modify
5 5
  *  it under the terms of the GNU General Public License as published by
... ...
@@ -174,9 +174,11 @@ int scanmanager(const struct optstruct *opt)
174 174
 
175 175
 		/* njh@bandsman.co.uk: BeOS */
176 176
 #if !defined(C_CYGWIN) && !defined(C_BEOS)
177
-		if((user = getpwnam(UNPUSER)) == NULL) {
178
-		    mprintf("@Can't get information about user %s\n", UNPUSER);
179
-		    exit(60); /* this is critical problem, so we just exit here */
177
+		if(!getuid()) {
178
+		    if((user = getpwnam(UNPUSER)) == NULL) {
179
+			mprintf("@Can't get information about user %s\n", UNPUSER);
180
+			exit(60); /* this is critical problem, so we just exit here */
181
+		    }
180 182
 		}
181 183
 #endif
182 184
 
... ...
@@ -385,6 +387,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
385 385
 	    return 0;
386 386
 	/* in other case try to continue with external archivers */
387 387
 	options &= ~CL_ARCHIVE; /* and disable decompression for the below checkfile() */
388
+	claminfo.files--; /* don't count it */
388 389
     }
389 390
 
390 391
     if((strbcasestr(filename, ".zip") && optl(opt, "unzip"))
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+ *  Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
3 3
  *			     Damien Curtain <damien@pagefault.org>
4 4
  *
5 5
  *  This program is free software; you can redistribute it and/or modify
... ...
@@ -55,7 +55,7 @@ int freshclam(struct optstruct *opt)
55 55
     }
56 56
 
57 57
     /* parse the config file */
58
-    if((cfgfile = getargc(opt, 'c'))) {
58
+    if((cfgfile = getargl(opt, "config-file"))) {
59 59
 	copt = parsecfg(cfgfile);
60 60
     } else {
61 61
 	/* TODO: force strict permissions on freshclam.conf */
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+ *  Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
3 3
  *  HTTP/1.1 compliance by Arkadiusz Miskiewicz <misiek@pld.org.pl>
4 4
  *  Proxy support by Nigel Horne <njh@bandsman.co.uk>
5 5
  *  Proxy authorization support by Gernot Tenchio <g.tenchio@telco-tech.de>
... ...
@@ -60,6 +60,7 @@ int cli_scanrar_inuse = 0;
60 60
 #define RAWMAIL_MAGIC_STR "Received: "
61 61
 #define MAILDIR_MAGIC_STR "Return-Path: "
62 62
 #define DELIVERED_MAGIC_STR "Delivered-To: "
63
+#define XUIDL_MAGIC_STR "X-UIDL: "
63 64
 #define BZIP_MAGIC_STR "BZh"
64 65
 #define OLE2_MAGIC_STR "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
65 66
 
... ...
@@ -152,13 +153,13 @@ int cli_scanrar(int desc, char **virname, long int *scanned, const struct cl_nod
152 152
 		cli_dbgmsg("RAR->%s: Size exceeded (%d, max: %d)\n", rarlist->item.Name, rarlist->item.UnpSize, limits->maxfilesize);
153 153
 		rarlist = rarlist->next;
154 154
 		files++;
155
-		ret = CL_EMAXSIZE;
155
+		/* ret = CL_EMAXSIZE; */
156 156
 		continue;
157 157
 	    }
158 158
 
159 159
 	    if(limits->maxfiles && (files > limits->maxfiles)) {
160 160
 		cli_dbgmsg("RAR: Files limit reached (max: %d)\n", limits->maxfiles);
161
-		ret = CL_EMAXFILES;
161
+		/* ret = CL_EMAXFILES; */
162 162
 		break;
163 163
 	    }
164 164
 	}
... ...
@@ -302,13 +303,13 @@ int cli_scanzip(int desc, char **virname, long int *scanned, const struct cl_nod
302 302
 	    if(limits->maxfilesize && (zdirent.st_size > limits->maxfilesize)) {
303 303
 		cli_dbgmsg("Zip -> %s: Size exceeded (%d, max: %d)\n", zdirent.d_name, zdirent.st_size, limits->maxfilesize);
304 304
 		files++;
305
-		ret = CL_EMAXSIZE;
305
+		/* ret = CL_EMAXSIZE; */
306 306
 		continue; /* this is not a bug */
307 307
 	    }
308 308
 
309 309
 	    if(limits->maxfiles && (files > limits->maxfiles)) {
310 310
 		cli_dbgmsg("Zip: Files limit reached (max: %d)\n", limits->maxfiles);
311
-		ret = CL_EMAXFILES;
311
+		/* ret = CL_EMAXFILES; */
312 312
 		break;
313 313
 	    }
314 314
 	}
... ...
@@ -416,7 +417,7 @@ int cli_scangzip(int desc, char **virname, long int *scanned, const struct cl_no
416 416
 	if(limits)
417 417
 	    if(limits->maxfilesize && (size + FILEBUFF > limits->maxfilesize)) {
418 418
 		cli_dbgmsg("Gzip->desc(%d): Size exceeded (stopped at %d, max: %d)\n", desc, size, limits->maxfilesize);
419
-		ret = CL_EMAXSIZE;
419
+		/* ret = CL_EMAXSIZE; */
420 420
 		break;
421 421
 	    }
422 422
 
... ...
@@ -504,7 +505,7 @@ int cli_scanbzip(int desc, char **virname, long int *scanned, const struct cl_no
504 504
 	if(limits)
505 505
 	    if(limits->maxfilesize && (size + FILEBUFF > limits->maxfilesize)) {
506 506
 		cli_dbgmsg("Bzip2->desc(%d): Size exceeded (stopped at %d, max: %d)\n", desc, size, limits->maxfilesize);
507
-		ret = CL_EMAXSIZE;
507
+		/* ret = CL_EMAXSIZE; */
508 508
 		break;
509 509
 	    }
510 510
 
... ...
@@ -710,7 +711,8 @@ int cli_magic_scandesc(int desc, char **virname, long int *scanned, const struct
710 710
 
711 711
 	if(SCAN_ARCHIVE && limits && limits->maxreclevel)
712 712
 	    if(*reclev > limits->maxreclevel)
713
-		return CL_EMAXREC;
713
+		/* return CL_EMAXREC; */
714
+		return CL_CLEAN;
714 715
 
715 716
 	(*reclev)++;
716 717
 
... ...
@@ -770,6 +772,9 @@ int cli_magic_scandesc(int desc, char **virname, long int *scanned, const struct
770 770
 	} else if(SCAN_MAIL && !strncmp(magic, DELIVERED_MAGIC_STR, strlen(DELIVERED_MAGIC_STR))) {
771 771
 	    cli_dbgmsg("Recognized (Delivered-To) mail file.\n");
772 772
 	    ret = cli_scanmail(desc, virname, scanned, root, limits, options, reclev);
773
+	} else if(SCAN_MAIL && !strncmp(magic, XUIDL_MAGIC_STR, strlen(XUIDL_MAGIC_STR))) {
774
+	    cli_dbgmsg("Recognized (X-UIDL) mail file.\n");
775
+	    ret = cli_scanmail(desc, virname, scanned, root, limits, options, reclev);
773 776
 	}
774 777
 	(*reclev)--;
775 778
     }