Browse code

merge backport fixes for 0.86rc1

git-svn-id: file:///var/lib/svn/clamav-devel/branches/0.88-stable@2781 77e5149b-7576-45b1-b177-96237e5ba77b

Sven Strickroth authored on 2007/02/18 23:26:16
Showing 33 changed files
... ...
@@ -1,5 +1,4 @@
1 1
 Tomasz Kojm <tkojm*clamav.net>
2
-home page : http://www.mat.uni.torun.pl/~tk/
3 2
 gpg key   : http://www.clamav.net/gpg/tkojm.gpg
4 3
 GPG fingerprint = 0DCA 5A08 407D 5288 279D  B434 5482 2DC8 985A 444B
5 4
 Project leader.
... ...
@@ -1,3 +1,32 @@
1
+Mon Jun 13 23:21:00 CEST 2005
2
+-----------------------------
3
+  V 0.86rc1
4
+  * Fixes backported from CVS:
5
+    - libclamav/cvd.c: fix potential directory traversal in cvd unpacker (a low
6
+      risk problem since all databases are digitally signed). Pointed out by
7
+      Florian Weimer <fw*deneb.enyo.de> (tk)
8
+    - libclamav/zziplib/zzip-file.c: add method id for AES encrypted archives
9
+      (thanks to David Majorel <dm*lagoon.nc>) (tk)
10
+    - clamscan/manager.c: better message on zip/rar unpacking error (tk)
11
+    - libclamav/mbox.c: Fix mishandling of fast track uuencoded files (njh)
12
+    - clamav-milter: Better error message if the white-list file can't be
13
+      opened (njh)
14
+    - clamav-milter: When loading a new database when not in external mode,
15
+      keep scanning with the old one rather than hold up incoming mails while
16
+      waiting for clamav-milter to become idle then reloading the database (njh)
17
+    - libclamav/others.c: print warnings and errors in single call to write
18
+      (thanks to Denis Vlasenko <vda*ilport.com.ua>) (tk)
19
+    - clamscan/others.c: enable REG_EXTENDED in match_regex (tk)
20
+    - libclamav/scanners.c: fix file descriptor leaks if cli_msexpand() returns
21
+      an error in cli_scanszdd, patch by Mark Pizzolato (tk)
22
+    - libclamav/scanners.c: fix file descriptor leak in error path (out of mem)
23
+      in cli_scangzip(), patch by Mark Pizzolato (tk)
24
+    - clamd/scanner.c: fix error path for a read timeout which logged messages
25
+      indicating that both a timeout and a poll error occurred (patch by Mark
26
+      Pizzolato <clamav-devel*subscriptions.pizzolato.net>) (tk)
27
+    - libclamav:  Extract TNEF files even when the filename isn't known,
28
+      problem reported by John Miller (contact*glideslopesoftware.co.uk) (njh)
29
+
1 30
 Mon May 16 23:22:55 CEST 2005
2 31
 -----------------------------
3 32
   V 0.85.1
... ...
@@ -170,7 +170,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
170 170
 PACKAGE_VERSION = @PACKAGE_VERSION@
171 171
 PATH_SEPARATOR = @PATH_SEPARATOR@
172 172
 RANLIB = @RANLIB@
173
-SENDMAIL = @SENDMAIL@
174 173
 SET_MAKE = @SET_MAKE@
175 174
 SHELL = @SHELL@
176 175
 STRIP = @STRIP@
... ...
@@ -211,6 +210,7 @@ oldincludedir = @oldincludedir@
211 211
 prefix = @prefix@
212 212
 program_transform_name = @program_transform_name@
213 213
 sbindir = @sbindir@
214
+sendmailprog = @sendmailprog@
214 215
 sharedstatedir = @sharedstatedir@
215 216
 sysconfdir = @sysconfdir@
216 217
 target = @target@
... ...
@@ -1,9 +1,10 @@
1
-0.85.1
1
+0.86rc1
2
+-------
2 3
 
3
-A problem where an email with more than one content-disposition type line,
4
-one or more of which was empty, could crash libclamav has been fixed. Other
5
-minor bugfixes have been made.
4
+This release candidate introduces a number of bugfixes and cleanups.
5
+Possible descriptor leaks in archive unpackers and mishandling of fast track
6
+uuencoded files have been fixed in libclamav. Database reloading in
7
+clamav-milter has been improved.
6 8
 
7 9
 --
8 10
 The ClamAV team (http://www.clamav.net/team.html)
... ...
@@ -2,6 +2,17 @@ Note: This README/NEWS file refers to the source tarball. Some things described
2 2
 here may not be available in binary packages.
3 3
 --
4 4
 
5
+0.86rc1
6
+-------
7
+
8
+This release candidate introduces a number of bugfixes and cleanups.
9
+Possible descriptor leaks in archive unpackers and mishandling of fast track
10
+uuencoded files have been fixed in libclamav. Database reloading in
11
+clamav-milter has been improved.
12
+
13
+--
14
+The ClamAV team (http://www.clamav.net/team.html)
15
+
5 16
 0.85.1
6 17
 ------
7 18
 
... ...
@@ -285,6 +285,18 @@
285 285
 /* scan buffer size */
286 286
 #undef SCANBUFF
287 287
 
288
+/* location of Sendmail binary */
289
+#undef SENDMAIL_BIN
290
+
291
+/* major version of Sendmail */
292
+#undef SENDMAIL_VERSION_A
293
+
294
+/* minor version of Sendmail */
295
+#undef SENDMAIL_VERSION_B
296
+
297
+/* subversion of Sendmail */
298
+#undef SENDMAIL_VERSION_C
299
+
288 300
 /* Define to 1 if the `setpgrp' function takes no argument. */
289 301
 #undef SETPGRP_VOID
290 302
 
... ...
@@ -68,7 +68,7 @@ recompiles above)
68 68
 
69 69
 Solaris 9 and FreeBSD5 have milter support in the supplied sendmail, but
70 70
 doesn't include libmilter so you can't develop milter applications on it.
71
-Go to sendmail.org, download the lastest sendmail, cd to libmilter and
71
+Go to sendmail.org, download the latest sendmail, cd to libmilter and
72 72
 "make install" there.
73 73
 
74 74
 Needs -lresolv on Solaris
... ...
@@ -99,7 +99,12 @@ Installations for RedHat Linux and it's derivatives such as YellowDog:
99 99
 	define(`confINPUT_MAIL_FILTERS', `clamav')
100 100
 
101 101
 	Note that the INPUT_MAIL_FILTER line must come before the
102
-		confINPUT_MAIL_FILTERS line
102
+		confINPUT_MAIL_FILTERS line.
103
+
104
+	Don't worry that the file /var/run/clamav/clmilter.sock doesn't exist,
105
+		clamav-milter will create it for you. However you will need
106
+		to create the directory /var/run/clamav (usually owned
107
+		by user clamav, mode 700).
103 108
 
104 109
 	Check entry in /usr/local/etc/clamd.conf of the form:
105 110
 	LocalSocket /var/run/clamav/clamd.sock
... ...
@@ -183,7 +188,7 @@ You should have received a script to install into /etc/init.d as
183 183
 	/etc/init.d/clamav-milter start
184 184
 	/etc/init.d/sendmail restart
185 185
 
186
-2.6 General Instalation Issues
186
+2.6 General Installation Issues
187 187
 
188 188
 You may find INPUT_MAIL_FILTERS is not needed on your machine, however it
189 189
 is recommended by the Sendmail documentation and I recommend going along
... ...
@@ -210,7 +215,7 @@ or if clamd is on a different machine
210 210
 If you want clamav-milter to listen on TCP for communication with sendmail,
211 211
 for example if they are on different machines use inet:<port>.
212 212
 On machine A (running sendmail) you would have in sendmail.mc:
213
-	INPUT_MAIL_FILTER(`clamav', `S=inet:3311@machineb, F=, T=S:4m;R:4m')dnl
213
+	INPUT_MAIL_FILTER(`clamav', `S=inet:3311@machineb, F=T, T=S:4m;R:4m')dnl
214 214
 On machine B (running clamav-milter) you would start up clamav-milter thus:
215 215
 	clamav-milter inet:3311
216 216
 
... ...
@@ -221,8 +226,31 @@ You should always start clamd before clamav-milter.
221 221
 You may also think about the F= entry in sendmail.mc, since it tells sendmail
222 222
 what to do with emails if clamav-milter is not running. Setting F=T will tell
223 223
 the remote end to resend later (temporary failure), setting F=R will reject
224
-the email and setting F= will pass the email through, in this case you should
225
-warn your users that emails are not being scanned.
224
+the email (permanent failure) and setting F= will pass the email through as
225
+though clamav-milter were not installed, in this case you should warn your
226
+users that emails are not being scanned. We recommend setting F=T.
227
+
228
+You may wish to experiment with the T= entry which governs timeout options. You
229
+MUST set some type of timeout or a malicious client could cause a Denial of
230
+Service attack by keeping your clamav-milter threads alive. The types of
231
+timeout are C (time for clamav-milter to acknowledge to sendmail that it
232
+has accepted a new connection), S (timeout for sending information from sendmail
233
+to clamav-milter), R (timeout for sendmail reading a reply from clamav-milter
234
+when it has been sent some information) and E (timeout for clamav-milter to
235
+handle the end-of-message request, this needs to be high enough to scan the
236
+largest file that you will receive since it is at this stage that the file is
237
+scanned, but short enough to ensure that a DoS can't occur when lots of scans
238
+are requested). The important entries for clamav-milter are C and E (both
239
+default to 5 minutes).
240
+
241
+WARNING: When running on internal mode (--external is NOT used), clamav-milter
242
+will need to wait for all connections to stop before it can reload the database
243
+after running freshclam. It is therefore important that NO timeouts in
244
+sendmail.cf are set too high or worse still turned off, otherwise clamav-milter
245
+can wait a long time, perhaps indefinately, while waiting for the system to
246
+quieten down. The same goes for disabling StreamMaxLength, since receiving a
247
+very large email to be scanned may take a long time. We advise setting
248
+StreamMaxLength to 1M.
226 249
 
227 250
 Don't forget to rebuild sendmail.cf after modifying sendmail.mc. You will
228 251
 need to restart sendmail after rebuilding sendmail.cf and starting clamd and
... ...
@@ -231,7 +259,7 @@ clamav-milter.
231 231
 As with all software it is wise to ensure that clamav-milter has the least
232 232
 privileges it needs to run. So don't run it as root and don't store the sockets
233 233
 in a directory that can be written by everyone. For example ensure that /var/run
234
-is owned and writable only by root and add entries for 'User' and
234
+is owned and writeable only by root and add entries for 'User' and
235 235
 'FixStaleSocket' in clamd.conf.
236 236
 
237 237
 When using UNIX domain sockets via the LocalSocket option of clamd.conf,
... ...
@@ -247,6 +275,12 @@ able to call sendmail, for example on a Fedora Linux system:
247 247
 To test that your clamAV system is now intercepting viruses, visit
248 248
 http://www.testvirus.org
249 249
 
250
+If, under heavy strain on Linux, you see the message
251
+	thread_create() failed: 12, abort
252
+appearing in a log file, you will need to increase the number of threads on
253
+your system (/proc/sys/kernel/threads-max), or decrease the value of
254
+--max-children.
255
+
250 256
 3. CHANGE HISTORY
251 257
 
252 258
 Changes
... ...
@@ -692,7 +726,7 @@ Changes
692 692
 0.81	19/1/05:	Up issued
693 693
 0.81a	22/1/05:	If forwarding to a quarantine user fails log as LOG_ERR
694 694
 				not LOG_DEBUG
695
-			Try to santity check that the input socket name is the
695
+			Try to sanity check that the input socket name is the
696 696
 				same as the same given to sendmail
697 697
 			Redirect stdout and stderr to LogFile, if that is set
698 698
 			--quarantine didn't redirect to the given email address
... ...
@@ -767,6 +801,27 @@ Changes
767 767
 				dont-wait isn't set
768 768
 0.84g	9/5/05:		Print an error in the log if a segfault is received
769 769
 0.85	11/5/05:	Up-issue
770
+0.85a	12/5/05:	Open /dev/console before dropping privilege, reported
771
+				by David Crow <crow@orangeblood.org>
772
+0.85b	19/5/05:	Warn if TCPAddr doesn't allow connection from us
773
+			Warn if notification email fails
774
+			Enable some sendmail debug if LogVerbose is set
775
+			Added sanity checks that the socket can be created
776
+0.85c	24/5/05:	Use the program name from argv[0], based on an
777
+				idea by Joe Maimon <jmaimon@ttec.com>
778
+			When dying use LOG_CRIT rather than LOG_ERR
779
+0.85d	25/5/05:	When not in external mode, TEMPFAIL when loading a new
780
+				database, even when --dont-wait isn't given
781
+0.85e	27/5/05:	When loading a new database when not in external mode,
782
+				keep scanning with the old one rather than
783
+				hold up incoming mails while waiting for
784
+				clamav-milter to become idle then reloading the
785
+				database
786
+Backported from CVS:	When checking if an email address is in the white-list,
787
+				check if it is the quarantine email address
788
+				before checking against the white-list file
789
+			When starting, check that the white-list file can be
790
+				opened
770 791
 
771 792
 4. INTERNATIONALISATION
772 793
 
... ...
@@ -1,5 +1,5 @@
1 1
 #
2
-#  Copyright (C) 2003 - 2004 Tomasz Kojm <tkojm@clamav.net>
2
+#  Copyright (C) 2003 - 2005 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
... ...
@@ -37,7 +37,6 @@ man_MANS = $(top_srcdir)/docs/man/clamav-milter.8
37 37
 endif
38 38
 endif
39 39
 
40
-AM_CFLAGS = -DSENDMAIL_BIN=\"$(SENDMAIL)\"
41 40
 LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMAV_MILTER_LIBS@
42 41
 INCLUDES = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared
43 42
 EXTRA_DIST = clamav-milter.c INSTALL
... ...
@@ -15,7 +15,7 @@
15 15
 @SET_MAKE@
16 16
 
17 17
 #
18
-#  Copyright (C) 2003 - 2004 Tomasz Kojm <tkojm@clamav.net>
18
+#  Copyright (C) 2003 - 2005 Tomasz Kojm <tkojm@clamav.net>
19 19
 #
20 20
 #  This program is free software; you can redistribute it and/or modify
21 21
 #  it under the terms of the GNU General Public License as published by
... ...
@@ -163,7 +163,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
163 163
 PACKAGE_VERSION = @PACKAGE_VERSION@
164 164
 PATH_SEPARATOR = @PATH_SEPARATOR@
165 165
 RANLIB = @RANLIB@
166
-SENDMAIL = @SENDMAIL@
167 166
 SET_MAKE = @SET_MAKE@
168 167
 SHELL = @SHELL@
169 168
 STRIP = @STRIP@
... ...
@@ -204,6 +203,7 @@ oldincludedir = @oldincludedir@
204 204
 prefix = @prefix@
205 205
 program_transform_name = @program_transform_name@
206 206
 sbindir = @sbindir@
207
+sendmailprog = @sendmailprog@
207 208
 sharedstatedir = @sharedstatedir@
208 209
 sysconfdir = @sysconfdir@
209 210
 target = @target@
... ...
@@ -223,7 +223,6 @@ target_vendor = @target_vendor@
223 223
 @BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@    clamav-milter.c
224 224
 
225 225
 @BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@man_MANS = $(top_srcdir)/docs/man/clamav-milter.8
226
-AM_CFLAGS = -DSENDMAIL_BIN=\"$(SENDMAIL)\"
227 226
 INCLUDES = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared
228 227
 EXTRA_DIST = clamav-milter.c INSTALL
229 228
 all: all-am
... ...
@@ -22,9 +22,9 @@
22 22
  *
23 23
  * For installation instructions see the file INSTALL that came with this file
24 24
  */
25
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.200 2005/05/12 07:31:09 nigelhorne Exp $";
25
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.208 2005/05/28 11:37:27 nigelhorne Exp $";
26 26
 
27
-#define	CM_VERSION	"0.85"
27
+#define	CM_VERSION	"0.86rc1"
28 28
 
29 29
 #if HAVE_CONFIG_H
30 30
 #include "clamav-config.h"
... ...
@@ -105,7 +105,6 @@ int	deny_severity = LOG_NOTICE;
105 105
 
106 106
 #ifndef	CL_DEBUG
107 107
 static	const	char	*logFile;
108
-static	int	logTime;
109 108
 static	char	console[] = "/dev/console";
110 109
 #endif
111 110
 
... ...
@@ -149,7 +148,6 @@ typedef	unsigned int	in_addr_t;
149 149
  *	to get messages on the system console, see syslog.conf(5), also you
150 150
  *	can use wall(1) in the VirusEvent entry in clamd.conf
151 151
  * TODO: build with libclamav.so rather than libclamav.a
152
- * TODO: Warn if TCPAddr doesn't allow connection from us
153 152
  * TODO: Decide action (bounce, discard, reject etc.) based on the virus
154 153
  *	found. Those with faked addresses, such as SCO.A want discarding,
155 154
  *	others could be bounced properly.
... ...
@@ -158,6 +156,8 @@ typedef	unsigned int	in_addr_t;
158 158
  * TODO: Files can be scanned with "SCAN" not "STREAM" if clamd is on the same
159 159
  *	machine when talking via INET domain socket.
160 160
  * TODO: Load balancing, allow local machine to talk via UNIX domain socket.
161
+ * TODO: allow each line in the whitelist file to specify a quarantine email
162
+ *	address
161 163
  */
162 164
 
163 165
 struct header_node_t {
... ...
@@ -281,9 +281,11 @@ static	char	clamav_version[VERSION_LENGTH + 1];
281 281
 static	int	fflag = 0;	/* force a scan, whatever */
282 282
 static	int	oflag = 0;	/* scan messages from our machine? */
283 283
 static	int	lflag = 0;	/* scan messages from our site? */
284
+static	const	char	*progname;	/* our name - usually clamav-milter */
284 285
 
285 286
 /* Variables for --external */
286 287
 static	int	external = 0;	/* scan messages ourself or use clamd? */
288
+static	pthread_mutex_t	root_mutex = PTHREAD_MUTEX_INITIALIZER;
287 289
 static	struct	cl_node	*root = NULL;
288 290
 static	struct	cl_limits	limits;
289 291
 static	struct	cl_stat	dbstat;
... ...
@@ -370,9 +372,6 @@ static	pthread_mutex_t	n_children_mutex = PTHREAD_MUTEX_INITIALIZER;
370 370
 static	pthread_cond_t	n_children_cond = PTHREAD_COND_INITIALIZER;
371 371
 static	volatile	unsigned	int	n_children = 0;
372 372
 static	unsigned	int	max_children = 0;
373
-static	pthread_mutex_t	accept_mutex = PTHREAD_MUTEX_INITIALIZER;
374
-static	pthread_cond_t	accept_cond = PTHREAD_COND_INITIALIZER;
375
-static	volatile	int	accept_inputs;
376 373
 static	int	child_timeout = 0;	/* number of seconds to wait for
377 374
 					 * a child to die. Set to 0 to
378 375
 					 * wait forever
... ...
@@ -457,6 +456,9 @@ static	int	verifyIncomingSocketName(const char *sockName);
457 457
 static	int	isWhitelisted(const char *emailaddress);
458 458
 static	void	logger(const char *mess);
459 459
 
460
+short	logg_time, logg_lock, logok;
461
+int	logg_size;
462
+
460 463
 static void
461 464
 help(void)
462 465
 {
... ...
@@ -550,10 +552,16 @@ main(int argc, char **argv)
550 550
 		"ClamAV version %s, clamav-milter version %s",
551 551
 		VERSION, CM_VERSION);
552 552
 
553
+	progname = strrchr(argv[0], '/');
554
+	if(progname)
555
+		progname++;
556
+	else
557
+		progname = "clamav-milter";
558
+
553 559
 #ifdef	C_LINUX
554 560
 	setlocale(LC_ALL, "");
555
-	bindtextdomain("clamav-milter", DATADIR"/clamav-milter/locale");
556
-	textdomain("clamav-milter");
561
+	bindtextdomain(progname, DATADIR"/clamav-milter/locale");
562
+	textdomain(progname);
557 563
 #endif
558 564
 
559 565
 	for(;;) {
... ...
@@ -945,7 +953,7 @@ main(int argc, char **argv)
945 945
 				cli_dbgmsg(_("Running as user %s (UID %d, GID %d)\n"),
946 946
 					cpt->strarg, user->pw_uid, user->pw_gid);
947 947
 		} else
948
-			fprintf(stderr, _("%s: running as root is not recommended (check \"User\" in clamd.conf)\n"), argv[0]);
948
+			fprintf(stderr, _("%s: running as root is not recommended (check \"User\" in %s)\n"), argv[0], cfgfile);
949 949
 	} else if(iface) {
950 950
 		fprintf(stderr, _("%s: Only root can set an interface for --broadcast\n"), argv[0]);
951 951
 		return EX_USAGE;
... ...
@@ -1009,6 +1017,11 @@ main(int argc, char **argv)
1009 1009
 		return EX_CONFIG;
1010 1010
 	}
1011 1011
 
1012
+	if(whitelistFile && (access(whitelistFile, R_OK) < 0)) {  
1013
+	    perror(templatefile);	
1014
+	    return EX_CONFIG;	
1015
+	}
1016
+
1012 1017
 	/*
1013 1018
 	 * patch from "Richard G. Roberto" <rgr@dedlegend.com>
1014 1019
 	 * If the --max-children flag isn't set, see if MaxThreads
... ...
@@ -1041,8 +1054,7 @@ main(int argc, char **argv)
1041 1041
 
1042 1042
 		if(cfgopt(copt, "LogVerbose")) {
1043 1043
 			logVerbose = 1;
1044
-#if	0
1045
-			/* Only supported by Sendmail >= V8.13 */
1044
+#if	((SENDMAIL_VERSION_A > 8) || ((SENDMAIL_VERSION_A == 8) && (SENDMAIL_VERSION_B >= 13)))
1046 1045
 			smfi_setdbg(6);
1047 1046
 #endif
1048 1047
 		}
... ...
@@ -1054,7 +1066,7 @@ main(int argc, char **argv)
1054 1054
 					argv[0], cpt->strarg);
1055 1055
 				return EX_CONFIG;
1056 1056
 			}
1057
-		openlog("clamav-milter", LOG_CONS|LOG_PID, fac);
1057
+		openlog(progname, LOG_CONS|LOG_PID, fac);
1058 1058
 	} else {
1059 1059
 		if(qflag)
1060 1060
 			fprintf(stderr, _("%s: (-q && !LogSyslog): warning - all interception message methods are off\n"),
... ...
@@ -1230,6 +1242,11 @@ main(int argc, char **argv)
1230 1230
 			else {
1231 1231
 				cli_warnmsg(_("Can't talk to clamd server %s on port %d\n"),
1232 1232
 					hostname, tcpSocket);
1233
+				if(serverIPs[i] == (int)inet_addr("127.0.0.1")) {
1234
+					if(cfgopt(copt, "TCPAddr") != NULL)
1235
+						cli_warnmsg(_("Check the value for TCPAddr in %s\n"), cfgfile);
1236
+				} else
1237
+					cli_warnmsg(_("Check the value for TCPAddr in clamd.conf on %s\n"), hostname);
1233 1238
 			}
1234 1239
 #endif
1235 1240
 
... ...
@@ -1357,8 +1374,18 @@ main(int argc, char **argv)
1357 1357
 				return EX_CONFIG;
1358 1358
 			}
1359 1359
 			if(open(logFile, O_WRONLY|O_APPEND) < 0) {
1360
-				perror(logFile);
1361
-				return EX_CANTCREAT;
1360
+				if(errno == ENOENT) {
1361
+					/*
1362
+					 * There is low risk race condition here
1363
+					 */
1364
+					if(open(logFile, O_WRONLY|O_CREAT, 0644) < 0) {
1365
+						perror(logFile);
1366
+						return EX_CANTCREAT;
1367
+					}
1368
+				} else {
1369
+					perror(logFile);
1370
+					return EX_CANTCREAT;
1371
+				}
1362 1372
 			}
1363 1373
 		} else {
1364 1374
 			logFile = console;
... ...
@@ -1373,10 +1400,20 @@ main(int argc, char **argv)
1373 1373
 		if(consolefd >= 0)
1374 1374
 			close(consolefd);
1375 1375
 
1376
-		if(cfgopt(copt, "LogTime"))
1377
-			logTime++;
1378 1376
 #endif	/*!CL_DEBUG*/
1379 1377
 
1378
+		if(cfgopt(copt, "LogTime"))
1379
+			logg_time = 1;
1380
+		if(cfgopt(copt, "LogFileUnlock"))
1381
+			logg_lock = 0;
1382
+		if(cfgopt(copt, "LogClean"))
1383
+			logok = 1;
1384
+		if((cpt = cfgopt(copt, "LogFileMaxSize")))
1385
+			logg_size = cpt->numarg;
1386
+		else
1387
+			logg_size = CL_DEFAULT_LOGSIZE;
1388
+
1389
+
1380 1390
 #ifdef HAVE_SETPGRP
1381 1391
 #ifdef SETPGRP_VOID
1382 1392
 		setpgrp();
... ...
@@ -1449,7 +1486,6 @@ main(int argc, char **argv)
1449 1449
 				limits.archivememlim = 0;
1450 1450
 		}
1451 1451
 	}
1452
-	accept_inputs = 1;
1453 1452
 
1454 1453
 #ifdef	SESSION
1455 1454
 	/* FIXME: add localSocket support to watchdog */
... ...
@@ -1537,10 +1573,9 @@ main(int argc, char **argv)
1537 1537
 		return EX_UNAVAILABLE;
1538 1538
 	}
1539 1539
 
1540
-#if	0
1541
-	/* Only supported by Sendmail >= V8.13 */
1540
+#if	((SENDMAIL_VERSION_A > 8) || ((SENDMAIL_VERSION_A == 8) && (SENDMAIL_VERSION_B >= 13)))
1542 1541
 	if(smfi_opensocket(1) == MI_FAILURE) {
1543
-		cli_errmsg("can't open/create %s\n", port);
1542
+		cli_errmsg("Can't open/create %s\n", port);
1544 1543
 		return EX_CONFIG;
1545 1544
 	}
1546 1545
 #endif
... ...
@@ -1954,34 +1989,10 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1954 1954
 	char ip[INET_ADDRSTRLEN];	/* IPv4 only */
1955 1955
 #endif
1956 1956
 	const char *remoteIP;
1957
-	int accepting;
1958 1957
 
1959 1958
 	if(quitting)
1960 1959
 		return cl_error;
1961 1960
 
1962
-	pthread_mutex_lock(&accept_mutex);
1963
-	accepting = accept_inputs;
1964
-	pthread_mutex_unlock(&accept_mutex);
1965
-	if(!accepting) {
1966
-#if	1
1967
-		cli_warnmsg("Not accepting inputs at the moment\n");
1968
-		/*
1969
-		 * We must refuse here even if dont_wait isn't set, since
1970
-		 * it could take some time, and sendmail could time us out
1971
-		 * and refuse to have anything more to do with us until
1972
-		 * the program is restarted
1973
-		 */
1974
-		if(dont_wait)
1975
-			return SMFIS_TEMPFAIL;
1976
-		pthread_mutex_lock(&accept_mutex);
1977
-		while(!accept_inputs)
1978
-			pthread_cond_wait(&accept_cond, &accept_mutex);
1979
-		pthread_mutex_unlock(&accept_mutex);
1980
-		cli_warnmsg("Accepting inputs again\n");
1981
-#endif
1982
-		/*return SMFIS_TEMPFAIL;*/
1983
-	}
1984
-
1985 1961
 	if(ctx == NULL) {
1986 1962
 		if(use_syslog)
1987 1963
 			syslog(LOG_ERR, _("clamfi_connect: ctx is null"));
... ...
@@ -2087,7 +2098,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
2087 2087
 		 * hosts_access(3)
2088 2088
 		 */
2089 2089
 		pthread_mutex_lock(&wrap_mutex);
2090
-		if(!hosts_ctl("clamav-milter", hostent.h_name, ip, STRING_UNKNOWN)) {
2090
+		if(!hosts_ctl(progname, hostent.h_name, ip, STRING_UNKNOWN)) {
2091 2091
 			pthread_mutex_unlock(&wrap_mutex);
2092 2092
 			if(use_syslog)
2093 2093
 				syslog(LOG_WARNING, _("Access Denied for %s[%s]"), hostent.h_name, ip);
... ...
@@ -2567,12 +2578,21 @@ clamfi_eom(SMFICTX *ctx)
2567 2567
 	if(!external) {
2568 2568
 		const char *virname;
2569 2569
 		unsigned long int scanned = 0L;
2570
+		struct cl_node *scanning_root;
2570 2571
 
2571 2572
 		/*
2572 2573
 		 * TODO: consider using cl_scandesc and not using a temporary
2573 2574
 		 *	file from the mail being read in
2574 2575
 		 */
2575
-		switch(cl_scanfile(privdata->filename, &virname, &scanned, root, &limits, options)) {
2576
+		pthread_mutex_lock(&root_mutex);
2577
+		scanning_root = cl_dup(root);
2578
+		pthread_mutex_unlock(&root_mutex);
2579
+		if(scanning_root == NULL) {
2580
+			cli_errmsg("scanning_root == NULL\n");
2581
+			clamfi_cleanup(ctx);
2582
+			return cl_error;
2583
+		}
2584
+		switch(cl_scanfile(privdata->filename, &virname, &scanned, scanning_root, &limits, options)) {
2576 2585
 			case CL_CLEAN:
2577 2586
 				strcpy(mess, "OK");
2578 2587
 				break;
... ...
@@ -2585,6 +2605,7 @@ clamfi_eom(SMFICTX *ctx)
2585 2585
 				logger(mess);
2586 2586
 				break;
2587 2587
 		}
2588
+		cl_free(scanning_root);
2588 2589
 
2589 2590
 #ifdef	SESSION
2590 2591
 		session = NULL;
... ...
@@ -2986,7 +3007,9 @@ clamfi_eom(SMFICTX *ctx)
2986 2986
 				}
2987 2987
 
2988 2988
 				cli_dbgmsg("Waiting for %s to finish\n", cmd);
2989
-				pclose(sendmail);
2989
+				if(pclose(sendmail) != 0)
2990
+					if(use_syslog)
2991
+						syslog(LOG_ERR, "%s: Failed to notify clamAV interception - see dead.letter", sendmailId);
2990 2992
 			} else if(use_syslog)
2991 2993
 				syslog(LOG_WARNING, _("Can't execute '%s' to send virus notice"), cmd);
2992 2994
 		}
... ...
@@ -3275,7 +3298,7 @@ clamfi_free(struct privdata *privdata)
3275 3275
 		 */
3276 3276
 		if(n_children > 0)
3277 3277
 			if(--n_children == 0) {
3278
-				cli_dbgmsg("clamav-milter is idle\n");
3278
+				cli_dbgmsg("%s is idle\n", progname);
3279 3279
 				if(pthread_cond_broadcast(&watchdog_cond) < 0)
3280 3280
 					perror("pthread_cond_broadcast");
3281 3281
 			}
... ...
@@ -4387,69 +4410,29 @@ watchdog(void *a)
4387 4387
 		pthread_mutex_unlock(&watchdog_mutex);
4388 4388
 
4389 4389
 		if(!external) {
4390
-			int dbstatus = cl_statchkdir(&dbstat);
4391
-
4392 4390
 			/*
4393
-			 * Re-load the database if the server's not busy.
4394
-			 * TODO: If a reload is needed go into a mode when
4395
-			 *	new scans aren't accepted, to force the number
4396
-			 *	of children to 0 so that we can reload,
4397
-			 *	otherwise a reload may not occur on overloaded
4398
-			 *	servers
4391
+			 * Re-load the database if needed
4399 4392
 			 */
4400
-			pthread_mutex_lock(&n_children_mutex);
4401
-			if((n_children == 0) && (dbstatus == 1)) {
4402
-				pthread_mutex_lock(&accept_mutex);
4403
-				accept_inputs = 0;
4404
-				pthread_mutex_unlock(&accept_mutex);
4405
-				cli_dbgmsg("Database has changed\n");
4406
-				cl_statfree(&dbstat);
4407
-				/* check for race condition */
4408
-				while(n_children > 0)
4409
-					pthread_cond_wait(&n_children_cond, &n_children_mutex);
4410
-				if(use_syslog)
4411
-					syslog(LOG_WARNING, _("Loading new database"));
4412
-				if(loadDatabase() != 0) {
4413
-					pthread_mutex_unlock(&n_children_mutex);
4414
-					smfi_stop();
4415
-					return NULL;
4416
-				}
4417
-				pthread_mutex_lock(&accept_mutex);
4418
-				accept_inputs = 1;
4419
-				pthread_cond_broadcast(&accept_cond);
4420
-				pthread_mutex_unlock(&accept_mutex);
4421
-			} else if(dbstatus == 0)
4422
-				cli_dbgmsg("Database has not changed\n");
4423
-			else if(dbstatus == 1) {
4424
-				cli_warnmsg("Not reloading database until idle - waiting for %d children\n", n_children);
4425
-				pthread_mutex_lock(&accept_mutex);
4426
-				accept_inputs = 0;
4427
-				pthread_mutex_unlock(&accept_mutex);
4428
-
4429
-				while(n_children > 0) {
4430
-					pthread_cond_wait(&n_children_cond, &n_children_mutex);
4431
-					cli_warnmsg("Waiting for %d children until databae reload\n", n_children);
4432
-				}
4433
-
4434
-				cl_statfree(&dbstat);
4435
-				if(use_syslog)
4436
-					syslog(LOG_WARNING, _("Loading new database"));
4437
-				if(loadDatabase() != 0) {
4438
-					pthread_mutex_unlock(&n_children_mutex);
4393
+			switch(cl_statchkdir(&dbstat)) {
4394
+				case 1:
4395
+					cli_dbgmsg("Database has changed\n");
4396
+					cl_statfree(&dbstat);
4397
+					if(use_syslog)
4398
+						syslog(LOG_WARNING, _("Loading new database"));
4399
+					if(loadDatabase() != 0) {
4400
+						smfi_stop();
4401
+						cli_errmsg("Failed to load updated database\n");
4402
+						return NULL;
4403
+					}
4404
+					break;
4405
+				case 0:
4406
+					cli_dbgmsg("Database has not changed\n");
4407
+					break;
4408
+				default:
4439 4409
 					smfi_stop();
4410
+					cli_errmsg("Database error - %s is stopping\n", progname);
4440 4411
 					return NULL;
4441
-				}
4442
-				pthread_mutex_lock(&accept_mutex);
4443
-				accept_inputs = 1;
4444
-				pthread_cond_broadcast(&accept_cond);
4445
-				pthread_mutex_unlock(&accept_mutex);
4446
-			} else {
4447
-				smfi_stop();
4448
-				cli_errmsg("Database error - clamav-milter is stopping\n");
4449
-				pthread_mutex_unlock(&n_children_mutex);
4450
-				return NULL;
4451 4412
 			}
4452
-			pthread_mutex_unlock(&n_children_mutex);
4453 4413
 			continue;
4454 4414
 		}
4455 4415
 		i = 0;
... ...
@@ -4556,7 +4539,6 @@ watchdog(void *a)
4556 4556
 	while(!quitting) {
4557 4557
 		struct timespec ts;
4558 4558
 		struct timeval tp;
4559
-		int dbstatus;
4560 4559
 
4561 4560
 		gettimeofday(&tp, NULL);
4562 4561
 
... ...
@@ -4580,67 +4562,29 @@ watchdog(void *a)
4580 4580
 		pthread_mutex_unlock(&watchdog_mutex);
4581 4581
 
4582 4582
 		/*
4583
-		 * Re-load the database if the server's not busy.
4584
-		 * TODO: If a reload is needed go into a mode when
4585
-		 *	new scans aren't accepted, to force the number
4586
-		 *	of children to 0 so that we can reload,
4587
-		 *	otherwise a reload may not occur on overloaded
4588
-		 *	servers
4583
+		 * Re-load the database.
4589 4584
 		 */
4590
-		dbstatus = cl_statchkdir(&dbstat);
4591
-		pthread_mutex_lock(&n_children_mutex);
4592
-		if((n_children == 0) && (dbstatus == 1)) {
4593
-			pthread_mutex_lock(&accept_mutex);
4594
-			accept_inputs = 0;
4595
-			pthread_mutex_unlock(&accept_mutex);
4596
-			cli_dbgmsg("Database has changed\n");
4597
-			cl_statfree(&dbstat);
4598
-			/* check for race condition */
4599
-			while(n_children > 0)
4600
-				pthread_cond_wait(&n_children_cond, &n_children_mutex);
4601
-			if(use_syslog)
4602
-				syslog(LOG_WARNING, _("Loading new database"));
4603
-			if(loadDatabase() != 0) {
4604
-				pthread_mutex_unlock(&n_children_mutex);
4605
-				smfi_stop();
4606
-				return NULL;
4607
-			}
4608
-			pthread_mutex_lock(&accept_mutex);
4609
-			accept_inputs = 1;
4610
-			pthread_cond_broadcast(&accept_cond);
4611
-			pthread_mutex_unlock(&accept_mutex);
4612
-		} else if(dbstatus == 0)
4613
-			cli_dbgmsg("Database has not changed\n");
4614
-		else if(dbstatus == 1) {
4615
-			cli_warnmsg("Not reloading database until idle - waiting for %d children\n", n_children);
4616
-			pthread_mutex_lock(&accept_mutex);
4617
-			accept_inputs = 0;
4618
-			pthread_mutex_unlock(&accept_mutex);
4619
-
4620
-			while(n_children > 0) {
4621
-				pthread_cond_wait(&n_children_cond, &n_children_mutex);
4622
-				cli_warnmsg("Waiting for %d children until databae reload\n", n_children);
4623
-			}
4624
-			cl_statfree(&dbstat);
4625
-			if(use_syslog)
4626
-				syslog(LOG_WARNING, _("Loading new database"));
4627
-			if(loadDatabase() != 0) {
4628
-				pthread_mutex_unlock(&n_children_mutex);
4585
+		switch(cl_statchkdir(&dbstat)) {
4586
+			case 1:
4587
+				cli_dbgmsg("Database has changed\n");
4588
+				cl_statfree(&dbstat);
4589
+				if(use_syslog)
4590
+					syslog(LOG_WARNING, _("Loading new database"));
4591
+				if(loadDatabase() != 0) {
4592
+					smfi_stop();
4593
+					cli_errmsg("Failed to load updated database\n");
4594
+					return NULL;
4595
+				}
4596
+				break;
4597
+			case 0:
4598
+				cli_dbgmsg("Database has not changed\n");
4599
+				break;
4600
+			default:
4629 4601
 				smfi_stop();
4602
+				cli_errmsg("Database error - %s is stopping\n", progname);
4630 4603
 				return NULL;
4631
-			}
4632
-			pthread_mutex_lock(&accept_mutex);
4633
-			accept_inputs = 1;
4634
-			if(pthread_cond_broadcast(&accept_cond) < 0)
4635
-				perror("pthread_cond_broadcast");
4636
-			pthread_mutex_unlock(&accept_mutex);
4637
-		} else {
4638
-			smfi_stop();
4639
-			cli_errmsg("Database error - clamav-milter is stopping\n");
4640
-			pthread_mutex_unlock(&n_children_mutex);
4641
-			return NULL;
4642 4604
 		}
4643
-		pthread_mutex_unlock(&n_children_mutex);
4605
+		continue;
4644 4606
 	}
4645 4607
 	cli_dbgmsg("watchdog quits\n");
4646 4608
 	return NULL;
... ...
@@ -4736,10 +4680,6 @@ quit(void)
4736 4736
 
4737 4737
 	quitting++;
4738 4738
 
4739
-	pthread_mutex_lock(&accept_mutex);
4740
-	accept_inputs = 0;
4741
-	pthread_mutex_unlock(&accept_mutex);
4742
-
4743 4739
 #ifdef	SESSION
4744 4740
 	pthread_mutex_lock(&version_mutex);
4745 4741
 #endif
... ...
@@ -4750,10 +4690,12 @@ quit(void)
4750 4750
 #endif
4751 4751
 
4752 4752
 	if(!external) {
4753
+		pthread_mutex_lock(&root_mutex);
4753 4754
 		if(root) {
4754 4755
 			cl_free(root);
4755 4756
 			root = NULL;
4756 4757
 		}
4758
+		pthread_mutex_unlock(&root_mutex);
4757 4759
 	} else {
4758 4760
 #ifdef	SESSION
4759 4761
 		int i = 0;
... ...
@@ -4819,8 +4761,7 @@ broadcast(const char *mess)
4819 4819
 }
4820 4820
 
4821 4821
 /*
4822
- * Load a new database into the internal scanner - it is up to the caller to
4823
- * ensure that no threads are currently scanning
4822
+ * Load a new database into the internal scanner
4824 4823
  */
4825 4824
 static int
4826 4825
 loadDatabase(void)
... ...
@@ -4832,11 +4773,16 @@ loadDatabase(void)
4832 4832
 	char *daily, *ptr;
4833 4833
 	struct cl_cvd *d;
4834 4834
 	const struct cfgstruct *cpt;
4835
+	struct cl_node *newroot, *oldroot;
4835 4836
 	static const char *dbdir;
4836 4837
 
4837 4838
 	assert(!external);
4838 4839
 
4839 4840
 	if(dbdir == NULL) {
4841
+		/*
4842
+		 * First time through, find out in which directory the signature
4843
+		 * databases are
4844
+		 */
4840 4845
 		if((cpt = cfgopt(copt, "DatabaseDirectory")) || (cpt = cfgopt(copt, "DataDirectory")))
4841 4846
 			dbdir = cpt->strarg;
4842 4847
 		else
... ...
@@ -4886,30 +4832,30 @@ loadDatabase(void)
4886 4886
 	if((ptr = strchr(clamav_version, '\n')) != NULL)
4887 4887
 		*ptr = '\0';
4888 4888
 
4889
-	if(root) {
4890
-		cl_free(root);
4891
-		root = NULL;
4892
-	}
4893 4889
 	signatures = 0;
4894
-	ret = cl_loaddbdir(dbdir, &root, &signatures);
4890
+	newroot = NULL;
4891
+	ret = cl_loaddbdir(dbdir, &newroot, &signatures);
4895 4892
 	if(ret != 0) {
4896 4893
 		cli_errmsg("%s\n", cl_strerror(ret));
4897 4894
 		return -1;
4898 4895
 	}
4899
-	if(root == NULL) {
4896
+	if(newroot == NULL) {
4900 4897
 		cli_errmsg("Can't initialize the virus database.\n");
4901 4898
 		return -1;
4902 4899
 	}
4903 4900
 
4904
-	ret = cl_build(root);
4901
+	ret = cl_build(newroot);
4905 4902
 	if(ret != 0) {
4906 4903
 		cli_errmsg("Database initialization error: %s\n", cl_strerror(ret));
4904
+		cl_free(newroot);
4907 4905
 		return -1;
4908 4906
 	}
4909
-	cli_dbgmsg("Database updated\n");
4910
-	if(use_syslog) {
4911
-		syslog(LOG_INFO, _("ClamAV: Protecting against %u viruses"), signatures);
4907
+	pthread_mutex_lock(&root_mutex);
4908
+	oldroot = root;
4909
+	root = newroot;
4910
+	pthread_mutex_unlock(&root_mutex);
4912 4911
 
4912
+	if(use_syslog) {
4913 4913
 #ifdef	SESSION
4914 4914
 		pthread_mutex_lock(&version_mutex);
4915 4915
 #endif
... ...
@@ -4917,7 +4863,13 @@ loadDatabase(void)
4917 4917
 #ifdef	SESSION
4918 4918
 		pthread_mutex_unlock(&version_mutex);
4919 4919
 #endif
4920
+		syslog(LOG_INFO, _("ClamAV: Protecting against %u viruses"), signatures);
4920 4921
 	}
4922
+	if(oldroot) {
4923
+		cli_dbgmsg("Database updated\n");
4924
+		cl_free(oldroot);
4925
+	} else
4926
+		cli_dbgmsg("Database loaded\n");
4921 4927
 
4922 4928
 	return cl_statinidir(dbdir, &dbstat);
4923 4929
 }
... ...
@@ -4932,7 +4884,7 @@ sigsegv(int sig)
4932 4932
 #endif
4933 4933
 
4934 4934
 	if(use_syslog)
4935
-		syslog(LOG_ERR, "Segmentation fault :-( Bye..");
4935
+		syslog(LOG_CRIT, "Segmentation fault :-( Bye..");
4936 4936
 	cli_errmsg("Segmentation fault :-( Bye..\n");
4937 4937
 
4938 4938
 	smfi_stop();
... ...
@@ -5042,6 +4994,14 @@ isWhitelisted(const char *emailaddress)
5042 5042
 {
5043 5043
 	static table_t *whitelist;
5044 5044
 
5045
+
5046
+	cli_dbgmsg("isWhitelisted %s\n", emailaddress);   
5047
+        /*	
5048
+	 * Don't scan messages to the quarantine email address 
5049
+	 */
5050
+        if(quarantine && (strcasecmp(quarantine, emailaddress) == 0))
5051
+		return 1;
5052
+
5045 5053
 	if((whitelist == NULL) && whitelistFile) {
5046 5054
 		FILE *fin;
5047 5055
 		char buf[BUFSIZ + 1];
... ...
@@ -5050,6 +5010,9 @@ isWhitelisted(const char *emailaddress)
5050 5050
 
5051 5051
 		if(fin == NULL) {
5052 5052
 			perror(whitelistFile);
5053
+			if(use_syslog)  
5054
+			    syslog(LOG_ERR, _("Can't open white-list file %s"),
5055
+				    whitelistFile);
5053 5056
 			return 0;
5054 5057
 		}
5055 5058
 		whitelist = tableCreate();
... ...
@@ -5088,12 +5051,17 @@ logger(const char *mess)
5088 5088
 #ifdef	CL_DEBUG
5089 5089
 	puts(mess);
5090 5090
 #else
5091
-	FILE *fout = fopen(logFile, "a");
5091
+	FILE *fout;
5092
+	
5093
+	if(cfgopt(copt, "Foreground"))
5094
+		fout = stderr;
5095
+	else
5096
+		fout = fopen(logFile, "a");
5092 5097
 
5093 5098
 	if(fout == NULL)
5094 5099
 		return;
5095 5100
 
5096
-	if(logTime) {
5101
+	if(logg_time) {
5097 5102
 #ifdef HAVE_CTIME_R
5098 5103
 		time_t currtime = time((time_t)0);
5099 5104
 		char buf[27];
... ...
@@ -5110,6 +5078,7 @@ logger(const char *mess)
5110 5110
 #endif
5111 5111
 	} else
5112 5112
 		fprintf(fout, "%s\n", mess);
5113
-	fclose(fout);
5113
+	if(fout != stderr)
5114
+		fclose(fout);
5114 5115
 #endif
5115 5116
 }
... ...
@@ -169,7 +169,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
169 169
 PACKAGE_VERSION = @PACKAGE_VERSION@
170 170
 PATH_SEPARATOR = @PATH_SEPARATOR@
171 171
 RANLIB = @RANLIB@
172
-SENDMAIL = @SENDMAIL@
173 172
 SET_MAKE = @SET_MAKE@
174 173
 SHELL = @SHELL@
175 174
 STRIP = @STRIP@
... ...
@@ -210,6 +209,7 @@ oldincludedir = @oldincludedir@
210 210
 prefix = @prefix@
211 211
 program_transform_name = @program_transform_name@
212 212
 sbindir = @sbindir@
213
+sendmailprog = @sendmailprog@
213 214
 sharedstatedir = @sharedstatedir@
214 215
 sysconfdir = @sysconfdir@
215 216
 target = @target@
... ...
@@ -437,6 +437,7 @@ int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root
437 437
 	    logg("!ScanStream: Can't write to temporary file.\n");
438 438
 	    if(tmp)
439 439
 		fclose(tmp);
440
+	    close(tmpd);
440 441
 	    return -1;
441 442
 	}
442 443
 
... ...
@@ -454,9 +455,11 @@ int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root
454 454
 	case 0: /* timeout */
455 455
 	    mdprintf(odesc, "read timeout ERROR\n");
456 456
 	    logg("!ScanStream: read timeout.\n");
457
+	    break;
457 458
 	case -1:
458 459
 	    mdprintf(odesc, "read poll ERROR\n");
459 460
 	    logg("!ScanStream: read poll failed.\n");
461
+	    break;
460 462
     }
461 463
 
462 464
     lseek(tmpd, 0, SEEK_SET);
... ...
@@ -160,7 +160,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
160 160
 PACKAGE_VERSION = @PACKAGE_VERSION@
161 161
 PATH_SEPARATOR = @PATH_SEPARATOR@
162 162
 RANLIB = @RANLIB@
163
-SENDMAIL = @SENDMAIL@
164 163
 SET_MAKE = @SET_MAKE@
165 164
 SHELL = @SHELL@
166 165
 STRIP = @STRIP@
... ...
@@ -201,6 +200,7 @@ oldincludedir = @oldincludedir@
201 201
 prefix = @prefix@
202 202
 program_transform_name = @program_transform_name@
203 203
 sbindir = @sbindir@
204
+sendmailprog = @sendmailprog@
204 205
 sharedstatedir = @sharedstatedir@
205 206
 sysconfdir = @sysconfdir@
206 207
 target = @target@
... ...
@@ -153,7 +153,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
153 153
 PACKAGE_VERSION = @PACKAGE_VERSION@
154 154
 PATH_SEPARATOR = @PATH_SEPARATOR@
155 155
 RANLIB = @RANLIB@
156
-SENDMAIL = @SENDMAIL@
157 156
 SET_MAKE = @SET_MAKE@
158 157
 SHELL = @SHELL@
159 158
 STRIP = @STRIP@
... ...
@@ -194,6 +193,7 @@ oldincludedir = @oldincludedir@
194 194
 prefix = @prefix@
195 195
 program_transform_name = @program_transform_name@
196 196
 sbindir = @sbindir@
197
+sendmailprog = @sendmailprog@
197 198
 sharedstatedir = @sharedstatedir@
198 199
 sysconfdir = @sysconfdir@
199 200
 target = @target@
... ...
@@ -293,7 +293,7 @@ int scanmanager(const struct optstruct *opt)
293 293
 
294 294
 int scanfile(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options)
295 295
 {
296
-	int ret, included;
296
+	int ret, included, printclean = 1;
297 297
 	struct optnode *optnode;
298 298
 	char *argument;
299 299
 #ifdef C_LINUX
... ...
@@ -363,7 +363,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
363 363
 
364 364
     if((cli_strbcasestr(filename, ".zip") || cli_strbcasestr(filename, ".rar")) && (options & CL_SCAN_ARCHIVE)) {
365 365
 	/* try to use internal archivers */
366
-	if((ret = checkfile(filename, root, limits, options)) == CL_VIRUS) {
366
+	if((ret = checkfile(filename, root, limits, options, 1)) == CL_VIRUS) {
367 367
 	    if(optl(opt, "remove")) {
368 368
 		if(unlink(filename)) {
369 369
 		    mprintf("%s: Can't remove\n", filename);
... ...
@@ -386,6 +386,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
386 386
 
387 387
 	/* in other case try to continue with external archivers */
388 388
 	options &= ~CL_SCAN_ARCHIVE; /* and disable decompression for the below checkfile() */
389
+	printclean = 0;
389 390
     }
390 391
 
391 392
     if((cli_strbcasestr(filename, ".zip") && optl(opt, "unzip"))
... ...
@@ -428,8 +429,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
428 428
 	}
429 429
     }
430 430
 
431
-
432
-    if((ret = checkfile(filename, root, limits, options)) == CL_VIRUS) {
431
+    if((ret = checkfile(filename, root, limits, options, printclean)) == CL_VIRUS) {
433 432
 	if(optl(opt, "remove")) {
434 433
 	    if(unlink(filename)) {
435 434
 		mprintf("%s: Can't remove\n", filename);
... ...
@@ -594,10 +594,7 @@ int scancompressed(const char *filename, struct cl_node *root, const struct pass
594 594
 	    /* This is no longer a critical error (since 0.24). We scan
595 595
 	     * raw archive.
596 596
 	     */
597
-	    if(!printinfected)
598
-		mprintf("(raw) ");
599
-
600
-	    if((ret = checkfile(filename, root, limits, 0)) == CL_VIRUS) {
597
+	    if((ret = checkfile(filename, root, limits, 0, 0)) == CL_VIRUS) {
601 598
 		if(optl(opt, "remove")) {
602 599
 		    if(unlink(filename)) {
603 600
 			mprintf("%s: Can't remove\n", filename);
... ...
@@ -616,7 +613,7 @@ int scancompressed(const char *filename, struct cl_node *root, const struct pass
616 616
 	case 0:
617 617
 	    /* no viruses found in archive, we scan just in case a raw file
618 618
 	     */
619
-	    if((ret = checkfile(filename, root, limits, 0)) == CL_VIRUS) {
619
+	    if((ret = checkfile(filename, root, limits, 0, 1)) == CL_VIRUS) {
620 620
 		if(optl(opt, "remove")) {
621 621
 		    if(unlink(filename)) {
622 622
 			mprintf("%s: Can't remove\n", filename);
... ...
@@ -747,7 +744,7 @@ int scandirs(const char *dirname, struct cl_node *root, const struct passwd *use
747 747
 	return treewalk(dirname, root, user, opt, limits, options, 1);
748 748
 }
749 749
 
750
-int checkfile(const char *filename, const struct cl_node *root, const struct cl_limits *limits, int options)
750
+int checkfile(const char *filename, const struct cl_node *root, const struct cl_limits *limits, int options, short printclean)
751 751
 {
752 752
 	int fd, ret;
753 753
 	const char *virname;
... ...
@@ -769,7 +766,7 @@ int checkfile(const char *filename, const struct cl_node *root, const struct cl_
769 769
 	    fprintf(stderr, "\007");
770 770
 
771 771
     } else if(ret == CL_CLEAN) {
772
-	if(!printinfected)
772
+	if(!printinfected && printclean)
773 773
 	    mprintf("%s: OK\n", filename);
774 774
     } else
775 775
 	if(!printinfected)
... ...
@@ -33,7 +33,7 @@ int scandenied(const char *filename, struct cl_node *root, const struct passwd *
33 33
 
34 34
 int scandirs(const char *dirname, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
35 35
 
36
-int checkfile(const char *filename, const struct cl_node *root, const struct cl_limits *limits, int compr);
36
+int checkfile(const char *filename, const struct cl_node *root, const struct cl_limits *limits, int options, short printclean);
37 37
 
38 38
 int checkstdin(const struct cl_node *root, const struct cl_limits *limits, int options);
39 39
 
... ...
@@ -123,9 +123,9 @@ int match_regex(const char *filename, const char *pattern)
123 123
 	regex_t reg;
124 124
 	int match, flags;
125 125
 #if !defined(C_CYGWIN) && !defined(C_OS2)
126
-	flags = 0;
126
+	flags = REG_EXTENDED;
127 127
 #else
128
-	flags = REG_ICASE; /* case insensitive on Windows */
128
+	flags = REG_EXTENDED | REG_ICASE; /* case insensitive on Windows */
129 129
 #endif	
130 130
 	if(regcomp(&reg, pattern, flags) != 0) {
131 131
 	    mprintf("!%s: Could not parse regular expression %s.\n", filename, pattern);
... ...
@@ -468,7 +468,7 @@ ac_includes_default="\
468 468
 # include <unistd.h>
469 469
 #endif"
470 470
 
471
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar LIBCLAMAV_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S ECHO EGREP RANLIB ac_ct_RANLIB CPP LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DBDIR CFGDIR LIBCLAMAV_LIBS CLAMD_LIBS CLAMAV_MILTER_LIBS FRESHCLAM_LIBS TH_SAFE ADDITIONAL_LIBS BUILD_CLAMD_TRUE BUILD_CLAMD_FALSE HAVE_MILTER_TRUE HAVE_MILTER_FALSE SENDMAIL GETENT CLAMAVUSER CLAMAVGROUP LIBOBJS LTLIBOBJS'
471
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar LIBCLAMAV_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S ECHO EGREP RANLIB ac_ct_RANLIB CPP LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT sendmailprog DBDIR CFGDIR LIBCLAMAV_LIBS CLAMD_LIBS CLAMAV_MILTER_LIBS FRESHCLAM_LIBS TH_SAFE ADDITIONAL_LIBS BUILD_CLAMD_TRUE BUILD_CLAMD_FALSE HAVE_MILTER_TRUE HAVE_MILTER_FALSE GETENT CLAMAVUSER CLAMAVGROUP LIBOBJS LTLIBOBJS'
472 472
 ac_subst_files=''
473 473
 
474 474
 # Initialize some variables set by options.
... ...
@@ -1041,6 +1041,7 @@ Optional Packages:
1041 1041
   --with-pic              try to use only PIC/non-PIC objects default=use both
1042 1042
   --with-zlib=DIR	  path to directory containing zlib library (default=
1043 1043
 			  /usr/local or /usr if not found in /usr/local)
1044
+  --with-sendmail=PATH    specify location of Sendmail binary (default=auto find)
1044 1045
   --with-libcurl	  support URLs downloading with libcurl (default=auto)
1045 1046
   --with-user=uid	  name of the clamav user (default=clamav)
1046 1047
   --with-group=gid	  name of the clamav group (default=clamav)
... ...
@@ -2072,7 +2073,7 @@ fi
2072 2072
 
2073 2073
 # Define the identity of the package.
2074 2074
  PACKAGE=clamav
2075
- VERSION="0.85.1"
2075
+ VERSION="0.86rc1"
2076 2076
 
2077 2077
 
2078 2078
 cat >>confdefs.h <<_ACEOF
... ...
@@ -2206,7 +2207,7 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
2206 2206
 
2207 2207
 
2208 2208
 LC_CURRENT=1
2209
-LC_REVISION=12
2209
+LC_REVISION=13
2210 2210
 LC_AGE=0
2211 2211
 LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
2212 2212
 
... ...
@@ -5035,7 +5036,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
5035 5035
 case $host in
5036 5036
 *-*-irix6*)
5037 5037
   # Find out which ABI we are using.
5038
-  echo '#line 5038 "configure"' > conftest.$ac_ext
5038
+  echo '#line 5039 "configure"' > conftest.$ac_ext
5039 5039
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
5040 5040
   (eval $ac_compile) 2>&5
5041 5041
   ac_status=$?
... ...
@@ -5626,7 +5627,7 @@ chmod -w .
5626 5626
 save_CFLAGS="$CFLAGS"
5627 5627
 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
5628 5628
 compiler_c_o=no
5629
-if { (eval echo configure:5629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
5629
+if { (eval echo configure:5630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
5630 5630
   # The compiler can only warn and ignore the option if not recognized
5631 5631
   # So say no if there are warnings
5632 5632
   if test -s out/conftest.err; then
... ...
@@ -7560,7 +7561,7 @@ else
7560 7560
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
7561 7561
   lt_status=$lt_dlunknown
7562 7562
   cat > conftest.$ac_ext <<EOF
7563
-#line 7563 "configure"
7563
+#line 7564 "configure"
7564 7564
 #include "confdefs.h"
7565 7565
 
7566 7566
 #if HAVE_DLFCN_H
... ...
@@ -7658,7 +7659,7 @@ else
7658 7658
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
7659 7659
   lt_status=$lt_dlunknown
7660 7660
   cat > conftest.$ac_ext <<EOF
7661
-#line 7661 "configure"
7661
+#line 7662 "configure"
7662 7662
 #include "confdefs.h"
7663 7663
 
7664 7664
 #if HAVE_DLFCN_H
... ...
@@ -10326,11 +10327,12 @@ echo "${ECHO_T}$ZLIB_HOME" >&6
10326 10326
 
10327 10327
 fi;
10328 10328
 
10329
-zlib_check="yes"
10330 10329
 # Check whether --enable-zlib-vcheck or --disable-zlib-vcheck was given.
10331 10330
 if test "${enable_zlib_vcheck+set}" = set; then
10332 10331
   enableval="$enable_zlib_vcheck"
10333
-  zlib_check="no"
10332
+  zlib_check=$enableval
10333
+else
10334
+  zlib_check="yes"
10334 10335
 fi;
10335 10336
 
10336 10337
 if test ! -f "$ZLIB_HOME/include/zlib.h"
... ...
@@ -10517,11 +10519,12 @@ fi
10517 10517
     fi
10518 10518
 fi
10519 10519
 
10520
-want_bzip2="yes"
10521 10520
 # Check whether --enable-bzip2 or --disable-bzip2 was given.
10522 10521
 if test "${enable_bzip2+set}" = set; then
10523 10522
   enableval="$enable_bzip2"
10524
-  want_bzip2="no"
10523
+  want_bzip2=$enableval
10524
+else
10525
+  want_bzip2="yes"
10525 10526
 fi;
10526 10527
 
10527 10528
 if test "$want_bzip2" = "yes"
... ...
@@ -11042,11 +11045,12 @@ fi
11042 11042
 
11043 11043
 fi
11044 11044
 
11045
-want_clamuko="yes"
11046 11045
 # Check whether --enable-clamuko or --disable-clamuko was given.
11047 11046
 if test "${enable_clamuko+set}" = set; then
11048 11047
   enableval="$enable_clamuko"
11049
-  want_clamuko="no"
11048
+  want_clamuko=$enableval
11049
+else
11050
+  want_clamuko="yes"
11050 11051
 fi;
11051 11052
 
11052 11053
 echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5
... ...
@@ -11122,11 +11126,96 @@ else
11122 11122
   have_milter="no"
11123 11123
 fi;
11124 11124
 
11125
-want_dsig="yes"
11125
+if test "$have_milter" = "yes"; then
11126
+  sendmailprog=no
11127
+
11128
+# Check whether --with-sendmail or --without-sendmail was given.
11129
+if test "${with_sendmail+set}" = set; then
11130
+  withval="$with_sendmail"
11131
+  sendmailprog=$with_sendmail
11132
+else
11133
+  sendmailprog=no
11134
+fi;
11135
+
11136
+  if test "$sendmailprog" = "no" ; then
11137
+    # Extract the first word of "sendmail", so it can be a program name with args.
11138
+set dummy sendmail; ac_word=$2
11139
+echo "$as_me:$LINENO: checking for $ac_word" >&5
11140
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
11141
+if test "${ac_cv_path_sendmailprog+set}" = set; then
11142
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11143
+else
11144
+  case $sendmailprog in
11145
+  [\\/]* | ?:[\\/]*)
11146
+  ac_cv_path_sendmailprog="$sendmailprog" # Let the user override the test with a path.
11147
+  ;;
11148
+  *)
11149
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11150
+as_dummy="$PATH:/sbin:/usr/sbin:/usr/lib:/usr/libexec"
11151
+for as_dir in $as_dummy
11152
+do
11153
+  IFS=$as_save_IFS
11154
+  test -z "$as_dir" && as_dir=.
11155
+  for ac_exec_ext in '' $ac_executable_extensions; do
11156
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
11157
+    ac_cv_path_sendmailprog="$as_dir/$ac_word$ac_exec_ext"
11158
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
11159
+    break 2
11160
+  fi
11161
+done
11162
+done
11163
+
11164
+  test -z "$ac_cv_path_sendmailprog" && ac_cv_path_sendmailprog="no"
11165
+  ;;
11166
+esac
11167
+fi
11168
+sendmailprog=$ac_cv_path_sendmailprog
11169
+
11170
+if test -n "$sendmailprog"; then
11171
+  echo "$as_me:$LINENO: result: $sendmailprog" >&5
11172
+echo "${ECHO_T}$sendmailprog" >&6
11173
+else
11174
+  echo "$as_me:$LINENO: result: no" >&5
11175
+echo "${ECHO_T}no" >&6
11176
+fi
11177
+
11178
+  fi
11179
+
11180
+
11181
+cat >>confdefs.h <<_ACEOF
11182
+#define SENDMAIL_BIN "$sendmailprog"
11183
+_ACEOF
11184
+
11185
+
11186
+  sendmailver=`$sendmailprog -d0 < /dev/null | head -1 | awk '{print $2}'`
11187
+  sendmailver_a=`echo $sendmailver | awk -F. '{printf $1}'`
11188
+  sendmailver_b=`echo $sendmailver | awk -F. '{printf $2}'`
11189
+  sendmailver_c=`echo $sendmailver | awk -F. '{printf $3}'`
11190
+
11191
+
11192
+cat >>confdefs.h <<_ACEOF
11193
+#define SENDMAIL_VERSION_A $sendmailver_a
11194
+_ACEOF
11195
+
11196
+
11197
+cat >>confdefs.h <<_ACEOF
11198
+#define SENDMAIL_VERSION_B $sendmailver_b
11199
+_ACEOF
11200
+
11201
+
11202
+cat >>confdefs.h <<_ACEOF
11203
+#define SENDMAIL_VERSION_C $sendmailver_c
11204
+_ACEOF
11205
+
11206
+
11207
+fi
11208
+
11126 11209
 # Check whether --enable-dsig or --disable-dsig was given.
11127 11210
 if test "${enable_dsig+set}" = set; then
11128 11211
   enableval="$enable_dsig"
11129
-  want_dsig="no"
11212
+  want_dsig=$enableval
11213
+else
11214
+  want_dsig="yes"
11130 11215
 fi;
11131 11216
 
11132 11217
 if test "$want_dsig" = "yes"
... ...
@@ -11335,19 +11424,19 @@ fi
11335 11335
 # Check whether --enable-pthreads or --disable-pthreads was given.
11336 11336
 if test "${enable_pthreads+set}" = set; then
11337 11337
   enableval="$enable_pthreads"
11338
-  have_pthreads=no
11338
+  have_pthreads=$enableval
11339 11339
 fi;
11340 11340
 
11341 11341
 # Check whether --enable-cr or --disable-cr was given.
11342 11342
 if test "${enable_cr+set}" = set; then
11343 11343
   enableval="$enable_cr"
11344
-  disable_cr=yes
11344
+  disable_cr=$enableval
11345 11345
 fi;
11346 11346
 
11347 11347
 # Check whether --enable-id-check or --disable-id-check was given.
11348 11348
 if test "${enable_id_check+set}" = set; then
11349 11349
   enableval="$enable_id_check"
11350
-  use_id="yes"
11350
+  use_id=$enableval
11351 11351
 else
11352 11352
   use_id="no"
11353 11353
 fi;
... ...
@@ -11355,7 +11444,7 @@ fi;
11355 11355
 # Check whether --enable-yp-check or --disable-yp-check was given.
11356 11356
 if test "${enable_yp_check+set}" = set; then
11357 11357
   enableval="$enable_yp_check"
11358
-  use_yp="yes"
11358
+  use_yp=$enableval
11359 11359
 else
11360 11360
   use_yp="no"
11361 11361
 fi;
... ...
@@ -11389,32 +11478,45 @@ cat >>confdefs.h <<_ACEOF
11389 11389
 _ACEOF
11390 11390
 
11391 11391
 
11392
-test_clamav=yes
11393 11392
 # Check whether --enable-clamav or --disable-clamav was given.
11394 11393
 if test "${enable_clamav+set}" = set; then
11395 11394
   enableval="$enable_clamav"
11396
-  test_clamav=no
11395
+  test_clamav=$enableval
11396
+else
11397
+  test_clamav=yes
11397 11398
 fi;
11398 11399
 
11399 11400
 # Check whether --enable-debug or --disable-debug was given.
11400 11401
 if test "${enable_debug+set}" = set; then
11401 11402
   enableval="$enable_debug"
11403
+  enable_debug=$enableval
11404
+else
11405
+  enable_debug="no"
11406
+fi;
11407
+
11408
+if test "$enable_debug" = "yes"; then
11402 11409
 
11403 11410
 cat >>confdefs.h <<\_ACEOF
11404 11411
 #define CL_DEBUG 1
11405 11412
 _ACEOF
11406 11413
 
11407
-fi;
11414
+fi
11408 11415
 
11409 11416
 # Check whether --enable-bigstack or --disable-bigstack was given.
11410 11417
 if test "${enable_bigstack+set}" = set; then
11411 11418
   enableval="$enable_bigstack"
11419
+  enable_bigstack=$enableval
11420
+else
11421
+  enable_bigstack="no"
11422
+fi;
11423
+
11424
+if test "$enable_bigstack" = "yes"; then
11412 11425
 
11413 11426
 cat >>confdefs.h <<\_ACEOF
11414 11427
 #define C_BIGSTACK 1
11415 11428
 _ACEOF
11416 11429
 
11417
-fi;
11430
+fi
11418 11431
 
11419 11432
 
11420 11433
 # Check whether --with-dbdir or --without-dbdir was given.
... ...
@@ -12448,51 +12550,6 @@ _ACEOF
12448 12448
 
12449 12449
 fi
12450 12450
 
12451
-if test "$have_milter" = "yes"
12452
-then
12453
-    # Extract the first word of "sendmail", so it can be a program name with args.
12454
-set dummy sendmail; ac_word=$2
12455
-echo "$as_me:$LINENO: checking for $ac_word" >&5
12456
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
12457
-if test "${ac_cv_path_SENDMAIL+set}" = set; then
12458
-  echo $ECHO_N "(cached) $ECHO_C" >&6
12459
-else
12460
-  case $SENDMAIL in
12461
-  [\\/]* | ?:[\\/]*)
12462
-  ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path.
12463
-  ;;
12464
-  *)
12465
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12466
-as_dummy="$PATH:/usr/lib:/usr/sbin:/etc:/usr/local/lib:/usr/local/sbin:/usr/bin:/usr/local/bin"
12467
-for as_dir in $as_dummy
12468
-do
12469
-  IFS=$as_save_IFS
12470
-  test -z "$as_dir" && as_dir=.
12471
-  for ac_exec_ext in '' $ac_executable_extensions; do
12472
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12473
-    ac_cv_path_SENDMAIL="$as_dir/$ac_word$ac_exec_ext"
12474
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
12475
-    break 2
12476
-  fi
12477
-done
12478
-done
12479
-
12480
-  test -z "$ac_cv_path_SENDMAIL" && ac_cv_path_SENDMAIL="/usr/lib/sendmail"
12481
-  ;;
12482
-esac
12483
-fi
12484
-SENDMAIL=$ac_cv_path_SENDMAIL
12485
-
12486
-if test -n "$SENDMAIL"; then
12487
-  echo "$as_me:$LINENO: result: $SENDMAIL" >&5
12488
-echo "${ECHO_T}$SENDMAIL" >&6
12489
-else
12490
-  echo "$as_me:$LINENO: result: no" >&5
12491
-echo "${ECHO_T}no" >&6
12492
-fi
12493
-
12494
-fi
12495
-
12496 12451
 
12497 12452
 
12498 12453
 for ac_func in recvmsg sendmsg
... ...
@@ -13208,7 +13265,7 @@ fi
13208 13208
 # Check whether --enable-gethostbyname_r or --disable-gethostbyname_r was given.
13209 13209
 if test "${enable_gethostbyname_r+set}" = set; then
13210 13210
   enableval="$enable_gethostbyname_r"
13211
-  disable_gethostbyname_r="yes"
13211
+  disable_gethostbyname_r=$enableval
13212 13212
 fi;
13213 13213
 
13214 13214
 if test "$disable_gethostbyname_r" = "yes"; then
... ...
@@ -13353,12 +13410,12 @@ fi
13353 13353
 # Check whether --enable-readdir_r or --disable-readdir_r was given.
13354 13354
 if test "${enable_readdir_r+set}" = set; then
13355 13355
   enableval="$enable_readdir_r"
13356
-
13356
+  enable_readdir_r=$enableval
13357 13357
 else
13358
-  disable_readdir_r="yes"
13358
+  enable_readdir_r="no"
13359 13359
 fi;
13360 13360
 
13361
-if test "$disable_readdir_r" = "yes"; then
13361
+if test "$enable_readdir_r" = "no"; then
13362 13362
     echo "$as_me:$LINENO: result: support disabled" >&5
13363 13363
 echo "${ECHO_T}support disabled" >&6
13364 13364
 elif test -z "$ac_cv_readdir_args"; then
... ...
@@ -14969,6 +15026,7 @@ s,@LIBTOOL@,$LIBTOOL,;t t
14969 14969
 s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
14970 14970
 s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
14971 14971
 s,@MAINT@,$MAINT,;t t
14972
+s,@sendmailprog@,$sendmailprog,;t t
14972 14973
 s,@DBDIR@,$DBDIR,;t t
14973 14974
 s,@CFGDIR@,$CFGDIR,;t t
14974 14975
 s,@LIBCLAMAV_LIBS@,$LIBCLAMAV_LIBS,;t t
... ...
@@ -14981,7 +15039,6 @@ s,@BUILD_CLAMD_TRUE@,$BUILD_CLAMD_TRUE,;t t
14981 14981
 s,@BUILD_CLAMD_FALSE@,$BUILD_CLAMD_FALSE,;t t
14982 14982
 s,@HAVE_MILTER_TRUE@,$HAVE_MILTER_TRUE,;t t
14983 14983
 s,@HAVE_MILTER_FALSE@,$HAVE_MILTER_FALSE,;t t
14984
-s,@SENDMAIL@,$SENDMAIL,;t t
14985 14984
 s,@GETENT@,$GETENT,;t t
14986 14985
 s,@CLAMAVUSER@,$CLAMAVUSER,;t t
14987 14986
 s,@CLAMAVGROUP@,$CLAMAVGROUP,;t t
... ...
@@ -18,11 +18,11 @@ dnl   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 18
 
19 19
 AC_INIT(clamscan/clamscan.c)
20 20
 AC_CREATE_TARGET_H(target.h)
21
-AM_INIT_AUTOMAKE(clamav, "0.85.1")
21
+AM_INIT_AUTOMAKE(clamav, "0.86rc1")
22 22
 AM_CONFIG_HEADER(clamav-config.h)
23 23
 
24 24
 LC_CURRENT=1
25
-LC_REVISION=12
25
+LC_REVISION=13
26 26
 LC_AGE=0
27 27
 LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
28 28
 AC_SUBST(LIBCLAMAV_VERSION)
... ...
@@ -94,10 +94,9 @@ fi
94 94
 AC_MSG_RESULT($ZLIB_HOME)
95 95
 ])
96 96
 
97
-zlib_check="yes"
98 97
 AC_ARG_ENABLE(zlib-vcheck,
99 98
 [  --disable-zlib-vcheck	  do not check for buggy zlib version ],
100
-zlib_check="no",)
99
+zlib_check=$enableval, zlib_check="yes")
101 100
 
102 101
 if test ! -f "$ZLIB_HOME/include/zlib.h"
103 102
 then
... ...
@@ -128,10 +127,9 @@ else
128 128
     fi
129 129
 fi
130 130
 
131
-want_bzip2="yes"
132 131
 AC_ARG_ENABLE(bzip2,
133 132
 [  --disable-bzip2	  disable bzip2 support],
134
-want_bzip2="no",)
133
+want_bzip2=$enableval, want_bzip2="yes")
135 134
 
136 135
 if test "$want_bzip2" = "yes"
137 136
 then
... ...
@@ -151,21 +149,42 @@ if test $want_dns = yes; then
151 151
     AC_CHECK_HEADER(resolv.h,[FRESHCLAM_LIBS="$FRESHCLAM_LIBS $resolv_lib"; AC_DEFINE(HAVE_RESOLV_H,1,have resolv.h)], AC_MSG_WARN([****** DNS support disabled]))
152 152
 fi
153 153
 
154
-want_clamuko="yes"
155 154
 AC_ARG_ENABLE(clamuko,
156 155
 [  --disable-clamuko	  disable clamuko support (Linux and FreeBSD only)],
157
-want_clamuko="no",)
156
+want_clamuko=$enableval, want_clamuko="yes")
158 157
 
159 158
 AC_FUNC_SETPGRP
160 159
 
161 160
 AC_ARG_ENABLE(milter,
162 161
 [  --enable-milter	  build clamav-milter],
163
-have_milter=$enableval,have_milter="no")
162
+have_milter=$enableval, have_milter="no")
163
+
164
+if test "$have_milter" = "yes"; then
165
+  sendmailprog=no
166
+  AC_ARG_WITH(sendmail,
167
+  [  --with-sendmail=PATH    specify location of Sendmail binary (default=auto find)],
168
+  sendmailprog=$with_sendmail, sendmailprog=no)
169
+
170
+  if test "$sendmailprog" = "no" ; then
171
+    AC_PATH_PROG(sendmailprog, sendmail, no, $PATH:/sbin:/usr/sbin:/usr/lib:/usr/libexec)
172
+  fi
173
+
174
+  AC_DEFINE_UNQUOTED(SENDMAIL_BIN, "$sendmailprog", [location of Sendmail binary])
175
+
176
+  sendmailver=`$sendmailprog -d0 < /dev/null | head -1 | awk '{print $2}'`
177
+  sendmailver_a=`echo $sendmailver | awk -F. '{printf $1}'`
178
+  sendmailver_b=`echo $sendmailver | awk -F. '{printf $2}'`
179
+  sendmailver_c=`echo $sendmailver | awk -F. '{printf $3}'`
180
+
181
+  AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_A, $sendmailver_a, [major version of Sendmail])
182
+  AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_B, $sendmailver_b, [minor version of Sendmail])
183
+  AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_C, $sendmailver_c, [subversion of Sendmail])
184
+
185
+fi
164 186
 
165
-want_dsig="yes"
166 187
 AC_ARG_ENABLE(dsig,
167 188
 [  --disable-dsig	  disable support for digital signatures],
168
-want_dsig="no",)
189
+want_dsig=$enableval, want_dsig="yes")
169 190
 
170 191
 if test "$want_dsig" = "yes"
171 192
 then
... ...
@@ -215,19 +234,19 @@ fi
215 215
 
216 216
 AC_ARG_ENABLE(pthreads,
217 217
 [  --disable-pthreads      disable POSIX threads support],
218
-have_pthreads=no, )
218
+have_pthreads=$enableval,)
219 219
 
220 220
 AC_ARG_ENABLE(cr,
221 221
 [  --disable-cr		  don't link with C reentrant library (BSD) ],
222
-disable_cr=yes,)
222
+disable_cr=$enableval,)
223 223
 
224 224
 AC_ARG_ENABLE(id-check,
225 225
 [  --enable-id-check	  use id utility instead of /etc/passwd parsing],
226
-use_id="yes", use_id="no")
226
+use_id=$enableval, use_id="no")
227 227
 
228 228
 AC_ARG_ENABLE(yp-check,
229 229
 [  --enable-yp-check	  use ypmatch utility instead of /etc/passwd parsing],
230
-use_yp="yes", use_yp="no")
230
+use_yp=$enableval, use_yp="no")
231 231
 
232 232
 AC_ARG_WITH(user, 
233 233
 [  --with-user=uid	  name of the clamav user (default=clamav)],
... ...
@@ -240,18 +259,25 @@ clamav_group="$withval", clamav_group="clamav")
240 240
 AC_DEFINE_UNQUOTED(CLAMAVUSER,"$clamav_user",[name of the clamav user])
241 241
 AC_DEFINE_UNQUOTED(CLAMAVGROUP,"$clamav_group",[name of the clamav group])
242 242
 
243
-test_clamav=yes
244 243
 AC_ARG_ENABLE(clamav,
245 244
 [  --disable-clamav	  disable test for clamav user/group],
246
-test_clamav=no,)
245
+test_clamav=$enableval, test_clamav=yes)
247 246
 
248 247
 AC_ARG_ENABLE(debug,
249 248
 [  --enable-debug	  enable debug code],
250
-AC_DEFINE(CL_DEBUG,1,[enable debugging]),)
249
+enable_debug=$enableval, enable_debug="no")
250
+
251
+if test "$enable_debug" = "yes"; then
252
+  AC_DEFINE(CL_DEBUG,1,[enable debugging])
253
+fi
251 254
 
252 255
 AC_ARG_ENABLE(bigstack,
253 256
 [  --enable-bigstack	  increase thread stack size],
254
-AC_DEFINE(C_BIGSTACK,1,[Increase thread stack size.]),)
257
+enable_bigstack=$enableval, enable_bigstack="no")
258
+
259
+if test "$enable_bigstack" = "yes"; then
260
+  AC_DEFINE(C_BIGSTACK,1,[Increase thread stack size.])
261
+fi
255 262
 
256 263
 AC_ARG_WITH(dbdir, 
257 264
 [  --with-dbdir=path	  path to virus database directory],
... ...
@@ -552,11 +578,6 @@ then
552 552
     AC_DEFINE(BUILD_CLAMD, 1, "build clamd")
553 553
 fi
554 554
 
555
-if test "$have_milter" = "yes"
556
-then
557
-    AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail, $PATH:/usr/lib:/usr/sbin:/etc:/usr/local/lib:/usr/local/sbin:/usr/bin:/usr/local/bin)
558
-fi
559
-
560 555
 dnl Check if we can do fd passing
561 556
 dnl Submitted by Richard Lyons <frob-clamav@webcentral.com.au>
562 557
 AC_CHECK_FUNCS(recvmsg sendmsg)
... ...
@@ -711,7 +732,7 @@ fi
711 711
 
712 712
 AC_ARG_ENABLE(gethostbyname_r,
713 713
 [  --disable-gethostbyname_r	  disable support for gethostbyname_r],
714
-disable_gethostbyname_r="yes", )
714
+disable_gethostbyname_r=$enableval,)
715 715
 
716 716
 if test "$disable_gethostbyname_r" = "yes"; then
717 717
     AC_MSG_RESULT(support disabled)
... ...
@@ -759,10 +780,10 @@ if test -z "$ac_cv_readdir_args"; then
759 759
 fi
760 760
 
761 761
 AC_ARG_ENABLE(readdir_r,
762
-[  --enable-readdir_r		    enable support for readdir_r],,
763
-disable_readdir_r="yes")
762
+[  --enable-readdir_r		    enable support for readdir_r],
763
+enable_readdir_r=$enableval, enable_readdir_r="no")
764 764
 
765
-if test "$disable_readdir_r" = "yes"; then
765
+if test "$enable_readdir_r" = "no"; then
766 766
     AC_MSG_RESULT(support disabled)
767 767
 elif test -z "$ac_cv_readdir_args"; then
768 768
     AC_MSG_RESULT(no)
... ...
@@ -128,7 +128,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
128 128
 PACKAGE_VERSION = @PACKAGE_VERSION@
129 129
 PATH_SEPARATOR = @PATH_SEPARATOR@
130 130
 RANLIB = @RANLIB@
131
-SENDMAIL = @SENDMAIL@
132 131
 SET_MAKE = @SET_MAKE@
133 132
 SHELL = @SHELL@
134 133
 STRIP = @STRIP@
... ...
@@ -169,6 +168,7 @@ oldincludedir = @oldincludedir@
169 169
 prefix = @prefix@
170 170
 program_transform_name = @program_transform_name@
171 171
 sbindir = @sbindir@
172
+sendmailprog = @sendmailprog@
172 173
 sharedstatedir = @sharedstatedir@
173 174
 sysconfdir = @sysconfdir@
174 175
 target = @target@
... ...
@@ -133,7 +133,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
133 133
 PACKAGE_VERSION = @PACKAGE_VERSION@
134 134
 PATH_SEPARATOR = @PATH_SEPARATOR@
135 135
 RANLIB = @RANLIB@
136
-SENDMAIL = @SENDMAIL@
137 136
 SET_MAKE = @SET_MAKE@
138 137
 SHELL = @SHELL@
139 138
 STRIP = @STRIP@
... ...
@@ -174,6 +173,7 @@ oldincludedir = @oldincludedir@
174 174
 prefix = @prefix@
175 175
 program_transform_name = @program_transform_name@
176 176
 sbindir = @sbindir@
177
+sendmailprog = @sendmailprog@
177 178
 sharedstatedir = @sharedstatedir@
178 179
 sysconfdir = @sysconfdir@
179 180
 target = @target@
180 181
Binary files a/docs/clamdoc.pdf and b/docs/clamdoc.pdf differ
... ...
@@ -69,14 +69,14 @@
69 69
     \vspace{3cm}
70 70
     \begin{flushright}
71 71
 	\rule[-1ex]{8cm}{3pt}\\
72
-	\huge Clam AntiVirus 0.85\\
72
+	\huge Clam AntiVirus 0.86rc1\\
73 73
 	\huge \emph{User Manual}\\
74 74
     \end{flushright}
75 75
 
76 76
     \newpage
77 77
     \pagestyle{fancy}
78 78
     \tableofcontents
79
-    \vspace{12.0cm}
79
+    \vspace{11.5cm}
80 80
 
81 81
     \noindent
82 82
     \begin{boxedminipage}[b]{\textwidth}
... ...
@@ -121,7 +121,7 @@
121 121
 	\item{POSIX compliant, portable}
122 122
 	\item{Fast scanning}
123 123
 	\item{Supports on-access scanning (Linux and FreeBSD only)}
124
-	\item{Detects over 30000 viruses, worms, and trojans, including
124
+	\item{Detects over 35000 viruses, worms, and trojans, including
125 125
 	      Microsoft Office and MacOffice macro viruses}
126 126
 	\item{Scans within archives and compressed files (also protects
127 127
 	      against archive bombs), built-in support includes:
... ...
@@ -743,6 +743,7 @@ N * * * *	/usr/local/bin/freshclam --quiet
743 743
     \subsubsection{Mail files}
744 744
     Advanced mail scanner built into libclamav transparently scans e-mails
745 745
     for infected attachments. All popular UNIX mail formats are supported.
746
+    TNEF attachments are supported as well.
746 747
 
747 748
     \subsection{API}
748 749
 
... ...
@@ -1499,6 +1500,13 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
1499 1499
     \textbf{Supports:} clamscan\\[4pt]
1500 1500
     Zabit is a content and attachment filter for Qmail.
1501 1501
 
1502
+    \subsubsection{zmscanner}
1503
+    \textbf{Homepage:} \url{http://www.average.org/zmscanner/}\\
1504
+    \textbf{Supports:} libclamav\\[4pt]
1505
+    Zmscanner is an extensible modular content filter for Zmailer and Sendmail.
1506
+    It is designed to be fast and efficient and thus suitable for high traffic
1507
+    mail systems.
1508
+
1502 1509
     \subsection{\emph{MTA + POP3 Proxy + ClamAV}}
1503 1510
 
1504 1511
     \subsubsection{ClamMail}
... ...
@@ -1901,6 +1909,11 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
1901 1901
     a virus is detected, snort-inline can send a reset and drop the relative
1902 1902
     packets.
1903 1903
 
1904
+    \subsubsection{Snort-ClamAV}
1905
+    \textbf{Homepage:} \url{http://www.bleedingsnort.com/staticpages/index.php?page=snort-clamav}\\
1906
+    \textbf{Supports:} libclamav\\[4pt]
1907
+    Snort-ClamAV scans data in packets for viruses.
1908
+
1904 1909
     \section{Credits}
1905 1910
 
1906 1911
     \subsection{Database mirrors}\label{mirrors}
... ...
@@ -1954,15 +1967,6 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
1954 1954
 				     &		      &	    & \email{<scott*perlcode.org>}\\ \hline
1955 1955
 	\url{clamavdb.heanet.ie} & 193.1.219.100 & Ireland & Colm MacCarthaigh\\
1956 1956
 				 &		 &	   & \email{<mirrors*heanet.ie>}\\ \hline
1957
-    \end{tabular}}
1958
-    \end{center}
1959
-    % new page
1960
-    \begin{center}
1961
-    {\footnotesize
1962
-    \begin{tabular}{|c|c|c|c|}
1963
-	\hline
1964
-	Mirror & IP & Location & Administrator\\ \hline\hline
1965
-
1966 1957
 	\url{clamav.crysys.hu} & 152.66.249.132 & Hungary & Bencsath Boldizsar\\
1967 1958
 			       &		&	  & \email{<boldi*mail2004.crysys.hit.bme.hu>}\\ \hline
1968 1959
 
... ...
@@ -1980,7 +1984,17 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
1980 1980
 
1981 1981
 	\url{clamavdb.ikk.sztaki.hu} & 193.225.86.3 & Hungary & Gabor Kiss\\
1982 1982
 				     &		    &	      & \email{<kissg*debella.ikk.sztaki.hu>}\\ \hline
1983
-	
1983
+
1984
+    \end{tabular}}
1985
+    \end{center}
1986
+    % new page
1987
+    \begin{center}
1988
+    {\footnotesize
1989
+    \begin{tabular}{|c|c|c|c|}
1990
+	\hline
1991
+	Mirror & IP & Location & Administrator\\ \hline\hline
1992
+
1993
+
1984 1994
 	\url{clamav.mirrors.nks.net} & 24.73.112.74 & Florida, USA & James Neal\\
1985 1995
 				     &		    &		   & \email{<clam-admin*nks.net>}\\ \hline
1986 1996
 
... ...
@@ -1999,11 +2013,6 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
1999 1999
 	\url{clamav.im1.net} & 65.77.42.207 & Florida, US & Dmitri Pavlenkov\\
2000 2000
 			     &		    &		  & \email{<dmitri*im1.com>}\\ \hline
2001 2001
 
2002
-	\url{clamav.elektrotech-ker.hu} & 80.95.80.7 & Hungary & Bodrogi Zsolt\\
2003
-					&	     &	       & \email{<odin*szilank.hu>}\\ \hline
2004
-
2005
-	\url{clamav.stockingshq.com} & 212.113.16.74 & United Kingdom & \email{<dave*stockingshq.com>}\\ \hline
2006
-
2007 2002
 	\url{clamav.acnova.com} & 203.81.40.167 & Singapore & Lennard Seah\\
2008 2003
 				&		&	    & \email{<myself*lennardseah.com>}\\ \hline
2009 2004
 	\url{clamdb.prolocation.net} & 213.73.255.243 & The Netherlands & Raymond Dijkxhoorn\\
... ...
@@ -2024,14 +2033,6 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2024 2024
 				       &		&     & \email{<clamav*zyserver.net>}\\ \hline
2025 2025
 	\url{clamav.pcn.de} & 213.203.254.4 & Hamburg, & Karsten Gessner\\
2026 2026
 			    &		    & Germany  & \email{<karsten*pcn.de>}\\ \hline
2027
-    \end{tabular}}
2028
-    \end{center}
2029
-    % new page
2030
-    \begin{center}
2031
-    {\footnotesize
2032
-    \begin{tabular}{|c|c|c|c|}
2033
-	\hline
2034
-	Mirror & IP & Location & Administrator\\ \hline\hline
2035 2027
 	\url{clamav.enderunix.org} & 193.140.143.23 & Turkey & Omer Faruk Sen\\
2036 2028
 				   &		    &	     & \email{<ofsen*enderunix.org>}\\ \hline
2037 2029
 	\url{clamav.ovh.net} & 213.186.33.38 & France & Germain Masse\\
... ...
@@ -2046,6 +2047,15 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2046 2046
 				    &		   &	    & \email{<adam*popik.pl>}\\ \hline
2047 2047
 	\url{clamav.fx-services.com} & 69.93.108.98 & USA & Robin Vley\\
2048 2048
 				     &		    &	  & \email{<robin*fx-services.com>}\\ \hline
2049
+    \end{tabular}}
2050
+    \end{center}
2051
+    % new page
2052
+    \begin{center}
2053
+    {\footnotesize
2054
+    \begin{tabular}{|c|c|c|c|}
2055
+	\hline
2056
+	Mirror & IP & Location & Administrator\\ \hline\hline
2057
+
2049 2058
 	\url{clamav.univ-nantes.fr} & 193.52.101.131 & France & Yann Dupont\\
2050 2059
 				    &		     &	      &	\email{<yann.dupont*univ-nantes.fr>}\\ \hline
2051 2060
 	\url{clamav.blackroute.net} & 64.246.44.108 & Texas, USA & Maarten Van Horenbeeck\\
... ...
@@ -2082,15 +2092,6 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2082 2082
 			      &		   &	   & \email{<md*linux.it>}\\ \hline
2083 2083
 	\url{clamav.eastweb.ru} & 213.219.245.4 & Russia & Leonid Novikov\\
2084 2084
 				&		&	 & \email{<lenni*eastweb.ru>}\\ \hline
2085
-    \end{tabular}}
2086
-    \end{center}
2087
-    % new page
2088
-    \begin{center}
2089
-    {\footnotesize
2090
-    \begin{tabular}{|c|c|c|c|}
2091
-	\hline
2092
-	Mirror & IP & Location & Administrator\\ \hline\hline
2093
-
2094 2085
 	\url{clamav.mirrors.webpartner.dk} & 195.184.96.15 & Denmark & Nicolai Gylling \email{<nsg*webpartner.dk>}\\
2095 2086
 					   &		   &	     & Lasse Brandt \email{<lb*webpartner.dk>}\\ \hline
2096 2087
 	\url{mirror.etf.bg.ac.yu} & 147.91.8.58 & Belgrade, Serbia & Ljubisa Radivojevic\\
... ...
@@ -2103,6 +2104,15 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2103 2103
 				       &		&	 & \email{<fd*waycom.net>}\\ \hline
2104 2104
 	\url{clamav.cryms.info} & 194.29.5.19 & Lugano,	    & Lorenzo Patocchi\\
2105 2105
 				&	      & Switzerland & \email{<lorenzo.patocchi*cryms.com>}\\ \hline
2106
+    \end{tabular}}
2107
+    \end{center}
2108
+    % new page
2109
+    \begin{center}
2110
+    {\footnotesize
2111
+    \begin{tabular}{|c|c|c|c|}
2112
+	\hline
2113
+	Mirror & IP & Location & Administrator\\ \hline\hline
2114
+
2106 2115
 	\url{clamav.mirror.pacific.net.au} & 61.8.0.16 & Australia & Martin Foster\\
2107 2116
 					   &	       &	   & \email{<mirror-team*pacific.net.au>}\\ \hline
2108 2117
 	\url{clamavdb.mirrors.net.ru} & 212.16.26.185 & Russia & Andrew V. Kovalev\\
... ...
@@ -2153,6 +2163,27 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2153 2153
 				    &		    &	      & \email{<ftpadmin*iasi.roedu.net>}\\ \hline
2154 2154
     \end{tabular}}
2155 2155
     \end{center}
2156
+    % new page
2157
+    \begin{center}
2158
+    {\footnotesize
2159
+    \begin{tabular}{|c|c|c|c|}
2160
+	\hline
2161
+	Mirror & IP & Location & Administrator\\ \hline\hline
2162
+
2163
+	\url{clamav.infonet.ee} & 212.7.0.71 & Estonia & Konstantin Barinov\\
2164
+				&	     &	       & \email{<sbr*infonet.ee>}\\ \hline
2165
+	\url{clamav.savework.de} & 81.169.151.96 & Germany & Kai-H. Weutzing\\
2166
+				 &		 &	   & \email{<clamavdb*savework.de>}\\ \hline
2167
+	\url{clamav.citrin.ru} & 213.248.60.121 & Russia & Anton Yuzhaninov\\
2168
+			       &		&	 & \email{<citrin*citrin.ru>}\\ \hline
2169
+	\url{clamav.keystreams.com} & 207.158.28.8 & USA & Roman Volf\\
2170
+				    &		   &	 & \email{<volfman*keystreams.com>}\\ \hline
2171
+	\url{clamav.paralax.org} & 83.148.101.196 & Bulgaria & Svetoslav Vesselkoff\\
2172
+				 &		  &	     & \email{<soho*paralax.org>}\\ \hline
2173
+	\url{clamav.linux.pt} & 194.65.79.153 & Portugal & Jose Celestino\\
2174
+			      &		      &		 & \email{<japc*co.sapo.pt>}\\ \hline
2175
+    \end{tabular}}
2176
+    \end{center}
2156 2177
 
2157 2178
     \subsection{Contributors}
2158 2179
     The following people contributed to our project in some way (providing
... ...
@@ -2236,6 +2267,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2236 2236
 	\item Michal Hajduczenia \email{<michalis*mat.uni.torun.pl>}
2237 2237
 	\item Jean-Christophe Heger \email{<jcheger*acytec.com>}
2238 2238
 	\item Martin Heinz \email{<Martin*hemag.ch>}
2239
+	\item Kevin Heneveld" \email{<kevin*northstar.k12.ak.us>}
2239 2240
 	\item Anders Herbjornsen \email{<andersh*gar.no>}
2240 2241
 	\item Paul Hoadley \email{<paulh*logixsquad.net>}
2241 2242
 	\item Robert Hogan \email{<robert*roberthogan.net>}
... ...
@@ -2281,6 +2313,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2281 2281
 	\item Thomas Madsen \email{<tm*softcom.dk>}
2282 2282
 	\item Bill Maidment \email{<bill*maidment.com.au>}
2283 2283
 	\item Joe Maimon \email{<jmaimon*ttec.com>}
2284
+	\item David Majorel \email{<dm*lagoon.nc>}
2284 2285
 	\item Andrey V. Malyshev \email{<amal*krasn.ru>}
2285 2286
 	\item Stefan Martig \email{<sm*officeco.ch>}
2286 2287
 	\item Alexander Marx \email{<mad-ml*madness.at>}
... ...
@@ -2297,6 +2330,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2297 2297
 	\item Arkadiusz Miskiewicz \email{<misiek*pld-linux.org>}
2298 2298
 	\item Ted Mittelstaedt \email{<tedm*toybox.placo.com>}
2299 2299
 	\item Mark Mielke \email{<mark*mark.mielke.cc>}
2300
+	\item John Miller \email{<contact*glideslopesoftware.co.uk>}
2300 2301
 	\item Jo Mills \email{<Jonathan.Mills*frequentis.com>}
2301 2302
 	\item Dustin Mollo \email{<dustin.mollo*sonoma.edu>}
2302 2303
 	\item Remi Mommsen \email{<remigius.mommsen*cern.ch>}
... ...
@@ -2338,6 +2372,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2338 2338
 	\item Ed Ravin \email{<eravin*panix.com>}
2339 2339
 	\item Brian A. Reiter \email{<breiter*wolfereiter.com>}
2340 2340
 	\item Didi Rieder \email{<adrieder*sbox.tugraz.at>}
2341
+	\item Pavel V. Rochnyack \email{<rpv*fsf.tsu.ru>}
2341 2342
 	\item Rupert Roesler-Schmidt \email{<r.roesler-schmidt*uplink.at>}
2342 2343
 	\item David Sanchez \email{<dsanchez*veloxia.com>}
2343 2344
 	\item David Santinoli \email{<david*santinoli.com>}
... ...
@@ -2367,6 +2402,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2367 2367
 	\item Joe Talbott \email{<josepht*cstone.net>}
2368 2368
 	\item Gernot Tenchio \email{<g.tenchio*telco-tech.de>}
2369 2369
 	\item Masahiro Teramoto \email{<markun*onohara.to>}
2370
+	\item Daniel Theodoro \email{<dtheodoro*ig.com.br>}
2370 2371
 	\item Ryan Thompson \email{<clamav*sasknow.com>}
2371 2372
 	\item Yar Tikhiy \email{<yar*comp.chem.msu.su>}
2372 2373
 	\item Michael L. Torrie \email{<torriem*chem.byu.edu>}
... ...
@@ -2374,8 +2410,10 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2374 2374
 	\item Matthew Trent \email{<mtrent*localaccess.com>}
2375 2375
 	\item Reini Urban \email{<rurban*x-ray.at>}
2376 2376
 	\item Daniel Mario Vega \email{<dv5a*dc.uba.ar>}
2377
+	\item Denis Vlasenko \email{<vda*ilport.com.ua>}
2377 2378
 	\item Laurent Wacrenier \email{<lwa*teaser.fr>}
2378 2379
 	\item Charlie Watts \email{<cewatts*brainstorminternet.net>}
2380
+	\item Florian Weimer \email{<fw*deneb.enyo.de>}
2379 2381
 	\item Paul Welsh \email{<paul*welshfamily.com>}
2380 2382
 	\item Nicklaus Wicker \email{<n.wicker*cnk-networks.de>}
2381 2383
 	\item David Woakes \email{<david*mitredata.co.uk>}
... ...
@@ -2409,10 +2447,12 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2409 2409
 	\item Cheahch from Singapore
2410 2410
 	\item Conexim Australia - business web hosting (\url{http://www.conexim.com.au})
2411 2411
 	\item Joe Cooper
2412
+	\item Ron DeFulio
2412 2413
 	\item Steve Donegan (\url{http://www.donegan.org/})
2413 2414
 	\item Dynamic Network Services, Inc (\url{http://www.dyndns.org/})
2414 2415
 	\item EAS Enterprises LLC
2415 2416
 	\item Electric Embers (\url{http://electricembers.net})
2417
+	\item John T. Ellis
2416 2418
 	\item Epublica
2417 2419
 	\item Bernhard Erdmann
2418 2420
 	\item David Eriksson (\url{http://www.2good.nu/})
... ...
@@ -2450,6 +2490,7 @@ level required:MD5 checksum:digital signature:builder name:build time (sec)
2450 2450
 	\item Mark Lotspaih (\url{http://www.lotcom.org/})
2451 2451
 	\item Michel Machado (\url{http://oss.digirati.com.br/})
2452 2452
 	\item Olivier Marechal
2453
+	\item Micro Logic Systems (\url{http://www.mls.nc/})
2453 2454
 	\item Midcoast Internet Solutions
2454 2455
 	\item Mimecast (\url{http://www.mimecast.com/})
2455 2456
 	\item Kazuhiro Miyaji
... ...
@@ -126,7 +126,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
126 126
 PACKAGE_VERSION = @PACKAGE_VERSION@
127 127
 PATH_SEPARATOR = @PATH_SEPARATOR@
128 128
 RANLIB = @RANLIB@
129
-SENDMAIL = @SENDMAIL@
130 129
 SET_MAKE = @SET_MAKE@
131 130
 SHELL = @SHELL@
132 131
 STRIP = @STRIP@
... ...
@@ -167,6 +166,7 @@ oldincludedir = @oldincludedir@
167 167
 prefix = @prefix@
168 168
 program_transform_name = @program_transform_name@
169 169
 sbindir = @sbindir@
170
+sendmailprog = @sendmailprog@
170 171
 sharedstatedir = @sharedstatedir@
171 172
 sysconfdir = @sysconfdir@
172 173
 target = @target@
... ...
@@ -153,7 +153,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
153 153
 PACKAGE_VERSION = @PACKAGE_VERSION@
154 154
 PATH_SEPARATOR = @PATH_SEPARATOR@
155 155
 RANLIB = @RANLIB@
156
-SENDMAIL = @SENDMAIL@
157 156
 SET_MAKE = @SET_MAKE@
158 157
 SHELL = @SHELL@
159 158
 STRIP = @STRIP@
... ...
@@ -194,6 +193,7 @@ oldincludedir = @oldincludedir@
194 194
 prefix = @prefix@
195 195
 program_transform_name = @program_transform_name@
196 196
 sbindir = @sbindir@
197
+sendmailprog = @sendmailprog@
197 198
 sharedstatedir = @sharedstatedir@
198 199
 sysconfdir = @sysconfdir@
199 200
 target = @target@
... ...
@@ -166,7 +166,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
166 166
 PACKAGE_VERSION = @PACKAGE_VERSION@
167 167
 PATH_SEPARATOR = @PATH_SEPARATOR@
168 168
 RANLIB = @RANLIB@
169
-SENDMAIL = @SENDMAIL@
170 169
 SET_MAKE = @SET_MAKE@
171 170
 SHELL = @SHELL@
172 171
 STRIP = @STRIP@
... ...
@@ -207,6 +206,7 @@ oldincludedir = @oldincludedir@
207 207
 prefix = @prefix@
208 208
 program_transform_name = @program_transform_name@
209 209
 sbindir = @sbindir@
210
+sendmailprog = @sendmailprog@
210 211
 sharedstatedir = @sharedstatedir@
211 212
 sysconfdir = @sysconfdir@
212 213
 target = @target@
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2003 - 2004 Tomasz Kojm <tkojm@clamav.net>
2
+ *  Copyright (C) 2003 - 2005 Tomasz Kojm <tkojm@clamav.net>
3 3
  *
4 4
  *  untgz() is based on public domain minitar utility by Charles G. Waldman
5 5
  *
... ...
@@ -77,6 +77,14 @@ int cli_untgz(int fd, const char *destdir)
77 77
 
78 78
 	    strncpy(name, block, 100);
79 79
 	    name[100] = '\0';
80
+
81
+	    if(strchr(name, '/')) {
82
+		cli_errmsg("Slash separators are not allowed in CVD.\n");
83
+		free(fullname);
84
+	        gzclose(infile);
85
+		return -1;
86
+	    }
87
+
80 88
 	    strcpy(fullname, destdir);
81 89
 	    strcat(fullname, "/");
82 90
 	    strcat(fullname, name);
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.238 2005/04/19 09:20:55 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.238+fixes 2005/04/19 09:20:55 nigelhorne Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -187,7 +187,7 @@ static	char	*rfc822comments(const char *in, char *out);
187 187
 static	int	rfc1341(message *m, const char *dir);
188 188
 #endif
189 189
 static	bool	usefulHeader(int commandNumber, const char *cmd);
190
-static	void	uufasttrack(message *m, const char *firstline, const char *dir, FILE *fin);
190
+static        int     uufasttrack(message *m, const char *firstline, const char *dir, FILE *fin);
191 191
 static	char	*getline(char *buffer, size_t len, FILE *fin);
192 192
 #ifdef	NEW_WORLD
193 193
 static	const	char	*cli_pmemstr(const char *haystack, size_t hs, const char *needle, size_t ns);
... ...
@@ -877,13 +877,15 @@ cli_parse_mbox(const char *dir, int desc, unsigned int options)
877 877
 			} else
878 878
 				lastLineWasEmpty = (bool)(buffer[0] == '\0');
879 879
 
880
-			if(isuuencodebegin(buffer))
880
+			if(isuuencodebegin(buffer)) {
881 881
 				/*
882 882
 				 * Fast track visa to uudecode.
883 883
 				 * TODO: binhex, yenc
884 884
 				 */
885
-				uufasttrack(m, buffer, dir, fd);
886
-			else
885
+				if(uufasttrack(m, buffer, dir, fd) < 0)
886
+					if(messageAddStr(m, buffer) < 0)
887
+					    break;
888
+			} else
887 889
 				if(messageAddStr(m, buffer) < 0)
888 890
 					break;
889 891
 		} while(fgets(buffer, sizeof(buffer) - 1, fd) != NULL);
... ...
@@ -1147,13 +1149,15 @@ parseEmailFile(FILE *fin, const table_t *rfc821, const char *firstLine, const ch
1147 1147
 				free(fullline);
1148 1148
 				fullline = NULL;
1149 1149
 			}
1150
-		} else if(line && isuuencodebegin(line))
1150
+		} else if(line && isuuencodebegin(line)) {
1151 1151
 			/*
1152 1152
 			 * Fast track visa to uudecode.
1153 1153
 			 * TODO: binhex, yenc
1154 1154
 			 */
1155
-			uufasttrack(ret, line, dir, fin);
1156
-		else
1155
+			if(uufasttrack(ret, line, dir, fin) < 0)
1156
+				if(messageAddStr(ret, line) < 0)
1157
+					break;
1158
+		} else
1157 1159
 			if(messageAddStr(ret, line) < 0)
1158 1160
 				break;
1159 1161
 	} while(getline(buffer, sizeof(buffer) - 1, fin) != NULL);
... ...
@@ -3840,14 +3844,18 @@ usefulHeader(int commandNumber, const char *cmd)
3840 3840
 /*
3841 3841
  * Save the uuencoded part of the file as it is read in since there's no need
3842 3842
  * to include it in the parse tree. Saves memory and parse time.
3843
+ * Return < 0 for failure
3843 3844
  */
3844
-static void
3845
+static int
3845 3846
 uufasttrack(message *m, const char *firstline, const char *dir, FILE *fin)
3846 3847
 {
3847 3848
 	fileblob *fb = fileblobCreate();
3848 3849
 	char buffer[LINE_LENGTH + 1];
3849 3850
 	char *filename = cli_strtok(firstline, 2, " ");
3850 3851
 
3852
+	if(filename == NULL)
3853
+		return -1;
3854
+
3851 3855
 	fileblobSetFilename(fb, dir, filename);
3852 3856
 	cli_dbgmsg("Fast track uudecode %s\n", filename);
3853 3857
 	free(filename);
... ...
@@ -3876,6 +3884,7 @@ uufasttrack(message *m, const char *firstline, const char *dir, FILE *fin)
3876 3876
 	}
3877 3877
 
3878 3878
 	fileblobDestroy(fb);
3879
+	return 1;
3879 3880
 }
3880 3881
 
3881 3882
 /*
... ...
@@ -80,38 +80,51 @@ short cli_debug_flag = 0, cli_leavetemps_flag = 0;
80 80
 
81 81
 static unsigned char oldmd5buff[16] = { 16, 38, 97, 12, 8, 4, 72, 196, 217, 144, 33, 124, 18, 11, 17, 253 };
82 82
 
83
+
83 84
 void cli_warnmsg(const char *str, ...)
84 85
 {
85 86
 	va_list args;
87
+	int sz = sizeof("LibClamAV Warning: ") - 1;
88
+	char buff[256];
86 89
 
90
+    strncpy(buff, "LibClamAV Warning: ", sz);
87 91
     va_start(args, str);
88
-    fprintf(stderr, "LibClamAV Warning: ");
89
-    vfprintf(stderr, str, args);
92
+    vsnprintf(buff + sz, sizeof(buff) - sz, str, args);
93
+    buff[sizeof(buff) - 1] = '\0';
94
+    fputs(buff, stderr);
90 95
     va_end(args);
91 96
 }
92 97
 
93 98
 void cli_errmsg(const char *str, ...)
94 99
 {
95 100
 	va_list args;
101
+	int sz = sizeof("LibClamAV Error: ") - 1;
102
+	char buff[256];
96 103
 
104
+    strncpy(buff, "LibClamAV Error: ", sz);
97 105
     va_start(args, str);
98
-    fprintf(stderr, "LibClamAV Error: ");
99
-    vfprintf(stderr, str, args);
106
+    vsnprintf(buff + sz, sizeof(buff) - sz, str, args);
107
+    buff[sizeof(buff) - 1] = '\0';
108
+    fputs(buff, stderr);
100 109
     va_end(args);
101 110
 }
102 111
 
103 112
 void cli_dbgmsg(const char *str, ...)
104 113
 {
105
-	va_list args;
106 114
 
107 115
     if(cli_debug_flag) {
116
+	    va_list args;
117
+	    int sz = sizeof("LibClamAV debug: ") - 1;
118
+	    char buff[256];
119
+
120
+	memcpy(buff, "LibClamAV debug: ", sz);
108 121
 	va_start(args, str);
109
-	fprintf(stderr, "LibClamAV debug: ");
110
-	vfprintf(stderr, str, args);
122
+	vsnprintf(buff + sz, sizeof(buff) - sz, str, args);
123
+	buff[sizeof(buff) - 1] = '\0';
124
+	fputs(buff, stderr);
111 125
 	va_end(args);
112 126
     } else
113 127
 	return;
114
-
115 128
 }
116 129
 
117 130
 void cl_debug(void)
... ...
@@ -587,6 +587,7 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const
587 587
 
588 588
     if(!(buff = (char *) cli_malloc(FILEBUFF))) {
589 589
 	cli_dbgmsg("GZip: Unable to malloc %d bytes.\n", FILEBUFF);
590
+	fclose(tmp);
590 591
 	gzclose(gd);
591 592
 	return CL_EMEM;
592 593
     }
... ...
@@ -759,6 +760,8 @@ static int cli_scanszdd(int desc, const char **virname, long int *scanned, const
759 759
 
760 760
     if(cli_msexpand(in, tmp) == -1) {
761 761
 	cli_dbgmsg("SZDD: msexpand failed.\n");
762
+	fclose(in);
763
+	fclose(tmp);
762 764
 	return CL_EMSCOMP;
763 765
     }
764 766
 
... ...
@@ -24,7 +24,7 @@
24 24
 #include "clamav-config.h"
25 25
 #endif
26 26
 
27
-static	char	const	rcsid[] = "$Id: tnef.c,v 1.22 2005/05/12 12:39:57 nigelhorne Exp $";
27
+static	char	const	rcsid[] = "$Id: tnef.c,v 1.24 2005/05/18 20:55:59 nigelhorne Exp $";
28 28
 
29 29
 #include <stdio.h>
30 30
 #include <fcntl.h>
... ...
@@ -184,6 +184,11 @@ cli_tnef(const char *dir, int desc)
184 184
 	} while(!alldone);
185 185
 
186 186
 	if(fb) {
187
+		cli_dbgmsg("cli_tnef: flushing final data\n");
188
+		if(fileblobGetFilename(fb) == NULL) {
189
+			cli_dbgmsg("Saving TNEF portion with an unknown name");
190
+			fileblobSetFilename(fb, dir, "tnef");
191
+		}
187 192
 		fileblobDestroy(fb);
188 193
 		fb = NULL;
189 194
 	}
... ...
@@ -194,6 +194,9 @@ zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode)
194 194
 	    case 6: /* implode */
195 195
             case 8: /* inflate */
196 196
 	    case 9: /* deflate */
197
+	    case 99: /* AES encrypted file: go on and try to unpack it (zip
198
+		      * headers are not reliable)
199
+		      */
197 200
                 break;
198 201
             default:
199 202
 		cli_dbgmsg("ZzipLib: Unsupported compression mode (%d)\n", hdr->d_compr);
... ...
@@ -151,7 +151,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
151 151
 PACKAGE_VERSION = @PACKAGE_VERSION@
152 152
 PATH_SEPARATOR = @PATH_SEPARATOR@
153 153
 RANLIB = @RANLIB@
154
-SENDMAIL = @SENDMAIL@
155 154
 SET_MAKE = @SET_MAKE@
156 155
 SHELL = @SHELL@
157 156
 STRIP = @STRIP@
... ...
@@ -192,6 +191,7 @@ oldincludedir = @oldincludedir@
192 192
 prefix = @prefix@
193 193
 program_transform_name = @program_transform_name@
194 194
 sbindir = @sbindir@
195
+sendmailprog = @sendmailprog@
195 196
 sharedstatedir = @sharedstatedir@
196 197
 sysconfdir = @sysconfdir@
197 198
 target = @target@