Browse code

Use limits.maxmailrec

git-svn: trunk@2562

Nigel Horne authored on 2006/12/20 00:42:08
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Dec 19 15:41:35 GMT 2006 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Use limits.maxmailrec (patch from TK)
4
+
1 5
 Mon Dec 18 17:04:31 GMT 2006 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/mbox.c:	Use limits.maxmailrec (patch from TK)
... ...
@@ -24,9 +24,9 @@
24 24
  *
25 25
  * For installation instructions see the file INSTALL that came with this file
26 26
  */
27
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.304 2006/12/13 16:54:21 njh Exp $";
27
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.305 2006/12/19 15:41:16 njh Exp $";
28 28
 
29
-#define	CM_VERSION	"devel-111206"
29
+#define	CM_VERSION	"devel-191206"
30 30
 
31 31
 #if HAVE_CONFIG_H
32 32
 #include "clamav-config.h"
... ...
@@ -1204,10 +1204,11 @@ main(int argc, char **argv)
1204 1204
 	 * If the --max-children flag isn't set, see if MaxThreads
1205 1205
 	 * is set in the config file
1206 1206
 	 */
1207
-	if((max_children == 0) && ((cpt = cfgopt(copt, "MaxThreads")) != NULL) && cpt->enabled)
1208
-		max_children = cpt->numarg;
1207
+	if(max_children == 0)
1208
+	if((max_children == 0) && ((cpt = cfgopt(copt, "MaxThreads")) != NULL))
1209
+		max_children = cfgopt(copt, "MaxThreads")->numarg;
1209 1210
 
1210
-	if(((cpt = cfgopt(copt, "ReadTimeout")) != NULL) && cpt->enabled) {
1211
+	if((cpt = cfgopt(copt, "ReadTimeout")) != NULL) {
1211 1212
 		readTimeout = cpt->numarg;
1212 1213
 
1213 1214
 		if(readTimeout < 0) {
... ...
@@ -1215,19 +1216,18 @@ main(int argc, char **argv)
1215 1215
 				argv[0], cfgfile);
1216 1216
 			return EX_CONFIG;
1217 1217
 		}
1218
-	} else
1219
-		readTimeout = DEFAULT_TIMEOUT;
1218
+	}
1220 1219
 
1221
-	if(((cpt = cfgopt(copt, "StreamMaxLength")) != NULL) && cpt->enabled) {
1222
-		if(cpt->numarg < 0) {
1220
+	if((cpt = cfgopt(copt, "StreamMaxLength")) != NULL) {
1221
+		streamMaxLength = (long)cpt->numarg;
1222
+		if(streamMaxLength < 0L) {
1223 1223
 			fprintf(stderr, _("%s: StreamMaxLength must not be negative in %s\n"),
1224
-				argv[0], cfgfile);
1224
+			argv[0], cfgfile);
1225 1225
 			return EX_CONFIG;
1226 1226
 		}
1227
-		streamMaxLength = (long)cpt->numarg;
1228 1227
 	}
1229 1228
 
1230
-	if(cfgopt(copt, "LogSyslog")->enabled) {
1229
+	if(((cpt = cfgopt(copt, "LogSyslog")) != NULL) && cpt->enabled) {
1231 1230
 		int fac = LOG_LOCAL6;
1232 1231
 
1233 1232
 		if(cfgopt(copt, "LogVerbose")->enabled) {
... ...
@@ -1719,6 +1719,9 @@ main(int argc, char **argv)
1719 1719
 
1720 1720
 		memset(&limits, '\0', sizeof(struct cl_limits));
1721 1721
 
1722
+		if(((cpt = cfgopt(copt, "MailMaxRecursion")) != NULL) && cpt->enabled)
1723
+			limits.maxmailrec = cpt->numarg;
1724
+
1722 1725
 		if(cfgopt(copt, "ScanArchive")->enabled) {
1723 1726
 			options |= CL_SCAN_ARCHIVE;
1724 1727
 			if(((cpt = cfgopt(copt, "ArchiveMaxFileSize")) != NULL) && cpt->enabled)
... ...
@@ -5284,7 +5287,7 @@ loadDatabase(void)
5284 5284
 		 * First time through, find out in which directory the signature
5285 5285
 		 * databases are
5286 5286
 		 */
5287
-		if(((cpt = cfgopt(copt, "DatabaseDirectory")) || (cpt = cfgopt(copt, "DataDirectory"))) && cpt->enabled)
5287
+		if((cpt = cfgopt(copt, "DatabaseDirectory")) && cpt->enabled)
5288 5288
 			dbdir = cpt->strarg;
5289 5289
 		else
5290 5290
 			dbdir = cl_retdbdir();