Browse code

GETHOSTBYNAME_R_6

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

Nigel Horne authored on 2004/07/29 15:39:50
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Jul 29 07:38:42 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Use GETHOSTBYNAME_R_6
4
+			Better load balancing if max_children = 0
5
+
1 6
 Thu Jul 29 03:31:22 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * freshclam/clamd: fix crash on PPC when LogFile was enabled together with
... ...
@@ -445,6 +445,8 @@ Changes
445 445
 		Only use gethostbyname_r on LINUX for now
446 446
 		Load balancing - improved a bit - but still some way to go
447 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
448 450
 
449 451
 BUG REPORTS
450 452
 
... ...
@@ -26,6 +26,9 @@
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
+ *
29 32
  * Revision 1.110  2004/07/26 13:23:27  nigelhorne
30 33
  * Remove stream: from template %v
31 34
  *
... ...
@@ -341,9 +344,9 @@
341 341
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
342 342
  * Added -f flag use MaxThreads if --max-children not set
343 343
  */
344
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.110 2004/07/26 13:23:27 nigelhorne Exp $";
344
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.111 2004/07/29 06:38:05 nigelhorne Exp $";
345 345
 
346
-#define	CM_VERSION	"0.75b"
346
+#define	CM_VERSION	"0.75c"
347 347
 
348 348
 /*#define	CONFDIR	"/usr/local/etc"*/
349 349
 
... ...
@@ -1377,7 +1380,10 @@ findServer(void)
1377 1377
 
1378 1378
 	FD_ZERO(&rfds);
1379 1379
 
1380
-	j = n_children - 1;	/* Don't worry about no lock */
1380
+	if(max_children > 0)
1381
+		j = n_children - 1;	/* Don't worry about no lock */
1382
+	else
1383
+		j = cli_rndnum(numServers) - 1;
1381 1384
 
1382 1385
 	for(i = 0, server = servers; i < numServers; i++, server++) {
1383 1386
 		int sock;
... ...
@@ -1526,7 +1532,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1526 1526
 		 * TODO: gethostbyname_r is non-standard so different operating
1527 1527
 		 * systems do it in different ways. Need more examples
1528 1528
 		 */
1529
-#if	defined(HAVE_GETHOSTBYNAME_R) && defined(C_LINUX)
1529
+#ifdef	HAVE_GETHOSTBYNAME_R_6
1530 1530
 		struct hostent *hp, hostent;
1531 1531
 		char buf[BUFSIZ];
1532 1532
 		int ret;
... ...
@@ -1545,7 +1551,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1545 1545
 			hostmail = "unknown";
1546 1546
 		}
1547 1547
 
1548
-#ifdef	HAVE_GETHOSTBYNAME_R
1548
+#ifdef	HAVE_GETHOSTBYNAME_R_6
1549 1549
 		if(gethostbyname_r(hostmail, &hostent, buf, sizeof(buf), &hp, &ret) != 0) {
1550 1550
 			if(use_syslog)
1551 1551
 				syslog(LOG_WARNING, "Access Denied: Host Unknown (%s)", hostname);