report a bug |  advanced search |  statistics |  developer log in/out
Return to Bug #50
Patch optionally-accept-bounces.diff revision 2013-11-28 19:51 UTC by timo dot boettcher at redteam-pentesting dot de

Patch optionally-accept-bounces.diff for Generic Bug #50

Patch version 2013-11-28 19:51 UTC

Return to Bug #50 | Download this patch
Patch Revisions:

Developer: timo.boettcher@redteam-pentesting.de

--- a/src/mlmmj-process.c	2013-10-25 13:09:00.000000000 +0200
+++ b/src/mlmmj-process.c	2013-10-25 13:09:29.000000000 +0200
@@ -420,6 +420,7 @@
 	enum modreason modreason;
 	int hdrfd, footfd, rawmailfd, donemailfd, omitfd;
 	int addrtocc = 1, intocc = 0;
+	int discardbounces = 0;
 	int maxmailsize = 0;
 	int notmetoo = 0;
 	char *listdir = NULL, *mailfile = NULL, *headerfilename = NULL;
@@ -802,21 +803,24 @@
 
 	myfree(delheaders);
 
-	if(strcmp(efrom, "") == 0) { /* don't send mails with <> in From
-					     to the list */
-		discardname = concatstr(3, listdir,
-				"/queue/discarded/",
-				randomstr);
-		errno = 0;
-		log_error(LOG_ARGS, "Discarding %s due to missing envelope"
-				" from address", mailfile);
-		rename(mailfile, discardname);
-		unlink(donemailname);
-		myfree(donemailname);
-		myfree(discardname);
-		myfree(randomstr);
-		/* TODO: free emailstructs */
-		exit(EXIT_SUCCESS);
+	discardbounces = !(statctrl(listdir, "acceptbounces"));
+	if(discardbounces) {
+		if(strcmp(efrom, "") == 0) { /* don't send mails with <> in From
+								 to the list */
+			discardname = concatstr(3, listdir,
+					"/queue/discarded/",
+					randomstr);
+			errno = 0;
+			log_error(LOG_ARGS, "Discarding %s due to missing envelope"
+					" from address", mailfile);
+			rename(mailfile, discardname);
+			unlink(donemailname);
+			myfree(donemailname);
+			myfree(discardname);
+			myfree(randomstr);
+			/* TODO: free emailstructs */
+			exit(EXIT_SUCCESS);
+		}
 	}
 
 	unlink(mailfile);
--- a/TUNABLES	2012-05-29 15:34:00.000000000 +0200
+++ b/TUNABLES	2013-10-25 13:24:17.000000000 +0200
@@ -40,6 +40,10 @@
    If this file is present, the list address does not have to be in the To:
    or Cc: header of the email to the list.
 
+ · acceptbounces		(boolean)
+
+   If this file is present, bounces are accepted as list posts.
+
  · subonlypost			(boolean)
 
    When this file is present, only people who are subscribed to the list,
 
Based on the PHP bug tracker.
Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 30 01:27:44 2013 UTC