Browse code

Up issue

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

Nigel Horne authored on 2004/05/16 17:26:21
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sun May 16 09:25:37 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Up issue
4
+
1 5
 Sun May 16 03:00:45 CEST 2004 (tk)
2 6
 ----------------------------------
3 7
   * clamd: fix logging wording in poll() error message (Joe Maimon
... ...
@@ -390,6 +390,7 @@ Changes
390 390
 		Fix from Damian Menscher <menscher@uiuc.edu> ensures that when
391 391
 			a child dies we continue when max children is hit
392 392
 		Report an error if inet_ntop fails in tcp_wrappers
393
+0.71	16/5/04	Up issue
393 394
 
394 395
 BUG REPORTS
395 396
 
... ...
@@ -394,9 +394,13 @@
394 394
  *				that when a child dies we continue when max
395 395
  *				children is hit
396 396
  *			Report an error if inet_ntop fails in tcp_wrappers
397
+ *	0.71	16/5/04	Up issue
397 398
  *
398 399
  * Change History:
399 400
  * $Log: clamav-milter.c,v $
401
+ * Revision 1.88  2004/05/16 08:25:09  nigelhorne
402
+ * Up issue
403
+ *
400 404
  * Revision 1.87  2004/05/09 17:39:04  nigelhorne
401 405
  * Waiting threads weren't being woken up
402 406
  *
... ...
@@ -643,9 +647,9 @@
643 643
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
644 644
  * Added -f flag use MaxThreads if --max-children not set
645 645
  */
646
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.87 2004/05/09 17:39:04 nigelhorne Exp $";
646
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.88 2004/05/16 08:25:09 nigelhorne Exp $";
647 647
 
648
-#define	CM_VERSION	"0.70x"
648
+#define	CM_VERSION	"0.71"
649 649
 
650 650
 /*#define	CONFDIR	"/usr/local/etc"*/
651 651
 
... ...
@@ -1227,14 +1231,9 @@ main(int argc, char **argv)
1227 1227
 	if(sigFilename && !updateSigFile())
1228 1228
 		return EX_USAGE;
1229 1229
 
1230
-	if(templatefile) {
1231
-		int fd = open(templatefile, O_RDONLY);
1232
-
1233
-		if(fd < 0) {
1234
-			perror(templatefile);
1235
-			return EX_CONFIG;
1236
-		}
1237
-		close(fd);
1230
+	if(templatefile && (access(templatefile, R_OK) < 0)) {
1231
+		perror(templatefile);
1232
+		return EX_CONFIG;
1238 1233
 	}
1239 1234
 
1240 1235
 	if(!cfgopt(copt, "StreamSaveToDisk")) {
... ...
@@ -1776,7 +1775,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1776 1776
 		}
1777 1777
 
1778 1778
 #ifdef HAVE_INET_NTOP
1779
-		if(inet_ntop(AF_INET, &((struct sockaddr_in *)(hp->h_addr))->sin_addr, ip, sizeof(ip)) == NULL) {
1779
+		if(inet_ntop(AF_INET, (struct in_addr *)hp->h_addr, ip, sizeof(ip)) == NULL) {
1780 1780
 			perror(hp->h_name);
1781 1781
 			/*if(use_syslog)
1782 1782
 				syslog(LOG_WARNING, "Can't get IP address for (%s)", hp->h_name);
... ...
@@ -1786,7 +1785,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1786 1786
 			return cl_error;
1787 1787
 		}
1788 1788
 #else
1789
-		strcpy(ip, (char *)inet_ntoa(*(struct in_addr *)hp->h_addr));
1789
+		strncpy(ip, (char *)inet_ntoa(*(struct in_addr *)hp->h_addr), sizeof(ip) - 1);
1790 1790
 #endif
1791 1791
 
1792 1792
 		/*
... ...
@@ -2688,7 +2687,7 @@ clamfi_send(struct privdata *privdata, size_t len, const char *format, ...)
2688 2688
 		va_list argp;
2689 2689
 
2690 2690
 		va_start(argp, format);
2691
-		vsnprintf(output, sizeof(output), format, argp);
2691
+		vsnprintf(output, sizeof(output) - 1, format, argp);
2692 2692
 		va_end(argp);
2693 2693
 
2694 2694
 		len = strlen(output);
... ...
@@ -3143,8 +3142,11 @@ checkClamd(void)
3143 3143
 		return;
3144 3144
 	}
3145 3145
 	nbytes = read(fd, buf, sizeof(buf) - 1);
3146
+	if(nbytes < 0)
3147
+		perror(pidFile);
3148
+	else
3149
+		buf[nbytes] = '\0';
3146 3150
 	close(fd);
3147
-	buf[nbytes] = '\0';
3148 3151
 	pid = atoi(buf);
3149 3152
 	if((kill(pid, 0) < 0) && (errno == ESRCH)) {
3150 3153
 		if(use_syslog)