Browse code

backport changes for clamav-0.75.1

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

Sven Strickroth authored on 2007/02/18 23:00:13
Showing 12 changed files
... ...
@@ -62,6 +62,7 @@ Code patches submitted by (in alphabetical order):
62 62
 
63 63
 Kamil Andrusz <wizz*mniam.net>
64 64
 Patrick Bihan-Faou <patrick*mindstep.com>
65
+Martin Blapp <mb*imp.ch>
65 66
 Len Budney <lbudney*pobox.com>
66 67
 Andrey Cherezov <andrey*cherezov.koenig.su>
67 68
 Alex Cherney <alex*cher.id.au>
... ...
@@ -76,11 +77,13 @@ Jens Elkner <elkner*linofee.org>
76 76
 Jason Englander <jason*englanders.cc>
77 77
 Tony Finch <dot*dotat.at>
78 78
 David Ford <david+cert*blue-labs.org>
79
+Piotr Gackiewicz <gacek*intertele.pl>
79 80
 Dean Gaudet <dean-clamav*arctic.org>
80 81
 Michel Gaudet <Michel.Gaudet*ehess.fr>
81 82
 Philippe Gay <ph.gay*free.fr>
82 83
 Luca 'NERvOus' Gibelli <nervous*clamav.net>
83 84
 Scott Gifford <sgifford*suspectclass.com>
85
+Stephen Gran <steve*lobefin.net>
84 86
 Nigel Horne <njh*smsltd.demon.co.uk>
85 87
 Hrvoje Habjanic <hrvoje.habjanic*zg.hinet.hr>
86 88
 Robert Hogan <robert*roberthogan.net>
... ...
@@ -110,6 +113,7 @@ Masaki Ogawa <proc*mac.com>
110 110
 Phil Oleson <oz*nixil.net>
111 111
 Rudolph Pereira <r.pereira*isu.usyd.edu.au>
112 112
 Ed Phillips <ed*UDel.Edu>
113
+Pierre <pierrezero*fastmail.fm>
113 114
 Andreas Piesk <Andreas.Piesk*heise.de>
114 115
 Ant La Porte <ant*dvere.net>
115 116
 Thomas Quinot <thomas*cuivre.fr.eu.org>
... ...
@@ -1,3 +1,26 @@
1
+Thu Jul 29 14:17:42 CEST 2004
2
+-----------------------------
3
+  V 0.75.1, backported changes:
4
+
5
+  * freshclam/clamd:	    fix crash on PPC when LogFile was enabled together
6
+			    with LogSyslog
7
+  * configure:		    improve gethostbyname_r check; cleanups
8
+  * clamav-milter:	    Use GETHOSTBYNAME_R_6
9
+			    Better load balancing if max_children = 0
10
+  * clamdscan:		    fix stdin scanning in local mode (patch by Stephen
11
+			    Gran <steve*lobefin.net>)
12
+  * clamav-milter:	    %v in the template file handling is now replaced
13
+			    only with the virus name, no "stream:" appears
14
+  * libclamav/mbox.c:	    Fix crash when debugging on SPARC
15
+  * libclamav/message.c:    Fix occasional crash when scanning
16
+			    multipart within multipart e-mails
17
+  * clamav-milter:	    Fixed warning message when building on FreeBSD4.9
18
+			    Closed (small) memory leak
19
+			    Fix crash when the 1st remote service goes down
20
+			    Only use gethostbyname_r on LINUX for now
21
+			    Improved load balancing a bit
22
+
23
+
1 24
 Thu Jul 22 21:31:41 CEST 2004
2 25
 -----------------------------
3 26
   V 0.75, backported changes:
... ...
@@ -84,8 +84,14 @@
84 84
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
85 85
 #undef HAVE_FSEEKO
86 86
 
87
-/* Define to 1 if you have the `gethostbyname_r' function. */
88
-#undef HAVE_GETHOSTBYNAME_R
87
+/* gethostbyname_r takes 3 arguments */
88
+#undef HAVE_GETHOSTBYNAME_R_3
89
+
90
+/* gethostbyname_r takes 5 arguments */
91
+#undef HAVE_GETHOSTBYNAME_R_5
92
+
93
+/* gethostbyname_r takes 6 arguments */
94
+#undef HAVE_GETHOSTBYNAME_R_6
89 95
 
90 96
 /* Define to 1 if you have the `getpagesize' function. */
91 97
 #undef HAVE_GETPAGESIZE
... ...
@@ -105,6 +111,9 @@
105 105
 /* in_port_t is defined */
106 106
 #undef HAVE_IN_PORT_T
107 107
 
108
+/* Define to 1 if you have the <libmilter/mfapi.h> header file. */
109
+#undef HAVE_LIBMILTER_MFAPI_H
110
+
108 111
 /* Define to 1 if you have the <limits.h> header file. */
109 112
 #undef HAVE_LIMITS_H
110 113
 
... ...
@@ -439,6 +439,14 @@ Changes
439 439
 		machines running Solaris
440 440
 0.74f	22/7/04	Use gethostbyname_r() if available
441 441
 0.75	22/7/04	Up-issue
442
+0.75a	25/7/04	Fixed warning message when building on FreeBSD4.9
443
+		Closed (small) memory leak
444
+		Fix crash when the 1st remote service goes down
445
+		Only use gethostbyname_r on LINUX for now
446
+		Load balancing - improved a bit - but still some way to go
447
+0.75b	26/7/04	Template file: %v now prints the virus name without the trailer
448
+0.75c	29/7/04	Better load balancing if max_children = 0
449
+		Use HAVE_GETHOSTBYNAME_R_6
442 450
 
443 451
 BUG REPORTS
444 452
 
... ...
@@ -26,6 +26,15 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.111  2004/07/29 06:38:05  nigelhorne
30
+ * GETHOSTBYNAME_R_6
31
+ *
32
+ * Revision 1.110  2004/07/26 13:23:27  nigelhorne
33
+ * Remove stream: from template %v
34
+ *
35
+ * Revision 1.109  2004/07/25 11:51:42  nigelhorne
36
+ * Fix crash if 1st host dies
37
+ *
29 38
  * Revision 1.108  2004/07/22 15:45:03  nigelhorne
30 39
  * Up-issue
31 40
  *
... ...
@@ -335,9 +344,9 @@
335 335
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
336 336
  * Added -f flag use MaxThreads if --max-children not set
337 337
  */
338
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.108 2004/07/22 15:45:03 nigelhorne Exp $";
338
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.111 2004/07/29 06:38:05 nigelhorne Exp $";
339 339
 
340
-#define	CM_VERSION	"0.75"
340
+#define	CM_VERSION	"0.75c"
341 341
 
342 342
 /*#define	CONFDIR	"/usr/local/etc"*/
343 343
 
... ...
@@ -367,6 +376,7 @@ static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.108 2004/07/22 15:45:03 ni
367 367
 #include <string.h>
368 368
 #include <sys/wait.h>
369 369
 #include <assert.h>
370
+#include <netinet/in.h>
370 371
 #include <arpa/inet.h>
371 372
 #include <sys/socket.h>
372 373
 #include <sys/un.h>
... ...
@@ -375,7 +385,6 @@ static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.108 2004/07/22 15:45:03 ni
375 375
 #include <libmilter/mfapi.h>
376 376
 #include <pthread.h>
377 377
 #include <sys/time.h>
378
-#include <netinet/in.h>
379 378
 #include <signal.h>
380 379
 #include <regex.h>
381 380
 #include <fcntl.h>
... ...
@@ -483,7 +492,7 @@ static	void	header_list_add(header_list_t list, const char *headerf, const char
483 483
 static	void	header_list_print(header_list_t list, FILE *fp);
484 484
 static	int	connect2clamd(struct privdata *privdata);
485 485
 static	void	checkClamd(void);
486
-static	int	sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *clamdMessage);
486
+static	int	sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *virusname);
487 487
 static	void	setsubject(SMFICTX *ctx, const char *virusname);
488 488
 
489 489
 static	char	clamav_version[128];
... ...
@@ -1104,7 +1113,7 @@ main(int argc, char **argv)
1104 1104
 			if(pingServer(i))
1105 1105
 				activeServers++;
1106 1106
 			else {
1107
-				cli_warnmsg("Warning Can't talk to clamd server %s on port %d\n",
1107
+				cli_warnmsg("Can't talk to clamd server %s on port %d\n",
1108 1108
 					hostname, tcpSocket);
1109 1109
 			}
1110 1110
 			free(hostname);
... ...
@@ -1355,7 +1364,7 @@ static int
1355 1355
 findServer(void)
1356 1356
 {
1357 1357
 	struct sockaddr_in *servers, *server;
1358
-	int *socks, maxsock = 0, i;
1358
+	int *socks, maxsock = 0, i, j;
1359 1359
 	fd_set rfds;
1360 1360
 	struct timeval tv;
1361 1361
 	int retval;
... ...
@@ -1371,12 +1380,20 @@ findServer(void)
1371 1371
 
1372 1372
 	FD_ZERO(&rfds);
1373 1373
 
1374
+	if(max_children > 0)
1375
+		j = n_children - 1;	/* Don't worry about no lock */
1376
+	else
1377
+		j = cl_rndnum(numServers) - 1;
1378
+
1374 1379
 	for(i = 0, server = servers; i < numServers; i++, server++) {
1375 1380
 		int sock;
1376 1381
 
1377 1382
 		server->sin_family = AF_INET;
1378 1383
 		server->sin_port = (in_port_t)htons(tcpSocket);
1379
-		server->sin_addr.s_addr = serverIPs[i];
1384
+		server->sin_addr.s_addr = serverIPs[(i + j) % numServers];
1385
+
1386
+		cli_dbgmsg("findServer: try server %d\n",
1387
+			(i + j) % numServers);
1380 1388
 
1381 1389
 		sock = socks[i] = socket(AF_INET, SOCK_STREAM, 0);
1382 1390
 		if(sock < 0) {
... ...
@@ -1392,14 +1409,15 @@ findServer(void)
1392 1392
 
1393 1393
 		if((connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr)) < 0) ||
1394 1394
 		   (send(sock, "PING\n", 5, 0) < 5)) {
1395
-			const char *hostname = cli_strtok(serverHostNames, i, ":");
1395
+			char *hostname = cli_strtok(serverHostNames, i, ":");
1396 1396
 			cli_warnmsg("Check clamd server %s - it may be down\n", hostname);
1397 1397
 			if(use_syslog)
1398 1398
 				syslog(LOG_WARNING,
1399 1399
 					"Check clamd server %s - it may be down",
1400 1400
 					hostname);
1401
-			socks[i] = -1;
1402 1401
 			close(sock);
1402
+			free(hostname);
1403
+			socks[i] = -1;
1403 1404
 			continue;
1404 1405
 		}
1405 1406
 
... ...
@@ -1437,10 +1455,12 @@ findServer(void)
1437 1437
 	}
1438 1438
 
1439 1439
 	for(i = 0; i < numServers; i++)
1440
-		if(FD_ISSET(socks[i], &rfds)) {
1440
+		if((socks[i] >= 0) && (FD_ISSET(socks[i], &rfds))) {
1441
+			const int server = (i + j) % numServers;
1442
+
1441 1443
 			free(socks);
1442
-			cli_dbgmsg("findServer: using server %d\n", i);
1443
-			return i;
1444
+			cli_dbgmsg("findServer: using server %d\n", server);
1445
+			return server;
1444 1446
 		}
1445 1447
 
1446 1448
 	free(socks);
... ...
@@ -1508,7 +1528,11 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1508 1508
 	 */
1509 1509
 	if(strncasecmp(port, "inet:", 5) == 0) {
1510 1510
 		const char *hostmail;
1511
-#ifdef	HAVE_GETHOSTBYNAME_R
1511
+		/*
1512
+		 * TODO: gethostbyname_r is non-standard so different operating
1513
+		 * systems do it in different ways. Need more examples
1514
+		 */
1515
+#ifdef	HAVE_GETHOSTBYNAME_R_6
1512 1516
 		struct hostent *hp, hostent;
1513 1517
 		char buf[BUFSIZ];
1514 1518
 		int ret;
... ...
@@ -1527,7 +1551,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1527 1527
 			hostmail = "unknown";
1528 1528
 		}
1529 1529
 
1530
-#ifdef	HAVE_GETHOSTBYNAME_R
1530
+#ifdef	HAVE_GETHOSTBYNAME_R_6
1531 1531
 		if(gethostbyname_r(hostmail, &hostent, buf, sizeof(buf), &hp, &ret) != 0) {
1532 1532
 			if(use_syslog)
1533 1533
 				syslog(LOG_WARNING, "Access Denied: Host Unknown (%s)", hostname);
... ...
@@ -2009,6 +2033,11 @@ clamfi_eom(SMFICTX *ctx)
2009 2009
 			syslog(LOG_DEBUG, "clamfi_eom: read %s", mess);
2010 2010
 		cli_dbgmsg("clamfi_eom: read %s\n", mess);
2011 2011
 	} else {
2012
+		/*
2013
+		 * TODO: if more than one host has been specified, try
2014
+		 * another one - setting cl_error to SMFIS_TEMPFAIL helps
2015
+		 * by forcing a retry
2016
+		 */
2012 2017
 		clamfi_cleanup(ctx);
2013 2018
 		syslog(LOG_NOTICE, "clamfi_eom: read nothing from clamd");
2014 2019
 #ifdef	CL_DEBUG
... ...
@@ -2183,6 +2212,16 @@ clamfi_eom(SMFICTX *ctx)
2183 2183
 			 * item in the queue so there's no scanning of two
2184 2184
 			 * messages at once. It'll still be scanned, but
2185 2185
 			 * not at the same time as the incoming message
2186
+			 *
2187
+			 * FIXME: there is a race condition here. If the
2188
+			 * system is very overloaded this sendmail can
2189
+			 * take a long time to start - and may even fail
2190
+			 * is the LA is > REFUSE_LA. In all the time we're
2191
+			 * taking to start this sendmail, the sendmail that's
2192
+			 * started us may timeout waiting for a response and
2193
+			 * let the virus through (albeit tagged with
2194
+			 * X-Virus-Status: Infected) because we haven't
2195
+			 * sent SMFIS_DISCARD or SMFIS_REJECT
2186 2196
 			 */
2187 2197
 			snprintf(cmd, sizeof(cmd) - 1,
2188 2198
 				(oflag || fflag) ? "%s -t -odq" : "%s -t",
... ...
@@ -2232,7 +2271,7 @@ clamfi_eom(SMFICTX *ctx)
2232 2232
 				fputs("Subject: Virus intercepted\n\n", sendmail);
2233 2233
 
2234 2234
 				if((templatefile == NULL) ||
2235
-				   (sendtemplate(ctx, templatefile, sendmail, mess) < 0)) {
2235
+				   (sendtemplate(ctx, templatefile, sendmail, virusname) < 0)) {
2236 2236
 					if(bflag)
2237 2237
 						fputs("A message you sent to\n", sendmail);
2238 2238
 					else if(pflag)
... ...
@@ -2470,9 +2509,7 @@ clamfi_free(struct privdata *privdata)
2470 2470
 		cli_dbgmsg("pthread_cond_broadcast\n");
2471 2471
 #endif
2472 2472
 		pthread_cond_broadcast(&n_children_cond);
2473
-#ifdef	CL_DEBUG
2474 2473
 		cli_dbgmsg("<n_children = %d\n", n_children);
2475
-#endif
2476 2474
 		pthread_mutex_unlock(&n_children_mutex);
2477 2475
 	}
2478 2476
 }
... ...
@@ -3000,15 +3037,16 @@ checkClamd(void)
3000 3000
  * Send a templated message about an intercepted message. Very basic for
3001 3001
  * now, just to prove it works, will enhance the flexability later, only
3002 3002
  * supports %v and {sendmail_variables} at present. And only one instance of
3003
- * %v at that.
3003
+ * %v or {sendmail_variable} at that.
3004 3004
  *
3005 3005
  * TODO: more template features
3006 3006
  * TODO: allow filename to start with a '|' taken to mean the output of
3007 3007
  *	a program
3008 3008
  * TODO: allow { to be escaped with a \ character
3009
+ * TODO: allow more than one substitution in a file
3009 3010
  */
3010 3011
 static int
3011
-sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *clamdMessage)
3012
+sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *virusname)
3012 3013
 {
3013 3014
 	FILE *fin = fopen(filename, "r");
3014 3015
 	struct stat statb;
... ...
@@ -3042,14 +3080,14 @@ sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *cla
3042 3042
 	fread(buf, sizeof(char), statb.st_size, fin);
3043 3043
 	fclose(fin);
3044 3044
 	buf[statb.st_size] = '\0';
3045
+	rc = 0;
3045 3046
 
3046 3047
 	/* FIXME: \%v should be %%v */
3047 3048
 	if(((ptr = strstr(buf, "%v")) != NULL) && (strstr(buf, "\\%v") == NULL)) {
3048 3049
 		*ptr = '\0';
3049 3050
 		ptr = &ptr[2];
3050 3051
 		fputs(buf, sendmail);
3051
-		/* Need to peel out the virus name and just send that */
3052
-		fputs(clamdMessage, sendmail);
3052
+		fputs(virusname, sendmail);
3053 3053
 		rc = (fputs(ptr, sendmail) == EOF) ? -1 : 0;
3054 3054
 	} else if((ptr = strchr(buf, '{')) && (ptr2 = strchr(ptr, '}'))) {
3055 3055
 		char *var;
... ...
@@ -3076,7 +3114,7 @@ sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *cla
3076 3076
 
3077 3077
 	free(buf);
3078 3078
 
3079
-	return 0;
3079
+	return rc;
3080 3080
 }
3081 3081
 
3082 3082
 /*
... ...
@@ -138,7 +138,17 @@ int dsstream(int sockd)
138 138
 	return -1;
139 139
     }
140 140
 
141
-    server.sin_addr.s_addr = peer.sin_addr.s_addr;
141
+    switch (peer.sin_family) {
142
+	case AF_UNIX:
143
+	    server.sin_addr.s_addr = inet_addr("127.0.0.1");
144
+	    break;
145
+	case AF_INET:
146
+	    server.sin_addr.s_addr = peer.sin_addr.s_addr;
147
+	    break;
148
+	default:
149
+	    mprintf("@Unexpected socket type: %d.\n", peer.sin_family);
150
+	    return -1;
151
+    }
142 152
 
143 153
     if(connect(wsockd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) < 0) {
144 154
 	close(wsockd);
... ...
@@ -1017,7 +1017,7 @@ Optional Features:
1017 1017
   --disable-libtool-lock  avoid locking (might break parallel builds)
1018 1018
   --disable-bzip2	  Disable bzip2 support.
1019 1019
   --disable-clamuko	  Disable clamuko support (Linux and FreeBSD only)
1020
-  --enable-milter	  Build clamav-milter (if milter library found)
1020
+  --enable-milter	  Build clamav-milter
1021 1021
   --disable-dsig	  Disable digital signature support.
1022 1022
   --disable-pthreads      Disable POSIX threads support
1023 1023
   --disable-cr      Don't link with C reentrant library (BSD)
... ...
@@ -2055,7 +2055,7 @@ fi
2055 2055
 
2056 2056
 # Define the identity of the package.
2057 2057
  PACKAGE=clamav
2058
- VERSION="0.75"
2058
+ VERSION="0.75.1"
2059 2059
 
2060 2060
 
2061 2061
 cat >>confdefs.h <<_ACEOF
... ...
@@ -8974,8 +8974,7 @@ _ACEOF
8974 8974
 
8975 8975
 
8976 8976
 
8977
-
8978
-for ac_func in poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop setgroups initgroups gethostbyname_r
8977
+for ac_func in poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop setgroups initgroups
8979 8978
 do
8980 8979
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8981 8980
 echo "$as_me:$LINENO: checking for $ac_func" >&5
... ...
@@ -9674,7 +9673,6 @@ _ACEOF
9674 9674
 fi
9675 9675
 
9676 9676
 
9677
-# Check for broken snprintf
9678 9677
 if test "x$ac_cv_func_snprintf" = "xyes" ; then
9679 9678
         echo "$as_me:$LINENO: checking whether snprintf correctly terminates long strings" >&5
9680 9679
 echo $ECHO_N "checking whether snprintf correctly terminates long strings... $ECHO_C" >&6
... ...
@@ -10018,7 +10016,9 @@ cat >>confdefs.h <<\_ACEOF
10018 10018
 _ACEOF
10019 10019
 
10020 10020
 else
10021
-  echo "Please install zlib and zlib-devel packages."; exit 1
10021
+  { { echo "$as_me:$LINENO: error: Please install zlib and zlib-devel packages" >&5
10022
+echo "$as_me: error: Please install zlib and zlib-devel packages" >&2;}
10023
+   { (exit 1); exit 1; }; }
10022 10024
 fi
10023 10025
 
10024 10026
 
... ...
@@ -10032,6 +10032,77 @@ fi;
10032 10032
 
10033 10033
 if test "$want_bzip2" = "yes"
10034 10034
 then
10035
+    echo "$as_me:$LINENO: checking for bzReadOpen in -lbz2" >&5
10036
+echo $ECHO_N "checking for bzReadOpen in -lbz2... $ECHO_C" >&6
10037
+if test "${ac_cv_lib_bz2_bzReadOpen+set}" = set; then
10038
+  echo $ECHO_N "(cached) $ECHO_C" >&6
10039
+else
10040
+  ac_check_lib_save_LIBS=$LIBS
10041
+LIBS="-lbz2  $LIBS"
10042
+cat >conftest.$ac_ext <<_ACEOF
10043
+/* confdefs.h.  */
10044
+_ACEOF
10045
+cat confdefs.h >>conftest.$ac_ext
10046
+cat >>conftest.$ac_ext <<_ACEOF
10047
+/* end confdefs.h.  */
10048
+
10049
+/* Override any gcc2 internal prototype to avoid an error.  */
10050
+#ifdef __cplusplus
10051
+extern "C"
10052
+#endif
10053
+/* We use char because int might match the return type of a gcc2
10054
+   builtin and then its argument prototype would still apply.  */
10055
+char bzReadOpen ();
10056
+int
10057
+main ()
10058
+{
10059
+bzReadOpen ();
10060
+  ;
10061
+  return 0;
10062
+}
10063
+_ACEOF
10064
+rm -f conftest.$ac_objext conftest$ac_exeext
10065
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
10066
+  (eval $ac_link) 2>conftest.er1
10067
+  ac_status=$?
10068
+  grep -v '^ *+' conftest.er1 >conftest.err
10069
+  rm -f conftest.er1
10070
+  cat conftest.err >&5
10071
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10072
+  (exit $ac_status); } &&
10073
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10074
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10075
+  (eval $ac_try) 2>&5
10076
+  ac_status=$?
10077
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10078
+  (exit $ac_status); }; } &&
10079
+	 { ac_try='test -s conftest$ac_exeext'
10080
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10081
+  (eval $ac_try) 2>&5
10082
+  ac_status=$?
10083
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10084
+  (exit $ac_status); }; }; then
10085
+  ac_cv_lib_bz2_bzReadOpen=yes
10086
+else
10087
+  echo "$as_me: failed program was:" >&5
10088
+sed 's/^/| /' conftest.$ac_ext >&5
10089
+
10090
+ac_cv_lib_bz2_bzReadOpen=no
10091
+fi
10092
+rm -f conftest.err conftest.$ac_objext \
10093
+      conftest$ac_exeext conftest.$ac_ext
10094
+LIBS=$ac_check_lib_save_LIBS
10095
+fi
10096
+echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_bzReadOpen" >&5
10097
+echo "${ECHO_T}$ac_cv_lib_bz2_bzReadOpen" >&6
10098
+if test $ac_cv_lib_bz2_bzReadOpen = yes; then
10099
+
10100
+cat >>confdefs.h <<\_ACEOF
10101
+#define NOBZ2PREFIX 1
10102
+_ACEOF
10103
+
10104
+fi
10105
+
10035 10106
     if test "${ac_cv_header_bzlib_h+set}" = set; then
10036 10107
   echo "$as_me:$LINENO: checking for bzlib.h" >&5
10037 10108
 echo $ECHO_N "checking for bzlib.h... $ECHO_C" >&6
... ...
@@ -10175,81 +10246,11 @@ cat >>confdefs.h <<\_ACEOF
10175 10175
 _ACEOF
10176 10176
 
10177 10177
 else
10178
-  echo "WARNING: Bzip2 support disabled"
10178
+  { echo "$as_me:$LINENO: WARNING: ****** bzip2 support disabled" >&5
10179
+echo "$as_me: WARNING: ****** bzip2 support disabled" >&2;}
10179 10180
 fi
10180 10181
 
10181 10182
 
10182
-    echo "$as_me:$LINENO: checking for bzReadOpen in -lbz2" >&5
10183
-echo $ECHO_N "checking for bzReadOpen in -lbz2... $ECHO_C" >&6
10184
-if test "${ac_cv_lib_bz2_bzReadOpen+set}" = set; then
10185
-  echo $ECHO_N "(cached) $ECHO_C" >&6
10186
-else
10187
-  ac_check_lib_save_LIBS=$LIBS
10188
-LIBS="-lbz2  $LIBS"
10189
-cat >conftest.$ac_ext <<_ACEOF
10190
-/* confdefs.h.  */
10191
-_ACEOF
10192
-cat confdefs.h >>conftest.$ac_ext
10193
-cat >>conftest.$ac_ext <<_ACEOF
10194
-/* end confdefs.h.  */
10195
-
10196
-/* Override any gcc2 internal prototype to avoid an error.  */
10197
-#ifdef __cplusplus
10198
-extern "C"
10199
-#endif
10200
-/* We use char because int might match the return type of a gcc2
10201
-   builtin and then its argument prototype would still apply.  */
10202
-char bzReadOpen ();
10203
-int
10204
-main ()
10205
-{
10206
-bzReadOpen ();
10207
-  ;
10208
-  return 0;
10209
-}
10210
-_ACEOF
10211
-rm -f conftest.$ac_objext conftest$ac_exeext
10212
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
10213
-  (eval $ac_link) 2>conftest.er1
10214
-  ac_status=$?
10215
-  grep -v '^ *+' conftest.er1 >conftest.err
10216
-  rm -f conftest.er1
10217
-  cat conftest.err >&5
10218
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10219
-  (exit $ac_status); } &&
10220
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10221
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10222
-  (eval $ac_try) 2>&5
10223
-  ac_status=$?
10224
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10225
-  (exit $ac_status); }; } &&
10226
-	 { ac_try='test -s conftest$ac_exeext'
10227
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10228
-  (eval $ac_try) 2>&5
10229
-  ac_status=$?
10230
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10231
-  (exit $ac_status); }; }; then
10232
-  ac_cv_lib_bz2_bzReadOpen=yes
10233
-else
10234
-  echo "$as_me: failed program was:" >&5
10235
-sed 's/^/| /' conftest.$ac_ext >&5
10236
-
10237
-ac_cv_lib_bz2_bzReadOpen=no
10238
-fi
10239
-rm -f conftest.err conftest.$ac_objext \
10240
-      conftest$ac_exeext conftest.$ac_ext
10241
-LIBS=$ac_check_lib_save_LIBS
10242
-fi
10243
-echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_bzReadOpen" >&5
10244
-echo "${ECHO_T}$ac_cv_lib_bz2_bzReadOpen" >&6
10245
-if test $ac_cv_lib_bz2_bzReadOpen = yes; then
10246
-
10247
-cat >>confdefs.h <<\_ACEOF
10248
-#define NOBZ2PREFIX 1
10249
-_ACEOF
10250
-
10251
-fi
10252
-
10253 10183
 fi
10254 10184
 
10255 10185
 want_clamuko="yes"
... ...
@@ -10324,153 +10325,10 @@ _ACEOF
10324 10324
 fi
10325 10325
 
10326 10326
 
10327
-have_milter="no"
10328
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10329
-  echo "$as_me:$LINENO: checking for libmilter/mfapi.h" >&5
10330
-echo $ECHO_N "checking for libmilter/mfapi.h... $ECHO_C" >&6
10331
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10332
-  echo $ECHO_N "(cached) $ECHO_C" >&6
10333
-fi
10334
-echo "$as_me:$LINENO: result: $ac_cv_header_libmilter_mfapi_h" >&5
10335
-echo "${ECHO_T}$ac_cv_header_libmilter_mfapi_h" >&6
10336
-else
10337
-  # Is the header compilable?
10338
-echo "$as_me:$LINENO: checking libmilter/mfapi.h usability" >&5
10339
-echo $ECHO_N "checking libmilter/mfapi.h usability... $ECHO_C" >&6
10340
-cat >conftest.$ac_ext <<_ACEOF
10341
-/* confdefs.h.  */
10342
-_ACEOF
10343
-cat confdefs.h >>conftest.$ac_ext
10344
-cat >>conftest.$ac_ext <<_ACEOF
10345
-/* end confdefs.h.  */
10346
-$ac_includes_default
10347
-#include <libmilter/mfapi.h>
10348
-_ACEOF
10349
-rm -f conftest.$ac_objext
10350
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10351
-  (eval $ac_compile) 2>conftest.er1
10352
-  ac_status=$?
10353
-  grep -v '^ *+' conftest.er1 >conftest.err
10354
-  rm -f conftest.er1
10355
-  cat conftest.err >&5
10356
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10357
-  (exit $ac_status); } &&
10358
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10359
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10360
-  (eval $ac_try) 2>&5
10361
-  ac_status=$?
10362
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10363
-  (exit $ac_status); }; } &&
10364
-	 { ac_try='test -s conftest.$ac_objext'
10365
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10366
-  (eval $ac_try) 2>&5
10367
-  ac_status=$?
10368
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10369
-  (exit $ac_status); }; }; then
10370
-  ac_header_compiler=yes
10371
-else
10372
-  echo "$as_me: failed program was:" >&5
10373
-sed 's/^/| /' conftest.$ac_ext >&5
10374
-
10375
-ac_header_compiler=no
10376
-fi
10377
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10378
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
10379
-echo "${ECHO_T}$ac_header_compiler" >&6
10380
-
10381
-# Is the header present?
10382
-echo "$as_me:$LINENO: checking libmilter/mfapi.h presence" >&5
10383
-echo $ECHO_N "checking libmilter/mfapi.h presence... $ECHO_C" >&6
10384
-cat >conftest.$ac_ext <<_ACEOF
10385
-/* confdefs.h.  */
10386
-_ACEOF
10387
-cat confdefs.h >>conftest.$ac_ext
10388
-cat >>conftest.$ac_ext <<_ACEOF
10389
-/* end confdefs.h.  */
10390
-#include <libmilter/mfapi.h>
10391
-_ACEOF
10392
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
10393
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
10394
-  ac_status=$?
10395
-  grep -v '^ *+' conftest.er1 >conftest.err
10396
-  rm -f conftest.er1
10397
-  cat conftest.err >&5
10398
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10399
-  (exit $ac_status); } >/dev/null; then
10400
-  if test -s conftest.err; then
10401
-    ac_cpp_err=$ac_c_preproc_warn_flag
10402
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
10403
-  else
10404
-    ac_cpp_err=
10405
-  fi
10406
-else
10407
-  ac_cpp_err=yes
10408
-fi
10409
-if test -z "$ac_cpp_err"; then
10410
-  ac_header_preproc=yes
10411
-else
10412
-  echo "$as_me: failed program was:" >&5
10413
-sed 's/^/| /' conftest.$ac_ext >&5
10414
-
10415
-  ac_header_preproc=no
10416
-fi
10417
-rm -f conftest.err conftest.$ac_ext
10418
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
10419
-echo "${ECHO_T}$ac_header_preproc" >&6
10420
-
10421
-# So?  What about this header?
10422
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
10423
-  yes:no: )
10424
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: accepted by the compiler, rejected by the preprocessor!" >&5
10425
-echo "$as_me: WARNING: libmilter/mfapi.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
10426
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: proceeding with the compiler's result" >&5
10427
-echo "$as_me: WARNING: libmilter/mfapi.h: proceeding with the compiler's result" >&2;}
10428
-    ac_header_preproc=yes
10429
-    ;;
10430
-  no:yes:* )
10431
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: present but cannot be compiled" >&5
10432
-echo "$as_me: WARNING: libmilter/mfapi.h: present but cannot be compiled" >&2;}
10433
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h:     check for missing prerequisite headers?" >&5
10434
-echo "$as_me: WARNING: libmilter/mfapi.h:     check for missing prerequisite headers?" >&2;}
10435
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: see the Autoconf documentation" >&5
10436
-echo "$as_me: WARNING: libmilter/mfapi.h: see the Autoconf documentation" >&2;}
10437
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h:     section \"Present But Cannot Be Compiled\"" >&5
10438
-echo "$as_me: WARNING: libmilter/mfapi.h:     section \"Present But Cannot Be Compiled\"" >&2;}
10439
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: proceeding with the preprocessor's result" >&5
10440
-echo "$as_me: WARNING: libmilter/mfapi.h: proceeding with the preprocessor's result" >&2;}
10441
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: in the future, the compiler will take precedence" >&5
10442
-echo "$as_me: WARNING: libmilter/mfapi.h: in the future, the compiler will take precedence" >&2;}
10443
-    (
10444
-      cat <<\_ASBOX
10445
-## ------------------------------------------ ##
10446
-## Report this to the AC_PACKAGE_NAME lists.  ##
10447
-## ------------------------------------------ ##
10448
-_ASBOX
10449
-    ) |
10450
-      sed "s/^/$as_me: WARNING:     /" >&2
10451
-    ;;
10452
-esac
10453
-echo "$as_me:$LINENO: checking for libmilter/mfapi.h" >&5
10454
-echo $ECHO_N "checking for libmilter/mfapi.h... $ECHO_C" >&6
10455
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10456
-  echo $ECHO_N "(cached) $ECHO_C" >&6
10457
-else
10458
-  ac_cv_header_libmilter_mfapi_h=$ac_header_preproc
10459
-fi
10460
-echo "$as_me:$LINENO: result: $ac_cv_header_libmilter_mfapi_h" >&5
10461
-echo "${ECHO_T}$ac_cv_header_libmilter_mfapi_h" >&6
10462
-
10463
-fi
10464
-if test $ac_cv_header_libmilter_mfapi_h = yes; then
10465
-  have_milter="yes"
10466
-fi
10467
-
10468
-
10469
-
10470 10327
 # Check whether --enable-milter or --disable-milter was given.
10471 10328
 if test "${enable_milter+set}" = set; then
10472 10329
   enableval="$enable_milter"
10473
-
10330
+  have_milter=$enableval
10474 10331
 else
10475 10332
   have_milter="no"
10476 10333
 fi;
... ...
@@ -10624,7 +10482,8 @@ cat >>confdefs.h <<\_ACEOF
10624 10624
 _ACEOF
10625 10625
 
10626 10626
 else
10627
-  echo "WARNING: GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !"; want_dsig="no"
10627
+  { echo "$as_me:$LINENO: WARNING: ****** GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !" >&5
10628
+echo "$as_me: WARNING: ****** GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !" >&2;}; want_dsig="no"
10628 10629
 fi
10629 10630
 
10630 10631
 fi
... ...
@@ -10929,7 +10788,6 @@ _ACEOF
10929 10929
 DBDIR="$db_dir"
10930 10930
 
10931 10931
 
10932
-# config file
10933 10932
 cfg_dir=`echo $sysconfdir | grep prefix`
10934 10933
 
10935 10934
 if test -n "$cfg_dir"; then
... ...
@@ -10972,7 +10830,6 @@ else
10972 10972
 fi
10973 10973
 
10974 10974
 
10975
-# check for in_port_t definition
10976 10975
 if test "$cross_compiling" = yes; then
10977 10976
   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
10978 10977
 See \`config.log' for more details." >&5
... ...
@@ -11040,7 +10897,7 @@ cat >>confdefs.h <<\_ACEOF
11040 11040
 #define _REENTRANT 1
11041 11041
 _ACEOF
11042 11042
 
11043
-	CLAMD_LIBS="-lpthread"
11043
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
11044 11044
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
11045 11045
 	if test "$want_clamuko" = "yes"; then
11046 11046
 
... ...
@@ -11049,7 +10906,7 @@ cat >>confdefs.h <<\_ACEOF
11049 11049
 _ACEOF
11050 11050
 
11051 11051
 	fi
11052
-	CLAMSCAN_LIBS="-lpthread"
11052
+	CLAMSCAN_LIBS="$CLAMSCAN_LIBS -lpthread"
11053 11053
     fi
11054 11054
     ;;
11055 11055
 cygwin*)
... ...
@@ -11079,11 +10936,11 @@ _ACEOF
11079 11079
     fi
11080 11080
     ;;
11081 11081
 solaris*)
11082
-    FRESHCLAM_LIBS="-lsocket -lnsl -lresolv"
11082
+    FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
11083 11083
     if test "$have_pthreads" = "yes"; then
11084 11084
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
11085
-	CLAMD_LIBS="-lpthread -lsocket -lnsl -lresolv"
11086
-	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread -lsocket -lnsl -lresolv"
11085
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread -lresolv"
11086
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread -lresolv"
11087 11087
 	TH_SAFE="-thread-safe"
11088 11088
 
11089 11089
 cat >>confdefs.h <<\_ACEOF
... ...
@@ -11105,7 +10962,7 @@ _ACEOF
11105 11105
 freebsd*)
11106 11106
     if test "$have_pthreads" = "yes"; then
11107 11107
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread -lc_r"
11108
-	CLAMD_LIBS="-pthread -lc_r"
11108
+	CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
11109 11109
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
11110 11110
 	TH_SAFE="-thread-safe"
11111 11111
 
... ...
@@ -11136,7 +10993,7 @@ openbsd3.3*)
11136 11136
     if test "$have_pthreads" = "yes"; then
11137 11137
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
11138 11138
 	if test "$disable_cr" = "yes"; then
11139
-	    CLAMD_LIBS="-pthread"
11139
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread"
11140 11140
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
11141 11141
 	fi
11142 11142
 	TH_SAFE="-thread-safe"
... ...
@@ -11161,10 +11018,10 @@ openbsd*)
11161 11161
     if test "$have_pthreads" = "yes"; then
11162 11162
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
11163 11163
 	if test "$disable_cr" = "yes"; then
11164
-	    CLAMD_LIBS="-pthread"
11164
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread"
11165 11165
 	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
11166 11166
 	else
11167
-	    CLAMD_LIBS="-pthread -lc_r"
11167
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
11168 11168
 	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
11169 11169
 	fi
11170 11170
 	TH_SAFE="-thread-safe"
... ...
@@ -11242,14 +11099,11 @@ _ACEOF
11242 11242
     use_netinfo="yes"
11243 11243
     ;;
11244 11244
 sco*)
11245
-        FRESHCLAM_LIBS="-lsocket"
11246
-    CLAMD_LIBS="-lsocket"
11247
-    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
11248
-    ;;
11245
+                    ;;
11249 11246
 hpux*)
11250 11247
     if test "$have_pthreads" = "yes"; then
11251 11248
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
11252
-	CLAMD_LIBS="-lpthread"
11249
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
11253 11250
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
11254 11251
 	TH_SAFE="-thread-safe"
11255 11252
 
... ...
@@ -11272,7 +11126,7 @@ _ACEOF
11272 11272
 aix*)
11273 11273
     if test "$have_pthreads" = "yes"; then
11274 11274
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
11275
-	CLAMD_LIBS="-lpthread"
11275
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
11276 11276
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
11277 11277
 	TH_SAFE="-thread-safe"
11278 11278
 
... ...
@@ -11295,7 +11149,7 @@ _ACEOF
11295 11295
 irix*)
11296 11296
     if test "$have_pthreads" = "yes"; then
11297 11297
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
11298
-	CLAMD_LIBS="-lpthread"
11298
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
11299 11299
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
11300 11300
 	TH_SAFE="-thread-safe"
11301 11301
 
... ...
@@ -11352,6 +11206,575 @@ esac
11352 11352
 
11353 11353
 
11354 11354
 
11355
+echo "$as_me:$LINENO: checking for bind in -lsocket" >&5
11356
+echo $ECHO_N "checking for bind in -lsocket... $ECHO_C" >&6
11357
+if test "${ac_cv_lib_socket_bind+set}" = set; then
11358
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11359
+else
11360
+  ac_check_lib_save_LIBS=$LIBS
11361
+LIBS="-lsocket  $LIBS"
11362
+cat >conftest.$ac_ext <<_ACEOF
11363
+/* confdefs.h.  */
11364
+_ACEOF
11365
+cat confdefs.h >>conftest.$ac_ext
11366
+cat >>conftest.$ac_ext <<_ACEOF
11367
+/* end confdefs.h.  */
11368
+
11369
+/* Override any gcc2 internal prototype to avoid an error.  */
11370
+#ifdef __cplusplus
11371
+extern "C"
11372
+#endif
11373
+/* We use char because int might match the return type of a gcc2
11374
+   builtin and then its argument prototype would still apply.  */
11375
+char bind ();
11376
+int
11377
+main ()
11378
+{
11379
+bind ();
11380
+  ;
11381
+  return 0;
11382
+}
11383
+_ACEOF
11384
+rm -f conftest.$ac_objext conftest$ac_exeext
11385
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11386
+  (eval $ac_link) 2>conftest.er1
11387
+  ac_status=$?
11388
+  grep -v '^ *+' conftest.er1 >conftest.err
11389
+  rm -f conftest.er1
11390
+  cat conftest.err >&5
11391
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11392
+  (exit $ac_status); } &&
11393
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11394
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11395
+  (eval $ac_try) 2>&5
11396
+  ac_status=$?
11397
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11398
+  (exit $ac_status); }; } &&
11399
+	 { ac_try='test -s conftest$ac_exeext'
11400
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11401
+  (eval $ac_try) 2>&5
11402
+  ac_status=$?
11403
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11404
+  (exit $ac_status); }; }; then
11405
+  ac_cv_lib_socket_bind=yes
11406
+else
11407
+  echo "$as_me: failed program was:" >&5
11408
+sed 's/^/| /' conftest.$ac_ext >&5
11409
+
11410
+ac_cv_lib_socket_bind=no
11411
+fi
11412
+rm -f conftest.err conftest.$ac_objext \
11413
+      conftest$ac_exeext conftest.$ac_ext
11414
+LIBS=$ac_check_lib_save_LIBS
11415
+fi
11416
+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_bind" >&5
11417
+echo "${ECHO_T}$ac_cv_lib_socket_bind" >&6
11418
+if test $ac_cv_lib_socket_bind = yes; then
11419
+  LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; LDFLAGS="$LDFLAGS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"
11420
+fi
11421
+
11422
+echo "$as_me:$LINENO: checking for gethostent in -lnsl" >&5
11423
+echo $ECHO_N "checking for gethostent in -lnsl... $ECHO_C" >&6
11424
+if test "${ac_cv_lib_nsl_gethostent+set}" = set; then
11425
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11426
+else
11427
+  ac_check_lib_save_LIBS=$LIBS
11428
+LIBS="-lnsl  $LIBS"
11429
+cat >conftest.$ac_ext <<_ACEOF
11430
+/* confdefs.h.  */
11431
+_ACEOF
11432
+cat confdefs.h >>conftest.$ac_ext
11433
+cat >>conftest.$ac_ext <<_ACEOF
11434
+/* end confdefs.h.  */
11435
+
11436
+/* Override any gcc2 internal prototype to avoid an error.  */
11437
+#ifdef __cplusplus
11438
+extern "C"
11439
+#endif
11440
+/* We use char because int might match the return type of a gcc2
11441
+   builtin and then its argument prototype would still apply.  */
11442
+char gethostent ();
11443
+int
11444
+main ()
11445
+{
11446
+gethostent ();
11447
+  ;
11448
+  return 0;
11449
+}
11450
+_ACEOF
11451
+rm -f conftest.$ac_objext conftest$ac_exeext
11452
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11453
+  (eval $ac_link) 2>conftest.er1
11454
+  ac_status=$?
11455
+  grep -v '^ *+' conftest.er1 >conftest.err
11456
+  rm -f conftest.er1
11457
+  cat conftest.err >&5
11458
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11459
+  (exit $ac_status); } &&
11460
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11461
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11462
+  (eval $ac_try) 2>&5
11463
+  ac_status=$?
11464
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11465
+  (exit $ac_status); }; } &&
11466
+	 { ac_try='test -s conftest$ac_exeext'
11467
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11468
+  (eval $ac_try) 2>&5
11469
+  ac_status=$?
11470
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11471
+  (exit $ac_status); }; }; then
11472
+  ac_cv_lib_nsl_gethostent=yes
11473
+else
11474
+  echo "$as_me: failed program was:" >&5
11475
+sed 's/^/| /' conftest.$ac_ext >&5
11476
+
11477
+ac_cv_lib_nsl_gethostent=no
11478
+fi
11479
+rm -f conftest.err conftest.$ac_objext \
11480
+      conftest$ac_exeext conftest.$ac_ext
11481
+LIBS=$ac_check_lib_save_LIBS
11482
+fi
11483
+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostent" >&5
11484
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6
11485
+if test $ac_cv_lib_nsl_gethostent = yes; then
11486
+  LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; LDFLAGS="$LDFLAGS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl"
11487
+fi
11488
+
11489
+
11490
+if test "$have_milter" = "yes"; then
11491
+
11492
+        save_LDFLAGS="$LDFLAGS"
11493
+    if test -d /usr/lib/libmilter ; then
11494
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
11495
+    fi
11496
+    LDFLAGS="$LDFLAGS -lmilter $CLAMAV_MILTER_LIBS"
11497
+    echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
11498
+echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6
11499
+if test "${ac_cv_lib_milter_mi_stop+set}" = set; then
11500
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11501
+else
11502
+  ac_check_lib_save_LIBS=$LIBS
11503
+LIBS="-lmilter  $LIBS"
11504
+cat >conftest.$ac_ext <<_ACEOF
11505
+/* confdefs.h.  */
11506
+_ACEOF
11507
+cat confdefs.h >>conftest.$ac_ext
11508
+cat >>conftest.$ac_ext <<_ACEOF
11509
+/* end confdefs.h.  */
11510
+
11511
+/* Override any gcc2 internal prototype to avoid an error.  */
11512
+#ifdef __cplusplus
11513
+extern "C"
11514
+#endif
11515
+/* We use char because int might match the return type of a gcc2
11516
+   builtin and then its argument prototype would still apply.  */
11517
+char mi_stop ();
11518
+int
11519
+main ()
11520
+{
11521
+mi_stop ();
11522
+  ;
11523
+  return 0;
11524
+}
11525
+_ACEOF
11526
+rm -f conftest.$ac_objext conftest$ac_exeext
11527
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11528
+  (eval $ac_link) 2>conftest.er1
11529
+  ac_status=$?
11530
+  grep -v '^ *+' conftest.er1 >conftest.err
11531
+  rm -f conftest.er1
11532
+  cat conftest.err >&5
11533
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11534
+  (exit $ac_status); } &&
11535
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11536
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11537
+  (eval $ac_try) 2>&5
11538
+  ac_status=$?
11539
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11540
+  (exit $ac_status); }; } &&
11541
+	 { ac_try='test -s conftest$ac_exeext'
11542
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11543
+  (eval $ac_try) 2>&5
11544
+  ac_status=$?
11545
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11546
+  (exit $ac_status); }; }; then
11547
+  ac_cv_lib_milter_mi_stop=yes
11548
+else
11549
+  echo "$as_me: failed program was:" >&5
11550
+sed 's/^/| /' conftest.$ac_ext >&5
11551
+
11552
+ac_cv_lib_milter_mi_stop=no
11553
+fi
11554
+rm -f conftest.err conftest.$ac_objext \
11555
+      conftest$ac_exeext conftest.$ac_ext
11556
+LIBS=$ac_check_lib_save_LIBS
11557
+fi
11558
+echo "$as_me:$LINENO: result: $ac_cv_lib_milter_mi_stop" >&5
11559
+echo "${ECHO_T}$ac_cv_lib_milter_mi_stop" >&6
11560
+if test $ac_cv_lib_milter_mi_stop = yes; then
11561
+  CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"
11562
+else
11563
+
11564
+		echo "$as_me:$LINENO: checking for library containing strlcpy" >&5
11565
+echo $ECHO_N "checking for library containing strlcpy... $ECHO_C" >&6
11566
+if test "${ac_cv_search_strlcpy+set}" = set; then
11567
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11568
+else
11569
+  ac_func_search_save_LIBS=$LIBS
11570
+ac_cv_search_strlcpy=no
11571
+cat >conftest.$ac_ext <<_ACEOF
11572
+/* confdefs.h.  */
11573
+_ACEOF
11574
+cat confdefs.h >>conftest.$ac_ext
11575
+cat >>conftest.$ac_ext <<_ACEOF
11576
+/* end confdefs.h.  */
11577
+
11578
+/* Override any gcc2 internal prototype to avoid an error.  */
11579
+#ifdef __cplusplus
11580
+extern "C"
11581
+#endif
11582
+/* We use char because int might match the return type of a gcc2
11583
+   builtin and then its argument prototype would still apply.  */
11584
+char strlcpy ();
11585
+int
11586
+main ()
11587
+{
11588
+strlcpy ();
11589
+  ;
11590
+  return 0;
11591
+}
11592
+_ACEOF
11593
+rm -f conftest.$ac_objext conftest$ac_exeext
11594
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11595
+  (eval $ac_link) 2>conftest.er1
11596
+  ac_status=$?
11597
+  grep -v '^ *+' conftest.er1 >conftest.err
11598
+  rm -f conftest.er1
11599
+  cat conftest.err >&5
11600
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11601
+  (exit $ac_status); } &&
11602
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11603
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11604
+  (eval $ac_try) 2>&5
11605
+  ac_status=$?
11606
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11607
+  (exit $ac_status); }; } &&
11608
+	 { ac_try='test -s conftest$ac_exeext'
11609
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11610
+  (eval $ac_try) 2>&5
11611
+  ac_status=$?
11612
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11613
+  (exit $ac_status); }; }; then
11614
+  ac_cv_search_strlcpy="none required"
11615
+else
11616
+  echo "$as_me: failed program was:" >&5
11617
+sed 's/^/| /' conftest.$ac_ext >&5
11618
+
11619
+fi
11620
+rm -f conftest.err conftest.$ac_objext \
11621
+      conftest$ac_exeext conftest.$ac_ext
11622
+if test "$ac_cv_search_strlcpy" = no; then
11623
+  for ac_lib in sm smutil; do
11624
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
11625
+    cat >conftest.$ac_ext <<_ACEOF
11626
+/* confdefs.h.  */
11627
+_ACEOF
11628
+cat confdefs.h >>conftest.$ac_ext
11629
+cat >>conftest.$ac_ext <<_ACEOF
11630
+/* end confdefs.h.  */
11631
+
11632
+/* Override any gcc2 internal prototype to avoid an error.  */
11633
+#ifdef __cplusplus
11634
+extern "C"
11635
+#endif
11636
+/* We use char because int might match the return type of a gcc2
11637
+   builtin and then its argument prototype would still apply.  */
11638
+char strlcpy ();
11639
+int
11640
+main ()
11641
+{
11642
+strlcpy ();
11643
+  ;
11644
+  return 0;
11645
+}
11646
+_ACEOF
11647
+rm -f conftest.$ac_objext conftest$ac_exeext
11648
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11649
+  (eval $ac_link) 2>conftest.er1
11650
+  ac_status=$?
11651
+  grep -v '^ *+' conftest.er1 >conftest.err
11652
+  rm -f conftest.er1
11653
+  cat conftest.err >&5
11654
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11655
+  (exit $ac_status); } &&
11656
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11657
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11658
+  (eval $ac_try) 2>&5
11659
+  ac_status=$?
11660
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11661
+  (exit $ac_status); }; } &&
11662
+	 { ac_try='test -s conftest$ac_exeext'
11663
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11664
+  (eval $ac_try) 2>&5
11665
+  ac_status=$?
11666
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11667
+  (exit $ac_status); }; }; then
11668
+  ac_cv_search_strlcpy="-l$ac_lib"
11669
+break
11670
+else
11671
+  echo "$as_me: failed program was:" >&5
11672
+sed 's/^/| /' conftest.$ac_ext >&5
11673
+
11674
+fi
11675
+rm -f conftest.err conftest.$ac_objext \
11676
+      conftest$ac_exeext conftest.$ac_ext
11677
+  done
11678
+fi
11679
+LIBS=$ac_func_search_save_LIBS
11680
+fi
11681
+echo "$as_me:$LINENO: result: $ac_cv_search_strlcpy" >&5
11682
+echo "${ECHO_T}$ac_cv_search_strlcpy" >&6
11683
+if test "$ac_cv_search_strlcpy" != no; then
11684
+  test "$ac_cv_search_strlcpy" = "none required" || LIBS="$ac_cv_search_strlcpy $LIBS"
11685
+  test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"
11686
+fi
11687
+
11688
+	LDFLAGS="$save_LDFLAGS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
11689
+	$as_unset ac_cv_lib_milter_mi_stop
11690
+	echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
11691
+echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6
11692
+if test "${ac_cv_lib_milter_mi_stop+set}" = set; then
11693
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11694
+else
11695
+  ac_check_lib_save_LIBS=$LIBS
11696
+LIBS="-lmilter  $LIBS"
11697
+cat >conftest.$ac_ext <<_ACEOF
11698
+/* confdefs.h.  */
11699
+_ACEOF
11700
+cat confdefs.h >>conftest.$ac_ext
11701
+cat >>conftest.$ac_ext <<_ACEOF
11702
+/* end confdefs.h.  */
11703
+
11704
+/* Override any gcc2 internal prototype to avoid an error.  */
11705
+#ifdef __cplusplus
11706
+extern "C"
11707
+#endif
11708
+/* We use char because int might match the return type of a gcc2
11709
+   builtin and then its argument prototype would still apply.  */
11710
+char mi_stop ();
11711
+int
11712
+main ()
11713
+{
11714
+mi_stop ();
11715
+  ;
11716
+  return 0;
11717
+}
11718
+_ACEOF
11719
+rm -f conftest.$ac_objext conftest$ac_exeext
11720
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11721
+  (eval $ac_link) 2>conftest.er1
11722
+  ac_status=$?
11723
+  grep -v '^ *+' conftest.er1 >conftest.err
11724
+  rm -f conftest.er1
11725
+  cat conftest.err >&5
11726
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11727
+  (exit $ac_status); } &&
11728
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11729
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11730
+  (eval $ac_try) 2>&5
11731
+  ac_status=$?
11732
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11733
+  (exit $ac_status); }; } &&
11734
+	 { ac_try='test -s conftest$ac_exeext'
11735
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11736
+  (eval $ac_try) 2>&5
11737
+  ac_status=$?
11738
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11739
+  (exit $ac_status); }; }; then
11740
+  ac_cv_lib_milter_mi_stop=yes
11741
+else
11742
+  echo "$as_me: failed program was:" >&5
11743
+sed 's/^/| /' conftest.$ac_ext >&5
11744
+
11745
+ac_cv_lib_milter_mi_stop=no
11746
+fi
11747
+rm -f conftest.err conftest.$ac_objext \
11748
+      conftest$ac_exeext conftest.$ac_ext
11749
+LIBS=$ac_check_lib_save_LIBS
11750
+fi
11751
+echo "$as_me:$LINENO: result: $ac_cv_lib_milter_mi_stop" >&5
11752
+echo "${ECHO_T}$ac_cv_lib_milter_mi_stop" >&6
11753
+if test $ac_cv_lib_milter_mi_stop = yes; then
11754
+  CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"
11755
+else
11756
+
11757
+	    { { echo "$as_me:$LINENO: error: Cannot find libmilter" >&5
11758
+echo "$as_me: error: Cannot find libmilter" >&2;}
11759
+   { (exit 1); exit 1; }; }
11760
+
11761
+fi
11762
+
11763
+
11764
+fi
11765
+
11766
+    LDFLAGS="$save_LDFLAGS"
11767
+
11768
+for ac_header in libmilter/mfapi.h
11769
+do
11770
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
11771
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11772
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
11773
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
11774
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11775
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11776
+fi
11777
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
11778
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
11779
+else
11780
+  # Is the header compilable?
11781
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
11782
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
11783
+cat >conftest.$ac_ext <<_ACEOF
11784
+/* confdefs.h.  */
11785
+_ACEOF
11786
+cat confdefs.h >>conftest.$ac_ext
11787
+cat >>conftest.$ac_ext <<_ACEOF
11788
+/* end confdefs.h.  */
11789
+$ac_includes_default
11790
+#include <$ac_header>
11791
+_ACEOF
11792
+rm -f conftest.$ac_objext
11793
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
11794
+  (eval $ac_compile) 2>conftest.er1
11795
+  ac_status=$?
11796
+  grep -v '^ *+' conftest.er1 >conftest.err
11797
+  rm -f conftest.er1
11798
+  cat conftest.err >&5
11799
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11800
+  (exit $ac_status); } &&
11801
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11802
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11803
+  (eval $ac_try) 2>&5
11804
+  ac_status=$?
11805
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11806
+  (exit $ac_status); }; } &&
11807
+	 { ac_try='test -s conftest.$ac_objext'
11808
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11809
+  (eval $ac_try) 2>&5
11810
+  ac_status=$?
11811
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11812
+  (exit $ac_status); }; }; then
11813
+  ac_header_compiler=yes
11814
+else
11815
+  echo "$as_me: failed program was:" >&5
11816
+sed 's/^/| /' conftest.$ac_ext >&5
11817
+
11818
+ac_header_compiler=no
11819
+fi
11820
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
11821
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
11822
+echo "${ECHO_T}$ac_header_compiler" >&6
11823
+
11824
+# Is the header present?
11825
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
11826
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
11827
+cat >conftest.$ac_ext <<_ACEOF
11828
+/* confdefs.h.  */
11829
+_ACEOF
11830
+cat confdefs.h >>conftest.$ac_ext
11831
+cat >>conftest.$ac_ext <<_ACEOF
11832
+/* end confdefs.h.  */
11833
+#include <$ac_header>
11834
+_ACEOF
11835
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
11836
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
11837
+  ac_status=$?
11838
+  grep -v '^ *+' conftest.er1 >conftest.err
11839
+  rm -f conftest.er1
11840
+  cat conftest.err >&5
11841
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11842
+  (exit $ac_status); } >/dev/null; then
11843
+  if test -s conftest.err; then
11844
+    ac_cpp_err=$ac_c_preproc_warn_flag
11845
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
11846
+  else
11847
+    ac_cpp_err=
11848
+  fi
11849
+else
11850
+  ac_cpp_err=yes
11851
+fi
11852
+if test -z "$ac_cpp_err"; then
11853
+  ac_header_preproc=yes
11854
+else
11855
+  echo "$as_me: failed program was:" >&5
11856
+sed 's/^/| /' conftest.$ac_ext >&5
11857
+
11858
+  ac_header_preproc=no
11859
+fi
11860
+rm -f conftest.err conftest.$ac_ext
11861
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
11862
+echo "${ECHO_T}$ac_header_preproc" >&6
11863
+
11864
+# So?  What about this header?
11865
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
11866
+  yes:no: )
11867
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
11868
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
11869
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
11870
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
11871
+    ac_header_preproc=yes
11872
+    ;;
11873
+  no:yes:* )
11874
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
11875
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
11876
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
11877
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
11878
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
11879
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
11880
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
11881
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
11882
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
11883
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
11884
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
11885
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
11886
+    (
11887
+      cat <<\_ASBOX
11888
+## ------------------------------------------ ##
11889
+## Report this to the AC_PACKAGE_NAME lists.  ##
11890
+## ------------------------------------------ ##
11891
+_ASBOX
11892
+    ) |
11893
+      sed "s/^/$as_me: WARNING:     /" >&2
11894
+    ;;
11895
+esac
11896
+echo "$as_me:$LINENO: checking for $ac_header" >&5
11897
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
11898
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11899
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11900
+else
11901
+  eval "$as_ac_Header=\$ac_header_preproc"
11902
+fi
11903
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
11904
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
11905
+
11906
+fi
11907
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
11908
+  cat >>confdefs.h <<_ACEOF
11909
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
11910
+_ACEOF
11911
+ have_milter="yes"
11912
+else
11913
+
11914
+	{ { echo "$as_me:$LINENO: error: Please install mfapi.h from the sendmail distribution" >&5
11915
+echo "$as_me: error: Please install mfapi.h from the sendmail distribution" >&2;}
11916
+   { (exit 1); exit 1; }; }
11917
+
11918
+fi
11919
+
11920
+done
11921
+
11922
+fi
11923
+
11355 11924
 
11356 11925
 
11357 11926
 if test "$have_pthreads" = "yes"; then
... ...
@@ -11427,8 +11850,6 @@ fi
11427 11427
 
11428 11428
 fi
11429 11429
 
11430
-# tcpwrappers support
11431
-# rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
11432 11430
 
11433 11431
 # Check whether --with-tcpwrappers or --without-tcpwrappers was given.
11434 11432
 if test "${with_tcpwrappers+set}" = set; then
... ...
@@ -11734,21 +12155,214 @@ echo "$as_me: WARNING: could not find TCP wrappers, support disabled" >&2;}
11734 11734
         fi
11735 11735
 fi
11736 11736
 
11737
+echo "$as_me:$LINENO: checking for gethostbyname_r" >&5
11738
+echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6
11739
+if test -z "$ac_cv_gethostbyname_args"; then
11740
+cat >conftest.$ac_ext <<_ACEOF
11741
+/* confdefs.h.  */
11742
+_ACEOF
11743
+cat confdefs.h >>conftest.$ac_ext
11744
+cat >>conftest.$ac_ext <<_ACEOF
11745
+/* end confdefs.h.  */
11746
+
11747
+#include <sys/types.h>
11748
+#include <netdb.h>
11749
+
11750
+int
11751
+main ()
11752
+{
11753
+
11754
+struct hostent *hp;
11755
+struct hostent h;
11756
+char *name;
11757
+char buffer[10];
11758
+int  h_errno;
11759
+hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);
11760
+
11761
+  ;
11762
+  return 0;
11763
+}
11764
+_ACEOF
11765
+rm -f conftest.$ac_objext
11766
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
11767
+  (eval $ac_compile) 2>conftest.er1
11768
+  ac_status=$?
11769
+  grep -v '^ *+' conftest.er1 >conftest.err
11770
+  rm -f conftest.er1
11771
+  cat conftest.err >&5
11772
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11773
+  (exit $ac_status); } &&
11774
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11775
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11776
+  (eval $ac_try) 2>&5
11777
+  ac_status=$?
11778
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11779
+  (exit $ac_status); }; } &&
11780
+	 { ac_try='test -s conftest.$ac_objext'
11781
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11782
+  (eval $ac_try) 2>&5
11783
+  ac_status=$?
11784
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11785
+  (exit $ac_status); }; }; then
11786
+  ac_cv_gethostbyname_args=5
11787
+else
11788
+  echo "$as_me: failed program was:" >&5
11789
+sed 's/^/| /' conftest.$ac_ext >&5
11790
+
11791
+fi
11792
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
11793
+fi
11794
+if test -z "$ac_cv_gethostbyname_args"; then
11795
+cat >conftest.$ac_ext <<_ACEOF
11796
+/* confdefs.h.  */
11797
+_ACEOF
11798
+cat confdefs.h >>conftest.$ac_ext
11799
+cat >>conftest.$ac_ext <<_ACEOF
11800
+/* end confdefs.h.  */
11801
+
11802
+#include <sys/types.h>
11803
+#include <netdb.h>
11804
+
11805
+int
11806
+main ()
11807
+{
11808
+
11809
+struct hostent h;
11810
+struct hostent_data hdata;
11811
+char *name;
11812
+int  rc;
11813
+rc = gethostbyname_r(name, &h, &hdata);
11814
+
11815
+  ;
11816
+  return 0;
11817
+}
11818
+_ACEOF
11819
+rm -f conftest.$ac_objext
11820
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
11821
+  (eval $ac_compile) 2>conftest.er1
11822
+  ac_status=$?
11823
+  grep -v '^ *+' conftest.er1 >conftest.err
11824
+  rm -f conftest.er1
11825
+  cat conftest.err >&5
11826
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11827
+  (exit $ac_status); } &&
11828
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11829
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11830
+  (eval $ac_try) 2>&5
11831
+  ac_status=$?
11832
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11833
+  (exit $ac_status); }; } &&
11834
+	 { ac_try='test -s conftest.$ac_objext'
11835
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11836
+  (eval $ac_try) 2>&5
11837
+  ac_status=$?
11838
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11839
+  (exit $ac_status); }; }; then
11840
+  ac_cv_gethostbyname_args=3
11841
+else
11842
+  echo "$as_me: failed program was:" >&5
11843
+sed 's/^/| /' conftest.$ac_ext >&5
11844
+
11845
+fi
11846
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
11847
+fi
11848
+if test -z "$ac_cv_gethostbyname_args"; then
11849
+cat >conftest.$ac_ext <<_ACEOF
11850
+/* confdefs.h.  */
11851
+_ACEOF
11852
+cat confdefs.h >>conftest.$ac_ext
11853
+cat >>conftest.$ac_ext <<_ACEOF
11854
+/* end confdefs.h.  */
11855
+
11856
+#include <sys/types.h>
11857
+#include <netdb.h>
11858
+
11859
+int
11860
+main ()
11861
+{
11862
+
11863
+struct hostent h;
11864
+struct hostent *hp;
11865
+char *name;
11866
+char buf[10];
11867
+int rc;
11868
+int h_errno;
11869
+
11870
+rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
11871
+
11872
+  ;
11873
+  return 0;
11874
+}
11875
+_ACEOF
11876
+rm -f conftest.$ac_objext
11877
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
11878
+  (eval $ac_compile) 2>conftest.er1
11879
+  ac_status=$?
11880
+  grep -v '^ *+' conftest.er1 >conftest.err
11881
+  rm -f conftest.er1
11882
+  cat conftest.err >&5
11883
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11884
+  (exit $ac_status); } &&
11885
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11886
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11887
+  (eval $ac_try) 2>&5
11888
+  ac_status=$?
11889
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11890
+  (exit $ac_status); }; } &&
11891
+	 { ac_try='test -s conftest.$ac_objext'
11892
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11893
+  (eval $ac_try) 2>&5
11894
+  ac_status=$?
11895
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11896
+  (exit $ac_status); }; }; then
11897
+  ac_cv_gethostbyname_args=6
11898
+else
11899
+  echo "$as_me: failed program was:" >&5
11900
+sed 's/^/| /' conftest.$ac_ext >&5
11901
+
11902
+fi
11903
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
11904
+fi
11905
+if test -z "$ac_cv_gethostbyname_args"; then
11906
+    echo "$as_me:$LINENO: result: no" >&5
11907
+echo "${ECHO_T}no" >&6
11908
+else
11909
+    if test "$ac_cv_gethostbyname_args" = 3; then
11910
+
11911
+cat >>confdefs.h <<\_ACEOF
11912
+#define HAVE_GETHOSTBYNAME_R_3 1
11913
+_ACEOF
11914
+
11915
+    elif test "$ac_cv_gethostbyname_args" = 5; then
11916
+
11917
+cat >>confdefs.h <<\_ACEOF
11918
+#define HAVE_GETHOSTBYNAME_R_5 1
11919
+_ACEOF
11920
+
11921
+    elif test "$ac_cv_gethostbyname_args" = 6; then
11922
+
11923
+cat >>confdefs.h <<\_ACEOF
11924
+#define HAVE_GETHOSTBYNAME_R_6 1
11925
+_ACEOF
11926
+
11927
+    fi
11928
+    echo "$as_me:$LINENO: result: yes, and it takes $ac_cv_gethostbyname_args arguments" >&5
11929
+echo "${ECHO_T}yes, and it takes $ac_cv_gethostbyname_args arguments" >&6
11930
+fi
11737 11931
 
11738 11932
 if test "$test_clamav" = "yes"
11739 11933
 then
11740
-    # parse /etc/passwd
11741
-    if test "$use_id" = no
11934
+        if test "$use_id" = "no"
11742 11935
     then
11743
-	echo "$as_me:$LINENO: result: Checking /etc/passwd..." >&5
11744
-echo "${ECHO_T}Checking /etc/passwd..." >&6
11936
+	echo "$as_me:$LINENO: checking for $clamav_user in /etc/passwd" >&5
11937
+echo $ECHO_N "checking for $clamav_user in /etc/passwd... $ECHO_C" >&6
11745 11938
 	if test -r /etc/passwd; then
11746
-	    clamavuser=`cat /etc/passwd|grep ${clamav_user}`
11747
-	    clamavgroup=`cat /etc/group|grep ${clamav_group}`
11939
+	    clamavuser=`cat /etc/passwd|grep $clamav_user`
11940
+	    clamavgroup=`cat /etc/group|grep $clamav_group`
11748 11941
 	fi
11749 11942
     else
11750
-	echo "$as_me:$LINENO: result: Checking id output..." >&5
11751
-echo "${ECHO_T}Checking id output..." >&6
11943
+	echo "$as_me:$LINENO: checking for $clamav_user using id" >&5
11944
+echo $ECHO_N "checking for $clamav_user using id... $ECHO_C" >&6
11752 11945
 	id $clamav_user > /dev/null 2>&1
11753 11946
 	if test "$?" = 0 ; then
11754 11947
 	    clamavuser=1
... ...
@@ -11801,23 +12415,32 @@ fi
11801 11801
 
11802 11802
     if test "$use_netinfo" = "yes"
11803 11803
     then
11804
+	echo "$as_me:$LINENO: checking for $clamav_user using netinfo" >&5
11805
+echo $ECHO_N "checking for $clamav_user using netinfo... $ECHO_C" >&6
11804 11806
         clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
11805 11807
         clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
11806 11808
     fi
11807 11809
 
11808 11810
     if test "$use_yp" = "yes"
11809 11811
     then
11812
+	echo "$as_me:$LINENO: checking for $clamav_user using ypmatch" >&5
11813
+echo $ECHO_N "checking for $clamav_user using ypmatch... $ECHO_C" >&6
11810 11814
         clamavuser=`ypmatch ${clamav_user} passwd`
11811 11815
         clamavgroup=`ypmatch ${clamav_group} group`
11812 11816
     fi
11813 11817
 
11814 11818
     if test -z "$clamavuser" || test -z "$clamavgroup"
11815 11819
     then
11816
-        echo "ERROR: User \"$clamav_user\" (and/or group \"$clamav_group\") doesn't exist. Please create it. You can omit this check with the --disable-clamav option."
11817
-        exit 1
11820
+	echo "$as_me:$LINENO: result: no" >&5
11821
+echo "${ECHO_T}no" >&6
11822
+	{ { echo "$as_me:$LINENO: error: User $clamav_user (and/or group $clamav_group) doesn't exist. Please read the documentation !" >&5
11823
+echo "$as_me: error: User $clamav_user (and/or group $clamav_group) doesn't exist. Please read the documentation !" >&2;}
11824
+   { (exit 1); exit 1; }; }
11818 11825
     else
11819
-        CLAMAVUSER="${clamav_user}"
11820
-        CLAMAVGROUP="${clamav_group}"
11826
+	echo "$as_me:$LINENO: result: yes, user $clamav_user and group $clamav_group" >&5
11827
+echo "${ECHO_T}yes, user $clamav_user and group $clamav_group" >&6
11828
+        CLAMAVUSER="$clamav_user"
11829
+        CLAMAVGROUP="$clamav_group"
11821 11830
 
11822 11831
 
11823 11832
     fi
... ...
@@ -12298,7 +12921,6 @@ _ACEOF
12298 12298
 
12299 12299
 fi
12300 12300
 
12301
-# Check if <sys/select.h> needs to be included for fd_set
12302 12301
 echo "$as_me:$LINENO: checking for fd_set" >&5
12303 12302
 echo $ECHO_N "checking for fd_set... $ECHO_C" >&6
12304 12303
 cat >conftest.$ac_ext <<_ACEOF
... ...
@@ -12383,8 +13005,8 @@ echo "${ECHO_T}no" >&6
12383 12383
     fi
12384 12384
 fi
12385 12385
 
12386
-echo "$as_me:$LINENO: checking Default FD_SETSIZE value" >&5
12387
-echo $ECHO_N "checking Default FD_SETSIZE value... $ECHO_C" >&6
12386
+echo "$as_me:$LINENO: checking default FD_SETSIZE value" >&5
12387
+echo $ECHO_N "checking default FD_SETSIZE value... $ECHO_C" >&6
12388 12388
 if test "$cross_compiling" = yes; then
12389 12389
   DEFAULT_FD_SETSIZE=256
12390 12390
 else
... ...
@@ -17,7 +17,7 @@ dnl   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
 
18 18
 AC_INIT(clamscan/clamscan.c)
19 19
 AC_CREATE_TARGET_H(target.h)
20
-AM_INIT_AUTOMAKE(clamav, "0.75")
20
+AM_INIT_AUTOMAKE(clamav, "0.75.1")
21 21
 AM_CONFIG_HEADER(clamav-config.h)
22 22
 
23 23
 LC_CURRENT=1
... ...
@@ -42,11 +42,11 @@ AC_TYPE_OFF_T
42 42
 AC_COMPILE_CHECK_SIZEOF(short)
43 43
 AC_COMPILE_CHECK_SIZEOF(int)
44 44
 AC_COMPILE_CHECK_SIZEOF(long)
45
-AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop setgroups initgroups gethostbyname_r)
45
+AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop setgroups initgroups)
46 46
 AC_FUNC_MMAP
47 47
 AC_FUNC_FSEEKO
48 48
 
49
-# Check for broken snprintf
49
+dnl Check for broken snprintf (code from Phil Oleson <oz*nixil.net>)
50 50
 if test "x$ac_cv_func_snprintf" = "xyes" ; then
51 51
         AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
52 52
         AC_TRY_RUN(
... ...
@@ -66,7 +66,7 @@ fi
66 66
 have_pthreads=no
67 67
 AC_CHECK_HEADER(pthread.h,[have_pthreads=yes],)
68 68
 
69
-AC_CHECK_HEADER(zlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)],[echo "Please install zlib and zlib-devel packages."; exit 1])
69
+AC_CHECK_HEADER(zlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)],AC_MSG_ERROR(Please install zlib and zlib-devel packages))
70 70
 
71 71
 want_bzip2="yes"
72 72
 AC_ARG_ENABLE(bzip2,
... ...
@@ -75,8 +75,8 @@ want_bzip2="no",)
75 75
 
76 76
 if test "$want_bzip2" = "yes"
77 77
 then
78
-    AC_CHECK_HEADER(bzlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lbz2"; AC_DEFINE(HAVE_BZLIB_H,1,have bzip2)],[echo "WARNING: Bzip2 support disabled"])
79 78
     AC_CHECK_LIB(bz2, bzReadOpen, AC_DEFINE(NOBZ2PREFIX,1,bzip funtions do not have bz2 prefix),)
79
+    AC_CHECK_HEADER(bzlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lbz2"; AC_DEFINE(HAVE_BZLIB_H,1,have bzip2)], AC_MSG_WARN([****** bzip2 support disabled]))
80 80
 fi
81 81
 
82 82
 want_clamuko="yes"
... ...
@@ -86,12 +86,9 @@ want_clamuko="no",)
86 86
 
87 87
 AC_FUNC_SETPGRP
88 88
 
89
-have_milter="no"
90
-AC_CHECK_HEADER(libmilter/mfapi.h,have_milter="yes",)
91
-
92 89
 AC_ARG_ENABLE(milter,
93
-[  --enable-milter	  Build clamav-milter (if milter library found)],
94
-,have_milter="no")
90
+[  --enable-milter	  Build clamav-milter],
91
+have_milter=$enableval,have_milter="no")
95 92
 
96 93
 want_dsig="yes"
97 94
 AC_ARG_ENABLE(dsig,
... ...
@@ -100,7 +97,7 @@ want_dsig="no",)
100 100
 
101 101
 if test "$want_dsig" = "yes"
102 102
 then
103
-    AC_CHECK_LIB(gmp, __gmpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], [AC_CHECK_LIB(gmp, mpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], [echo "WARNING: GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !"; want_dsig="no"])])
103
+    AC_CHECK_LIB(gmp, __gmpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], [AC_CHECK_LIB(gmp, mpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], AC_MSG_WARN([****** GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !]); want_dsig="no")])
104 104
 fi
105 105
 
106 106
 AC_CHECK_HEADER(syslog.h,AC_DEFINE(USE_SYSLOG,1,[use syslog]),)
... ...
@@ -177,7 +174,7 @@ AC_DEFINE_UNQUOTED(DATADIR,"$db_dir", [Path to virus database directory.])
177 177
 DBDIR="$db_dir"
178 178
 AC_SUBST(DBDIR)
179 179
 
180
-# config file
180
+dnl configure config directory
181 181
 cfg_dir=`echo $sysconfdir | grep prefix`
182 182
 
183 183
 if test -n "$cfg_dir"; then
... ...
@@ -199,7 +196,7 @@ dnl Do not overwrite current config files
199 199
 AM_CONDITIONAL(INSTALL_CLAMAV_CONF, test ! -r "$cfg_dir/clamav.conf")
200 200
 AM_CONDITIONAL(INSTALL_FRESHCLAM_CONF, test ! -r "$cfg_dir/freshclam.conf")
201 201
 
202
-# check for in_port_t definition
202
+dnl check for in_port_t definition
203 203
 AC_TRY_RUN([
204 204
 #include <sys/types.h>
205 205
 #include <netinet/in.h>
... ...
@@ -214,12 +211,12 @@ linux*)
214 214
 	TH_SAFE="-thread-safe"
215 215
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
216 216
 	AC_DEFINE(_REENTRANT,1,[thread safe])
217
-	CLAMD_LIBS="-lpthread"
217
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
218 218
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
219 219
 	if test "$want_clamuko" = "yes"; then
220 220
 	    AC_DEFINE(CLAMUKO,1,[enable clamuko])
221 221
 	fi
222
-	CLAMSCAN_LIBS="-lpthread"
222
+	CLAMSCAN_LIBS="$CLAMSCAN_LIBS -lpthread"
223 223
     fi
224 224
     ;;
225 225
 cygwin*)
... ...
@@ -237,11 +234,11 @@ cygwin*)
237 237
     fi
238 238
     ;;
239 239
 solaris*)
240
-    FRESHCLAM_LIBS="-lsocket -lnsl -lresolv"
240
+    FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
241 241
     if test "$have_pthreads" = "yes"; then
242 242
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
243
-	CLAMD_LIBS="-lpthread -lsocket -lnsl -lresolv"
244
-	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread -lsocket -lnsl -lresolv"
243
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread -lresolv"
244
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread -lresolv"
245 245
 	TH_SAFE="-thread-safe"
246 246
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
247 247
 	AC_DEFINE(_REENTRANT,1,[thread safe])
... ...
@@ -251,7 +248,7 @@ solaris*)
251 251
 freebsd*)
252 252
     if test "$have_pthreads" = "yes"; then
253 253
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread -lc_r"
254
-	CLAMD_LIBS="-pthread -lc_r"
254
+	CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
255 255
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
256 256
 	TH_SAFE="-thread-safe"
257 257
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
... ...
@@ -266,7 +263,7 @@ openbsd3.3*)
266 266
     if test "$have_pthreads" = "yes"; then
267 267
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
268 268
 	if test "$disable_cr" = "yes"; then
269
-	    CLAMD_LIBS="-pthread"
269
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread"
270 270
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
271 271
 	fi
272 272
 	TH_SAFE="-thread-safe"
... ...
@@ -279,10 +276,10 @@ openbsd*)
279 279
     if test "$have_pthreads" = "yes"; then
280 280
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
281 281
 	if test "$disable_cr" = "yes"; then
282
-	    CLAMD_LIBS="-pthread"
282
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread"
283 283
 	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
284 284
 	else
285
-	    CLAMD_LIBS="-pthread -lc_r"
285
+	    CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
286 286
 	    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
287 287
 	fi
288 288
 	TH_SAFE="-thread-safe"
... ...
@@ -319,14 +316,14 @@ darwin*)
319 319
     ;;
320 320
 sco*)
321 321
     dnl njh@bandsman.sco.uk: SCO Unix port
322
-    FRESHCLAM_LIBS="-lsocket"
323
-    CLAMD_LIBS="-lsocket"
324
-    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
322
+    dnl FRESHCLAM_LIBS="-lsocket"
323
+    dnl CLAMD_LIBS="-lsocket"
324
+    dnl CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
325 325
     ;;
326 326
 hpux*)
327 327
     if test "$have_pthreads" = "yes"; then
328 328
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
329
-	CLAMD_LIBS="-lpthread"
329
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
330 330
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
331 331
 	TH_SAFE="-thread-safe"
332 332
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
... ...
@@ -337,7 +334,7 @@ hpux*)
337 337
 aix*)
338 338
     if test "$have_pthreads" = "yes"; then
339 339
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
340
-	CLAMD_LIBS="-lpthread"
340
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
341 341
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
342 342
 	TH_SAFE="-thread-safe"
343 343
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
... ...
@@ -348,7 +345,7 @@ aix*)
348 348
 irix*)
349 349
     if test "$have_pthreads" = "yes"; then
350 350
 	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
351
-	CLAMD_LIBS="-lpthread"
351
+	CLAMD_LIBS="$CLAMD_LIBS -lpthread"
352 352
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
353 353
 	TH_SAFE="-thread-safe"
354 354
 	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
... ...
@@ -381,6 +378,35 @@ AC_SUBST(FRESHCLAM_LIBS)
381 381
 AC_SUBST(TH_SAFE)
382 382
 AC_SUBST(ADDITIONAL_LIBS)
383 383
 
384
+AC_CHECK_LIB(socket, bind, [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; LDFLAGS="$LDFLAGS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"])
385
+AC_CHECK_LIB(nsl, gethostent, [LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; LDFLAGS="$LDFLAGS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl"])
386
+
387
+dnl --enable-milter
388
+if test "$have_milter" = "yes"; then
389
+    dnl libmilter checking code adapted from spamass-milter by
390
+    dnl Tom G. Christensen <tgc@statsbiblioteket.dk>
391
+
392
+    dnl Check for libmilter and it's header files in the usual locations
393
+    save_LDFLAGS="$LDFLAGS"
394
+    if test -d /usr/lib/libmilter ; then
395
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
396
+    fi
397
+    LDFLAGS="$LDFLAGS -lmilter $CLAMAV_MILTER_LIBS"
398
+    AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"],[
399
+	dnl Older sendmails require libsm or libsmutil for support functions
400
+	AC_SEARCH_LIBS(strlcpy, [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
401
+	LDFLAGS="$save_LDFLAGS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
402
+	$as_unset ac_cv_lib_milter_mi_stop
403
+	AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"],[
404
+	    AC_MSG_ERROR([Cannot find libmilter])
405
+	])
406
+    ])
407
+    LDFLAGS="$save_LDFLAGS"
408
+    AC_CHECK_HEADERS(libmilter/mfapi.h,have_milter="yes",[
409
+	AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
410
+    ])
411
+fi
412
+
384 413
 AM_CONDITIONAL(BUILD_CLAMD, test "$have_pthreads" = "yes")
385 414
 AM_CONDITIONAL(HAVE_MILTER, test "$have_milter" = "yes")
386 415
 
... ...
@@ -394,8 +420,8 @@ then
394 394
     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)
395 395
 fi
396 396
 
397
-# tcpwrappers support
398
-# rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
397
+dnl tcpwrappers support
398
+dnl rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
399 399
 AC_ARG_WITH(tcpwrappers,
400 400
 [  --with-tcpwrappers      Support hosts.allow / hosts.deny (default=auto)],
401 401
 [ case "$withval" in
... ...
@@ -448,20 +474,78 @@ hosts_access(req)
448 448
         fi
449 449
 fi
450 450
 
451
-dnl Check for clamav in /etc/passwd
451
+dnl Check for gethostbyname_r and number of its arguments
452
+dnl Code from libwww/configure.in
453
+AC_MSG_CHECKING(for gethostbyname_r)
454
+if test -z "$ac_cv_gethostbyname_args"; then
455
+AC_TRY_COMPILE(
456
+[
457
+#include <sys/types.h>
458
+#include <netdb.h>
459
+],[
460
+struct hostent *hp;
461
+struct hostent h;
462
+char *name;
463
+char buffer[10];
464
+int  h_errno;
465
+hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);
466
+], ac_cv_gethostbyname_args=5)
467
+fi
468
+if test -z "$ac_cv_gethostbyname_args"; then
469
+AC_TRY_COMPILE(
470
+[
471
+#include <sys/types.h>
472
+#include <netdb.h>
473
+],[
474
+struct hostent h;
475
+struct hostent_data hdata;
476
+char *name;
477
+int  rc;
478
+rc = gethostbyname_r(name, &h, &hdata);
479
+], ac_cv_gethostbyname_args=3)
480
+fi
481
+if test -z "$ac_cv_gethostbyname_args"; then
482
+AC_TRY_COMPILE(
483
+[
484
+#include <sys/types.h>
485
+#include <netdb.h>
486
+], [
487
+struct hostent h;
488
+struct hostent *hp;
489
+char *name;
490
+char buf[10];
491
+int rc;
492
+int h_errno;
493
+
494
+rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
495
+], ac_cv_gethostbyname_args=6)
496
+fi
497
+if test -z "$ac_cv_gethostbyname_args"; then
498
+    AC_MSG_RESULT(no)
499
+else
500
+    if test "$ac_cv_gethostbyname_args" = 3; then
501
+	AC_DEFINE(HAVE_GETHOSTBYNAME_R_3,1,[gethostbyname_r takes 3 arguments])
502
+    elif test "$ac_cv_gethostbyname_args" = 5; then
503
+	AC_DEFINE(HAVE_GETHOSTBYNAME_R_5,1,[gethostbyname_r takes 5 arguments])
504
+    elif test "$ac_cv_gethostbyname_args" = 6; then
505
+	AC_DEFINE(HAVE_GETHOSTBYNAME_R_6,1,[gethostbyname_r takes 6 arguments])
506
+    fi
507
+    AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments])
508
+fi
452 509
 
510
+dnl Check for clamav in /etc/passwd
453 511
 if test "$test_clamav" = "yes"
454 512
 then
455
-    # parse /etc/passwd
456
-    if test "$use_id" = no
513
+    dnl parse /etc/passwd
514
+    if test "$use_id" = "no"
457 515
     then
458
-	AC_MSG_RESULT(Checking /etc/passwd...)
516
+	AC_MSG_CHECKING(for $clamav_user in /etc/passwd)
459 517
 	if test -r /etc/passwd; then
460
-	    clamavuser=`cat /etc/passwd|grep ${clamav_user}`
461
-	    clamavgroup=`cat /etc/group|grep ${clamav_group}`
518
+	    clamavuser=`cat /etc/passwd|grep $clamav_user`
519
+	    clamavgroup=`cat /etc/group|grep $clamav_group`
462 520
 	fi
463 521
     else
464
-	AC_MSG_RESULT(Checking id output...)
522
+	AC_MSG_CHECKING(for $clamav_user using id)
465 523
 	id $clamav_user > /dev/null 2>&1
466 524
 	if test "$?" = 0 ; then
467 525
 	    clamavuser=1
... ...
@@ -476,23 +560,26 @@ then
476 476
 
477 477
     if test "$use_netinfo" = "yes"
478 478
     then
479
+	AC_MSG_CHECKING(for $clamav_user using netinfo)
479 480
         clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
480 481
         clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
481 482
     fi
482 483
 
483 484
     if test "$use_yp" = "yes"
484 485
     then
486
+	AC_MSG_CHECKING(for $clamav_user using ypmatch)
485 487
         clamavuser=`ypmatch ${clamav_user} passwd`
486 488
         clamavgroup=`ypmatch ${clamav_group} group`
487 489
     fi
488 490
 
489 491
     if test -z "$clamavuser" || test -z "$clamavgroup"
490 492
     then
491
-        echo "ERROR: User \"$clamav_user\" (and/or group \"$clamav_group\") doesn't exist. Please create it. You can omit this check with the --disable-clamav option."
492
-        exit 1
493
+	AC_MSG_RESULT(no)
494
+	AC_MSG_ERROR(User $clamav_user (and/or group $clamav_group) doesn't exist. Please read the documentation !)
493 495
     else
494
-        CLAMAVUSER="${clamav_user}"
495
-        CLAMAVGROUP="${clamav_group}"
496
+	AC_MSG_RESULT([yes, user $clamav_user and group $clamav_group])
497
+        CLAMAVUSER="$clamav_user"
498
+        CLAMAVGROUP="$clamav_group"
496 499
         AC_SUBST(CLAMAVUSER)
497 500
         AC_SUBST(CLAMAVGROUP)
498 501
     fi
... ...
@@ -537,7 +624,7 @@ if test "$have_attrib_packed" = yes; then
537 537
 	AC_DEFINE(HAVE_ATTRIB_PACKED, 1, "attrib packed")
538 538
 fi
539 539
 
540
-# Check if <sys/select.h> needs to be included for fd_set
540
+dnl Check if <sys/select.h> needs to be included for fd_set
541 541
 AC_MSG_CHECKING([for fd_set])
542 542
 AC_TRY_COMPILE([#include <sys/types.h>],
543 543
         [fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
... ...
@@ -554,7 +641,7 @@ else
554 554
     fi
555 555
 fi
556 556
 
557
-AC_MSG_CHECKING(Default FD_SETSIZE value)
557
+AC_MSG_CHECKING(default FD_SETSIZE value)
558 558
 AC_TRY_RUN([
559 559
 #include <stdio.h>
560 560
 #include <unistd.h>
... ...
@@ -27,7 +27,6 @@ then that user must have the rights to create the file.
27 27
 .LP
28 28
 
29 29
 .TP
30
-.TP
31 30
 \fB-a FROM, \-\-from=EMAIL\fR
32 31
 Source email address of notices. The default is MAILER-DAEMON.
33 32
 \fB\-h, \-\-help\fR
... ...
@@ -56,7 +55,6 @@ suite.
56 56
 \fB-A, \-\-advisory\fR
57 57
 When in advisory mode, clamav\-milter flags emails with viruses but
58 58
 still forwards them. The default option is to stop viruses.
59
-.LP
60 59
 This mode is in compatible with \-\-quarantine and \-\-quarantine-dir.
61 60
 .TP
62 61
 \fB\-b, \-\-bounce\fR
... ...
@@ -153,7 +151,6 @@ number of threads can exceed this number for short periods of time.
153 153
 There is no default, if this argument is not \fBclamav\-milter\fR will
154 154
 spawn as many children as is necessary up to the MaxThreads limit set
155 155
 in \fBclamav.conf\fR.
156
-.LP
157 156
 Most users will not need this option, if in doubt do not set it.
158 157
 .TP
159 158
 \fB\-\-dont\-wait\fR
... ...
@@ -184,7 +181,7 @@ There is no support for IPv6.
184 184
 clamav\-milter \-ol local:/var/run/clamav/clmilter.sock
185 185
 .SH "AUTHOR"
186 186
 .LP
187
-clamav\-milter was written by Nigel Horne <njh@bandsman.co.uk>, the manual page was created by Tomasz Kojm <zolw@konarski.edu.pl>.
187
+Nigel Horne <njh@clamav.net>
188 188
 .SH "SEE ALSO"
189 189
 .LP
190 190
 clamd(8), clamscan(1), freshclam(1), sigtool(1), clamav.conf(5), hosts_access(5)
... ...
@@ -17,6 +17,12 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.90  2004/07/26 17:02:56  nigelhorne
21
+ * Fix crash when debugging on SPARC
22
+ *
23
+ * Revision 1.89  2004/07/26 09:12:12  nigelhorne
24
+ * Fix crash when debugging on Solaris
25
+ *
20 26
  * Revision 1.88  2004/07/20 14:35:29  nigelhorne
21 27
  * Some MYDOOM.I were getting through
22 28
  *
... ...
@@ -252,7 +258,7 @@
252 252
  * Compilable under SCO; removed duplicate code with message.c
253 253
  *
254 254
  */
255
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.88 2004/07/20 14:35:29 nigelhorne Exp $";
255
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.90 2004/07/26 17:02:56 nigelhorne Exp $";
256 256
 
257 257
 #if HAVE_CONFIG_H
258 258
 #include "clamav-config.h"
... ...
@@ -867,8 +873,14 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
867 867
 			 */
868 868
 			for(multiparts = 0; t_line; multiparts++) {
869 869
 				int lines = 0;
870
+				message **m;
870 871
 
871
-				messages = cli_realloc(messages, ((multiparts + 1) * sizeof(message *)));
872
+				m = cli_realloc(messages, ((multiparts + 1) * sizeof(message *)));
873
+				if(m == NULL) {
874
+					multiparts--;
875
+					break;
876
+				}
877
+				messages = m;
872 878
 
873 879
 				aMessage = messages[multiparts] = messageCreate();
874 880
 				if(aMessage == NULL) {
... ...
@@ -1003,7 +1015,8 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
1003 1003
 						/* t_line = NULL;*/
1004 1004
 						break;
1005 1005
 					} else {
1006
-						messageAddLine(aMessage, line, 1);
1006
+						if(messageAddLine(aMessage, line, 1) < 0)
1007
+							break;
1007 1008
 						lines++;
1008 1009
 					}
1009 1010
 				} while((t_line = t_line->t_next) != NULL);
... ...
@@ -1752,10 +1765,10 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
1752 1752
 static int
1753 1753
 boundaryStart(const char *line, const char *boundary)
1754 1754
 {
1755
-	cli_dbgmsg("boundaryStart: line = '%s' boundary = '%s'\n", line, boundary);
1756 1755
 	if(line == NULL)
1757 1756
 		return 0;	/* empty line */
1758 1757
 
1758
+	cli_dbgmsg("boundaryStart: line = '%s' boundary = '%s'\n", line, boundary);
1759 1759
 	if(*line++ != '-')
1760 1760
 		return 0;
1761 1761
 
... ...
@@ -1793,9 +1806,9 @@ endOfMessage(const char *line, const char *boundary)
1793 1793
 {
1794 1794
 	size_t len;
1795 1795
 
1796
-	cli_dbgmsg("endOfMessage: line = '%s' boundary = '%s'\n", line, boundary);
1797 1796
 	if(line == NULL)
1798 1797
 		return 0;
1798
+	cli_dbgmsg("endOfMessage: line = '%s' boundary = '%s'\n", line, boundary);
1799 1799
 	if(*line++ != '-')
1800 1800
 		return 0;
1801 1801
 	if(*line++ != '-')
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.67  2004/07/26 08:31:04  nigelhorne
21
+ * Fix embedded multi parts
22
+ *
20 23
  * Revision 1.66  2004/07/20 15:17:44  nigelhorne
21 24
  * Remove overlapping strcpy
22 25
  *
... ...
@@ -195,7 +198,7 @@
195 195
  * uuencodebegin() no longer static
196 196
  *
197 197
  */
198
-static	char	const	rcsid[] = "$Id: message.c,v 1.66 2004/07/20 15:17:44 nigelhorne Exp $";
198
+static	char	const	rcsid[] = "$Id: message.c,v 1.67 2004/07/26 08:31:04 nigelhorne Exp $";
199 199
 
200 200
 #if HAVE_CONFIG_H
201 201
 #include "clamav-config.h"
... ...
@@ -1392,6 +1395,24 @@ messageToText(message *m)
1392 1392
 				if(strchr(line, '='))
1393 1393
 					break;
1394 1394
 		}
1395
+		if(m->base64chars) {
1396
+			unsigned char data[4];
1397
+			unsigned char *ptr;
1398
+
1399
+			ptr = decode(m, NULL, data, base64, FALSE);
1400
+			if(ptr) {
1401
+				if(first == NULL)
1402
+					first = last = cli_malloc(sizeof(text));
1403
+				else {
1404
+					last->t_next = cli_malloc(sizeof(text));
1405
+					last = last->t_next;
1406
+				}
1407
+
1408
+				if(last != NULL)
1409
+					last->t_text = data[0] ? strdup((char *)data) : NULL;
1410
+			}
1411
+			m->base64chars = 0;
1412
+		}
1395 1413
 	}
1396 1414
 
1397 1415
 	if(last)
... ...
@@ -99,7 +99,7 @@ void logg_close(void) {
99 99
 
100 100
 int logg(const char *str, ...)
101 101
 {
102
-	va_list args;
102
+	va_list args, argscpy;
103 103
 	struct flock fl;
104 104
 	char *pt, *timestr, vbuff[1025];
105 105
 	time_t currtime;
... ...
@@ -108,6 +108,8 @@ int logg(const char *str, ...)
108 108
 
109 109
 
110 110
     va_start(args, str);
111
+    /* va_copy is less portable so we just use va_start once more */
112
+    va_start(argscpy, str);
111 113
 
112 114
     if(logg_file) {
113 115
 #ifdef CL_THREAD_SAFE
... ...
@@ -193,7 +195,7 @@ int logg(const char *str, ...)
193 193
 	 *
194 194
 	 * FIXME: substitute %% instead of _
195 195
 	 */
196
-	vsnprintf(vbuff, 1024, str, args);
196
+	vsnprintf(vbuff, 1024, str, argscpy);
197 197
 	vbuff[1024] = 0;
198 198
 
199 199
 	while((pt = strchr(vbuff, '%')))
... ...
@@ -213,12 +215,13 @@ int logg(const char *str, ...)
213 213
 #endif
214 214
 
215 215
     va_end(args);
216
+    va_end(argscpy);
216 217
     return 0;
217 218
 }
218 219
 
219 220
 void mprintf(const char *str, ...)
220 221
 {
221
-	va_list args;
222
+	va_list args, argscpy;
222 223
 	FILE *fd;
223 224
 	char logbuf[512];
224 225
 
... ...
@@ -259,6 +262,8 @@ void mprintf(const char *str, ...)
259 259
 
260 260
 
261 261
     va_start(args, str);
262
+    /* va_copy is less portable so we just use va_start once more */
263
+    va_start(argscpy, str);
262 264
 
263 265
     if(*str == '!') {
264 266
 	fprintf(fd, "ERROR: ");
... ...
@@ -267,9 +272,9 @@ void mprintf(const char *str, ...)
267 267
 	fprintf(fd, "ERROR: ");
268 268
 	vfprintf(fd, ++str, args);
269 269
 #ifdef NO_SNPRINTF
270
-	vsprintf(logbuf, str, args);
270
+	vsprintf(logbuf, str, argscpy);
271 271
 #else
272
-	vsnprintf(logbuf, sizeof(logbuf), str, args);
272
+	vsnprintf(logbuf, sizeof(logbuf), str, argscpy);
273 273
 #endif
274 274
 	logg("ERROR: %s", logbuf);
275 275
     } else if(!mprintf_quiet) {
... ...
@@ -283,6 +288,7 @@ void mprintf(const char *str, ...)
283 283
     }
284 284
 
285 285
     va_end(args);
286
+    va_end(argscpy);
286 287
 
287 288
     if(fd == stdout)
288 289
 	fflush(stdout);