Browse code

Code tidy up

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

Nigel Horne authored on 2004/04/08 22:15:17
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Apr  8 14:27:30 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Removed warning message on FreeBSD5.2
4
+
1 5
 Wed Apr  7 19:31:29 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * Handle continuation markers placed incorrectly by W97M.Lexar
... ...
@@ -315,6 +315,7 @@ Changes
315 315
 		ThreadTimeout seems to have been changed to ReadTimeout
316 316
 0.70g	3/4/04	Error if ReadTimeout is -ve
317 317
 		Honour StreamMaxLength
318
+0.70h	8/4/04	Cleanup StreamMaxLength code
318 319
 
319 320
 BUG REPORTS
320 321
 
... ...
@@ -314,9 +314,13 @@
314 314
  *			ThreadTimeout seems to have been changed to ReadTimeout
315 315
  *	0.70g	3/4/04	Error if ReadTimeout is -ve
316 316
  *			Honour StreamMaxLength
317
+ *	0.70h	8/4/04	Cleanup StreamMaxLength code
317 318
  *
318 319
  * Change History:
319 320
  * $Log: clamav-milter.c,v $
321
+ * Revision 1.71  2004/04/08 13:14:07  nigelhorne
322
+ * Code tidy up
323
+ *
320 324
  * Revision 1.70  2004/04/06 22:43:43  kojm
321 325
  * reverse strlcpy/strlcat patch
322 326
  *
... ...
@@ -512,9 +516,9 @@
512 512
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
513 513
  * Added -f flag use MaxThreads if --max-children not set
514 514
  */
515
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.70 2004/04/06 22:43:43 kojm Exp $";
515
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.71 2004/04/08 13:14:07 nigelhorne Exp $";
516 516
 
517
-#define	CM_VERSION	"0.70g"
517
+#define	CM_VERSION	"0.70h"
518 518
 
519 519
 /*#define	CONFDIR	"/usr/local/etc"*/
520 520
 
... ...
@@ -624,7 +628,7 @@ struct	privdata {
624 624
 	u_char	*body;		/* body of the message if Sflag is set */
625 625
 	size_t	bodyLen;	/* number of bytes in body */
626 626
 	header_list_t headers;	/* Message headers */
627
-	off_t	numBytes;	/* Number of bytes sent so far */
627
+	long	numBytes;	/* Number of bytes sent so far */
628 628
 };
629 629
 
630 630
 static	int		pingServer(int serverNumber);
... ...
@@ -711,7 +715,7 @@ static	int	readTimeout = CL_DEFAULT_SCANTIMEOUT; /*
711 711
 				 * number of seconds to wait for clamd to
712 712
 				 * respond, see ReadTimeout in clamav.conf
713 713
 				 */
714
-static	off_t	streamMaxLength = -1;	/* StreamMaxLength from clamav.conf */
714
+static	long	streamMaxLength = -1;	/* StreamMaxLength from clamav.conf */
715 715
 static	int	logClean = 1;	/*
716 716
 				 * Add clean items to the log file
717 717
 				 */
... ...
@@ -1098,7 +1102,7 @@ main(int argc, char **argv)
1098 1098
 				argv[0], cfgfile);
1099 1099
 			return EX_CONFIG;
1100 1100
 		}
1101
-		streamMaxLength = cpt->numarg;
1101
+		streamMaxLength = (long)cpt->numarg;
1102 1102
 	}
1103 1103
 	/*
1104 1104
 	 * Get the outgoing socket details - the way to talk to clamd
... ...
@@ -1688,8 +1692,8 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
1688 1688
 
1689 1689
 	privdata->from = strdup(argv[0]);
1690 1690
 
1691
-	if(streamMaxLength > 0)
1692
-		privdata->numBytes = strlen(argv[0]) + 6;
1691
+	if(streamMaxLength > 0L)
1692
+		privdata->numBytes = (long)(strlen(argv[0]) + 6);
1693 1693
 
1694 1694
 	if(hflag)
1695 1695
 		privdata->headers = header_list_new();
... ...
@@ -1722,8 +1726,8 @@ clamfi_envrcpt(SMFICTX *ctx, char **argv)
1722 1722
 	privdata->to[privdata->numTo] = strdup(argv[0]);
1723 1723
 	privdata->to[++privdata->numTo] = NULL;
1724 1724
 
1725
-	if(streamMaxLength > 0)
1726
-		privdata->numBytes += strlen(argv[0]) + 4;
1725
+	if(streamMaxLength > 0L)
1726
+		privdata->numBytes += (long)(strlen(argv[0]) + 4);
1727 1727
 
1728 1728
 	return SMFIS_CONTINUE;
1729 1729
 }
... ...
@@ -1756,8 +1760,8 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv)
1756 1756
 		return cl_error;
1757 1757
 	}
1758 1758
 
1759
-	if(streamMaxLength > 0)
1760
-		privdata->numBytes += strlen(headerf) + strlen(headerv) + 3;
1759
+	if(streamMaxLength > 0L)
1760
+		privdata->numBytes += (long)(strlen(headerf) + strlen(headerv) + 3);
1761 1761
 
1762 1762
 	if(hflag)
1763 1763
 		header_list_add(privdata->headers, headerf, headerv);
... ...
@@ -1791,7 +1795,7 @@ clamfi_eoh(SMFICTX *ctx)
1791 1791
 		clamfi_cleanup(ctx);
1792 1792
 		return cl_error;
1793 1793
 	}
1794
-	if(streamMaxLength > 0)
1794
+	if(streamMaxLength > 0L)
1795 1795
 		privdata->numBytes++;
1796 1796
 
1797 1797
 	/*
... ...
@@ -1849,8 +1853,8 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len)
1849 1849
 	cli_dbgmsg("clamfi_envbody: %u bytes\n", len);
1850 1850
 #endif
1851 1851
 
1852
-	if(streamMaxLength > 0) {
1853
-		privdata->numBytes += len;
1852
+	if(streamMaxLength > 0L) {
1853
+		privdata->numBytes += (long)len;
1854 1854
 		if(privdata->numBytes > streamMaxLength) {
1855 1855
 			if(use_syslog)
1856 1856
 				syslog(LOG_NOTICE, "%s: Message more than StreamMaxLength (%ld) bytes - not scanned\n",