Only in mlmmj-1.2.11-mod/listtexts/de: maxmailsize
Only in mlmmj-1.2.11-mod/listtexts: maxmailsize
diff -ru mlmmj-1.2.11/src/mlmmj-process.c mlmmj-1.2.11-mod/src/mlmmj-process.c
--- mlmmj-1.2.11/src/mlmmj-process.c	2006-01-23 18:44:53.000000000 +0100
+++ mlmmj-1.2.11-mod/src/mlmmj-process.c	2006-06-13 16:41:20.000000000 +0200
@@ -316,7 +316,9 @@
 	int i, j, opt, noprocess = 0, moderated = 0;
 	int hdrfd, footfd, rawmailfd, donemailfd;
 	int subonlypost = 0, addrtocc = 1, intocc = 0;
+	int maxmailsize = 0;
 	int notoccdenymails = 0, noaccessdenymails = 0, nosubonlydenymails = 0;
+	int nomaxmailsizedenymails = 0;
 	char *listdir = NULL, *mailfile = NULL, *headerfilename = NULL;
 	char *footerfilename = NULL, *donemailname = NULL;
 	char *randomstr = NULL, *mqueuename;
@@ -324,6 +326,7 @@
 	char *bindir, *subjectprefix, *discardname, *listaddr, *listdelim;
 	char *listfqdn, *listname, *fromaddr;
 	char *queuefilename, *recipextra, *owner = NULL;
+	char *maxmailsizestr;
 	char *maildata[2] = { "posteraddr", NULL };
 	struct stat st;
 	uid_t uid;
@@ -581,6 +584,72 @@
 		return EXIT_SUCCESS;
 	}
 
+	/* this declaration is needed here... */
+	listaddr = getlistaddr(listdir);
+	alternates = ctrlvalues(listdir, "listaddress");
+	
+	/* checking incoming mail's size */
+	/* log_error(LOG_ARGS, "%d", statctrl(listdir, "maxmailsize"));*/
+	maxmailsize = statctrl(listdir, "maxmailsize");
+	if(maxmailsize) {
+		maxmailsizestr = ctrlvalue(listdir, "maxmailsize");
+		if(maxmailsizestr) {
+			maxmailsize = atol(maxmailsizestr);
+			myfree(maxmailsizestr);
+			/*log_error(LOG_ARGS, "max = %d", maxmailsize);*/
+			if(stat(donemailname, &st) < 0) {
+				log_error(LOG_ARGS, "something went wrong"
+					" during stat(%s,..)", donemailname);
+			}
+			nomaxmailsizedenymails = statctrl(listdir, "nomaxmailsizedenymails");
+			if((st.st_size > maxmailsize) && nomaxmailsizedenymails) {
+				/*log_error(LOG_ARGS, "%d", nomaxmailsizedenymails);*/
+				log_error(LOG_ARGS, "discarding mail %s due to"
+						" size limit (%d bytes too big) \n",
+						donemailname, (st.st_size - maxmailsize));
+				/*myfree(nomaxmailsizedenymails);
+				myfree(maxmailsize);
+				myfree(st);*/ /* XXX: do we need this? */
+				unlink(donemailname);
+				myfree(donemailname);
+				exit(EXIT_SUCCESS);
+			}
+			if((st.st_size > maxmailsize)) {
+				/*log_error(LOG_ARGS, "%s is %d bytes too big.\n",
+						donemailname, (st.st_size - maxmailsize));*/
+				listdelim = getlistdelim(listdir);
+				listname = genlistname(listaddr);
+				listfqdn = genlistfqdn(listaddr);
+				fromaddr = concatstr(4, listname, listdelim, "bounces-help@",
+						     listfqdn);
+				queuefilename = prepstdreply(listdir, "maxmailsize",
+						"$listowner$", fromemails.emaillist[0],
+						NULL, 0, NULL);
+				MY_ASSERT(queuefilename)
+				/*myfree(nomaxmailsizedenymails);
+				myfree(maxmailsize);
+				myfree(st);*/ /* XXX: do we need this? */
+				myfree(listdelim);
+				myfree(listname);
+				myfree(listfqdn);
+				unlink(donemailname);
+				myfree(donemailname);
+				execlp(mlmmjsend, mlmmjsend,
+						"-l", "1",
+						"-L", listdir,
+						"-T", fromemails.emaillist[0],
+						"-F", fromaddr,
+						"-m", queuefilename, (char *)NULL);
+	
+				log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
+				exit(EXIT_FAILURE);
+	
+			}
+		}
+	}
+	/*myfree(maxmailsize);
+	myfree(nomaxmailsizedenymails);*/ /* do we need this? */
+
 	/* discard malformed mail with invalid From: */
 	if(fromemails.emailcount != 1) { 
 		for(i = 0; i < fromemails.emailcount; i++)
@@ -623,8 +692,9 @@
 
 	unlink(mailfile);
 
+	/* maxmailsize need this earlier...
 	listaddr = getlistaddr(listdir);
-	alternates = ctrlvalues(listdir, "listaddress");
+	alternates = ctrlvalues(listdir, "listaddress"); */
 
 	addrtocc = !(statctrl(listdir, "tocc"));
 	if(addrtocc) {
diff -ru mlmmj-1.2.11/TUNABLES mlmmj-1.2.11-mod/TUNABLES
--- mlmmj-1.2.11/TUNABLES	2005-12-20 10:52:48.000000000 +0100
+++ mlmmj-1.2.11-mod/TUNABLES	2006-06-13 16:57:13.000000000 +0200
@@ -155,3 +155,12 @@
 
    This specifies what to use as recipient delimiter for the list.
    Default is "+".
+
+ · maxmailsize			(normal)
+
+   With this option the maximal allowed size of incoming mails can be specified.
+
+ · nomaxmailsizedenymails	(boolean)
+
+   If this is set, no reject notifications caused by violation of maxmailsize
+   will be sent.

