Browse code

zip fix

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

Tomasz Kojm authored on 2004/01/14 12:47:16
Showing 10 changed files
... ...
@@ -10,8 +10,8 @@ Author of clamav-milter and the whole mbox code.
10 10
 System administrator (www, mailing lists, mirror issues, virus
11 11
 submission mechanisms): Luca 'NERvOus' Gibelli <nervous*clamav.net>
12 12
 
13
-Submission management interface (for database developers only): Thomas Madsen
14
-<tm*softcom.dk>
13
+Submission management interface (for database developers only): Diego D'Ambra
14
+<diego*clamav.net>, Thomas Madsen <tm*softcom.dk>
15 15
 
16 16
 
17 17
 Database developers:
... ...
@@ -27,7 +27,8 @@ ClamAV logo: Mia Kalenius and Sergei Pronin <sp*finndesign.fi>
27 27
 TrashScan was written by Trashware <trashware*gmx.net>.
28 28
 
29 29
 libclamav/zziplib: Guido Draheim <guidod*gmx.de>
30
-libclamav/unrarlib.c: Christian Scheurer and Johannes Winkelmann (jw*tks6.net)
30
+libclamav/unrarlib.c: Christian Scheurer and Johannes Winkelmann, see
31
+							    www.unrarlib.org
31 32
 
32 33
 ClamAV patches were submitted by (in alphabetical order):
33 34
 
... ...
@@ -1,3 +1,10 @@
1
+Wed Jan 14 04:44:03 CET 2004 (tk)
2
+---------------------------------
3
+  * libclamav: reversed zziplib patch from 20031224 (due to a problem reported
4

                
5
+  * freshclam: display a warning if the engine is outdated
6
+  * docs: manual page updates
7
+
1 8
 Tue Jan 13 10:12:36 GMT 2004 (njh)
2 9
 ----------------------------------
3 10
   * libclamav: Remove duplicate code when handling multipart messages
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+ *  Copyright (C) 2002 - 2004 Tomasz Kojm <zolw@konarski.edu.pl>
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
... ...
@@ -186,7 +186,7 @@ void help(void)
186 186
 
187 187
     mprintf("\n");
188 188
     mprintf("                          Clam AntiVirus Scanner "VERSION"\n");
189
-    mprintf("                (c) 2002, 2003 Tomasz Kojm <tkojm@clamav.net>\n\n");
189
+    mprintf("                (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>\n\n");
190 190
 
191 191
     mprintf("    --help                -h             Show help\n");
192 192
     mprintf("    --version             -V             Print version number and exit\n");
... ...
@@ -1,13 +1,17 @@
1
-.TH "clamav-milter" "8" "November 11, 2003" "" "Clam AntiVirus"
1
+.TH "clamav-milter" "8" "January 12, 2004" "" "Clam AntiVirus"
2 2
 .SH "NAME"
3 3
 .LP 
4
-clamav\-milter \- a milter compatible mail scanner
4
+clamav\-milter \- milter compatible mail scanner
5 5
 .SH "SYNOPSIS"
6 6
 .LP 
7 7
 clamav\-milter [options] socket_address
8 8
 .SH "DESCRIPTION"
9 9
 .LP 
10
-clamav\-milter is a virus filter interface for sendmail. It uses a mail scanning engine built into clamd.
10
+clamav\-milter is a filter for sendmail mail server. It uses a mail scanning engine built into clamd.
11
+.TP
12
+clamav\-milter requires \fBclamd(8)\fR to run.
13
+When starting, clamav\-milter verifies that it can communicate with clamd;
14
+if it cannot it terminates.
11 15
 .SH "OPTIONS"
12 16
 .LP 
13 17
 
... ...
@@ -19,49 +23,76 @@ Output the help information and exit.
19 19
 Print the version number and exit.
20 20
 .TP 
21 21
 \fB\-c FILE, \-\-config\-file=FILE\fR
22
-By default clamav\-milter uses a default ClamAV configuration file. With this option you may select an another one.
22
+By default clamav\-milter uses a default configuration file, this option allows you to specify another one.
23 23
 .TP 
24 24
 \fB\-x n, \-\-debug\-level=n\fR
25
-Set the debug level to n (where n from [0..9]).
25
+Set the debug level to n (where n from [0..9]) if \fBclamav\-miter\fR was
26
+configured with \-\-clamav-debug.
26 27
 .TP 
27 28
 \fB\-b, \-\-bounce\fR
28
-Send a failure message to the sender.
29
+Send a failure message to the sender, and to the postmaster.
30
+[ \fBWarning\fR: most viruses and worms
31
+fake their source address, so this option is not recommended ]
32
+.TP
33
+\fB-d, \-\-dont-scan-on-error\fR
34
+If a system error occurs pass messages through unscanned,
35
+usually when a system error occurs the milter raises a temporary failure which
36
+generally causes the message to remain in the queue.
37
+.TP
38
+\fB-f, \-\-force-scan\fR
39
+Always scan, whereever the address came from.
29 40
 .TP 
30
-\fB\-l, \-\-local\fR
41
+\fB-l, \-\-local\fR
31 42
 Also scan messages sent from LAN.
43
+.TP
44
+\fB-n, \-\-noxheader\fR
45
+Usually clamav\-milter adds a heading to messages that are scanned.
46
+The header is of the form "X-Virus-Scanned: version", this option instructs
47
+clamav\-milter to refrain from adding this heading.
32 48
 .TP 
33
-\fB\-o, \-\-outgoing\fR
49
+\fB-o, \-\-outgoing\fR
34 50
 Scan outgoing messages from this machine.
51
+.TP
52
+\fB-p, \-\-postmaster=EMAILADDRESS\fR
53
+Sets the e-mail address to send notifications to when the \-\-bounce or
54
+\-\-postmaster-only option is given [ Default: postmaster ]
55
+.TP
56
+\fB-P, \-\-postmaster-only\fR
57
+When the \-\-bounce option is given, only send a notification to the postmaster,
58
+not the sender.
59
+.TP
60
+\fB-q, \-\-quiet\fR
61
+Don't send any warning messages when a virus or worm or is detected.
62
+This option overrides the \-\-bounce and \-\-postmaster-only options, and is
63
+the way to turn off notification to the postmaster.
64
+.TP
65
+\fB-Q, \-\-quarantine=EMAILADDRESS\fR
66
+If this e-mail address is given, messages containing a virus or worm are
67
+redirected to it.
68
+.TP
69
+\fB-U, \-\-quarantine-dir=DIR\fR
70
+If this option is given, infected files are left in this directory.
71
+Note - this option only works when using LocalSocket.
35 72
 .TP 
36 73
 \fB\-\-server=ADDRESS, \-s ADDRESS\fR
37 74
 IP address of server running clamd (when using TCPsocket).
75
+.TP
76
+\fB\-\-sign, \-S\fR
77
+Add a hard\-coded signature to each scanned file.
78
+.TP
79
+\fB\-\-signature-file, \-F\fR
80
+Location of file to be appended to each scanned message. Overrides \-S.
38 81
 .TP 
39 82
 \fB\-\-max\-children=n, \-m n\fR
40 83
 Maximum number of children.
41
-.TP 
42
-\fB\-\-dont\-scan\-on\-error, \-d\fR
43
-Pass e\-mails through unscanned if a system error occurs.
44
-.TP 
45
-\fB\-\-force\-scan\fR
46
-Force scan all messages (overrides (\-o and \-l).
47
-.TP 
48
-\fB\-\-noxheader\fR
49
-Suppress X\-Virus\-Scanned header.
50
-.TP 
51
-\fB\-\-postmaster, \-p\fR
52
-Postmaster address (default is "postmaster").
53
-.TP 
54
-\fB\-\-postmaster\-only, \-P\fR
55
-Send warnings only to the postmaster.
56
-.TP 
57
-\fB\-\-quiet, \-q\fR
58
-Don't send e\-mail notifications of interceptions.
84
+There is no default, if this argument is not \fBclamav\-milter\fR will
85
+spawn as many children as is necessary.
59 86
 .SH "EXAMPLES"
60 87
 .LP 
61 88
 clamav\-milter \-\-max\-children=2 \-obl local:/var/run/clmilter.sock
62 89
 .SH "AUTHOR"
63 90
 .LP 
64
-clamav\-milter was written by Nigel Horne <njh@clamav.net>, the manual page was created by Tomasz Kojm <tkojm@clamav.net>.
91
+clamav\-milter was written by Nigel Horne <njh@bandsman.co.uk>, the manual page was created by Tomasz Kojm <zolw@konarski.edu.pl>.
65 92
 .SH "SEE ALSO"
66 93
 .LP 
67 94
 clamd(8), clamscan(1), freshclam(1), sigtool(1), clamav.conf(5)
... ...
@@ -1,5 +1,5 @@
1 1
 .\" Manual page created by Tomasz Kojm, 14/15 IV 2002
2
-.TH "clamscan" "1" "November 11, 2003" "Tomasz Kojm" "Clam AntiVirus"
2
+.TH "clamscan" "1" "January 13, 2004" "Tomasz Kojm" "Clam AntiVirus"
3 3
 .SH "NAME"
4 4
 .LP 
5 5
 clamscan \- scan files and directories against viruses
... ...
@@ -23,10 +23,10 @@ Print the version number and exit.
23 23
 Be verbose.
24 24
 .TP 
25 25
 \fB\-\-debug\fR
26
-This option causes clamscan to print many additional informations.
26
+Enable debug messages (mainly from libclamav).
27 27
 .TP 
28 28
 \fB\-\-quiet\fR
29
-Be quiet \- output only error messages.
29
+Be quiet \- output error messages only.
30 30
 .TP 
31 31
 \fB\-\-stdout\fR
32 32
 Write all messages to the standard output (stdout), instead of the standard error output (stderr). The buffer is automatically flushed (stdout unlike stderr is buffered), to avoid race conditions on output.
... ...
@@ -46,8 +46,11 @@ Create temporary files in DIRECTORY. Directory must be writeable for the 'clamav
46 46
 \fB\-r, \-\-recursive\fR
47 47
 Scan directories recursively. All the files in the given directory will be scanned. \fBThis option affects scanning subdirectories in archives, if you are using unpackers just turn it on.\fR
48 48
 .TP 
49
-\fB\-\-disable\-summary\fR
50
-Disable summary printing at the end of the scanning.
49
+\fB\-\-bell\fR
50
+Sound bell on virus detection.
51
+.TP 
52
+\fB\-\-no\-summary\fR
53
+Disable summary printing at the end of scanning.
51 54
 .TP 
52 55
 \fB\-\-exclude=PATT\fR
53 56
 Don't scan file names containing PATT. It may be used multiple times.
... ...
@@ -69,7 +72,7 @@ Move infected files into DIRECTORY. Directory must be writeable for the 'clamav'
69 69
 .TP 
70 70
 EXTRACTION OPTIONS:
71 71
 .TP 
72
-\fB\-\-disable\-archive\fR
72
+\fB\-\-no\-archive\fR
73 73
 Disable archive support built in libclamav.
74 74
 .TP 
75 75
 \fB\-\-max\-files=#n\fR
... ...
@@ -20,7 +20,7 @@ Example
20 20
 DatabaseMirror database.clamav.net
21 21
 MaxAttempts 3
22 22
 
23
-#Checks 12
23
+#Checks 8
24 24
 
25 25
 #HTTPProxyServer myproxy.com
26 26
 #HTTPProxyPort 1234
... ...
@@ -115,7 +115,7 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
115 115
 	int hostfd, nodb = 0, ret, port = 0;
116 116
 	char  *tempname, ipaddr[16];
117 117
 	const char *proxy = NULL, *user = NULL, *pass = NULL;
118
-
118
+	int flevel = cl_retflevel();
119 119
 
120 120
     if((current = cl_cvdhead(localname)) == NULL)
121 121
 	nodb = 1;
... ...
@@ -169,6 +169,15 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
169 169
     if(current && (current->version >= remote->version)) {
170 170
 	mprintf("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
171 171
 	logg("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
172
+
173
+	if(flevel < current->fl) {
174
+	    /* display warning even for already installed database */
175
+	    mprintf("WARNING: Your ClamAV installation is OUTDATED - please update immediately !\n");
176
+	    mprintf("WARNING: Current functionality level = %d, required = %d\n", flevel, current->fl);
177
+	    logg("WARNING: Your ClamAV installation is OUTDATED - please update immediately !\n");
178
+	    logg("WARNING: Current functionality level = %d, required = %d\n", flevel, current->fl);
179
+	}
180
+
172 181
 	close(hostfd);
173 182
 	cl_cvdfree(current);
174 183
 	cl_cvdfree(remote);
... ...
@@ -234,6 +243,13 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
234 234
     mprintf("%s updated (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
235 235
     logg("%s updated (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
236 236
 
237
+    if(flevel < current->fl) {
238
+	mprintf("WARNING: Your ClamAV installation is OUTDATED - please update immediately !\n");
239
+	mprintf("WARNING: Current functionality level = %d, required = %d\n", flevel, current->fl);
240
+	logg("WARNING: Your ClamAV installation is OUTDATED - please update immediately !\n");
241
+	logg("WARNING: Current functionality level = %d, required = %d\n", flevel, current->fl);
242
+    }
243
+
237 244
     cl_cvdfree(current);
238 245
     free(tempname);
239 246
     return 0;
... ...
@@ -121,6 +121,7 @@ extern int cl_scanfile(const char *filename, char **virname, unsigned long int *
121 121
 extern int cl_loaddb(const char *filename, struct cl_node **root, int *virnum);
122 122
 extern int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum);
123 123
 extern char *cl_retdbdir(void);
124
+extern int cl_retflevel(void);
124 125
 
125 126
 extern struct cl_cvd *cl_cvdhead(const char *file);
126 127
 extern struct cl_cvd *cl_cvdparse(const char *head);
... ...
@@ -38,6 +38,8 @@
38 38
 #include "others.h"
39 39
 #include "md5.h"
40 40
 
41
+#define CL_FLEVEL 1 /* don't touch it */
42
+
41 43
 int cli_debug_flag = 0;
42 44
 
43 45
 void cli_warnmsg(const char *str, ...)
... ...
@@ -79,6 +81,11 @@ void cl_debug(void)
79 79
     cli_debug_flag = 1;
80 80
 }
81 81
 
82
+int cl_retflevel(void)
83
+{
84
+    return CL_FLEVEL;
85
+}
86
+
82 87
 char *cl_strerror(int clerror)
83 88
 {
84 89
     switch(clerror) {
... ...
@@ -102,20 +102,10 @@ _zzip_inline static void __fixup_rootseek(
102 102
  * anything in zziplib or dump the trailer structure then watch out that
103 103
  * these are still unused, so that this code may still (ab)use those. */
104 104
 #define __fixup_rootseek(_offset_of_trailer, _trailer)          \
105
-		_trailer->z_magic[0] = _offset_of_trailer & 0xff; \
106
-		_trailer->z_magic[1] = _offset_of_trailer >> 8 & 0xff ; \
107
-		_trailer->z_magic[2] = _offset_of_trailer >> 16 & 0xff ; \
108
-		_trailer->z_magic[3] = _offset_of_trailer >> 24 & 0xff ; \
109
-		_trailer->z_disk[0] = 0 ; \
110
-		_trailer->z_disk[1] = 0 ; \
111
-		_trailer->z_finaldisk[0] = 0 ; \
112
-		_trailer->z_finaldisk[1] = 0 ;
113
-#define __trailer_to_address(_trailer) \
114
-	(_trailer->z_magic[0] + (_trailer->z_magic[1] << 8) + \
115
-	(_trailer->z_magic[2] << 16) + (_trailer->z_magic[3] << 25))
105
+                      *(zzip_off_t*)_trailer = _offset_of_trailer;
116 106
 #define __correct_rootseek( _u_rootseek, _u_rootsize, _trailer) \
117
-    if (_u_rootseek > __trailer_to_address(_trailer) - _u_rootsize)     \
118
-	_u_rootseek = __trailer_to_address(_trailer) - _u_rootsize;
107
+    if (_u_rootseek > *(zzip_off_t*)_trailer - _u_rootsize)     \
108
+	_u_rootseek = *(zzip_off_t*)_trailer - _u_rootsize;
119 109
 #else
120 110
 #define __fixup_rootseek(A,B) 
121 111
 #define __correct_rootseek(A,B,C)