changeset 484:2855bbfb74fe

Allow bounces with no From:
author mmj
date Thu, 28 Apr 2005 20:04:11 +1000
parents ec080ab4e9e7
children d57cdfc7e17a
files ChangeLog src/listcontrol.c src/mlmmj-process.c
diffstat 3 files changed, 27 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 28 17:52:06 2005 +1000
+++ b/ChangeLog	Thu Apr 28 20:04:11 2005 +1000
@@ -1,3 +1,8 @@
+ o Bouncing confirmation mails of sub or unsub should be cleaned from
+   the queue as well
+ o Normally mails which doesn't have exactly one From: emailaddress are
+   discarded but certain ISPs have bounce mails with no From: header, forcing
+   us to allow bounce mails with no From: to make sure they're caught
  o In case of a succesful DSN parse, we werent deleting the mail, and thus
    littering the queue
  o When sending moderated mails, rename them so that they wont be moderated
--- a/src/listcontrol.c	Thu Apr 28 17:52:06 2005 +1000
+++ b/src/listcontrol.c	Thu Apr 28 20:04:11 2005 +1000
@@ -166,6 +166,14 @@
 		}
 	}
 
+	/* Only allow mails with bad From: header to be bounce mails */
+	if(fromemails->emailcount != 1 && ctrl != CTRL_BOUNCES) {
+		log_error(LOG_ARGS, "Discarding mail with invalid From: "
+				"which was not a bounce");
+		unlink(mailname);
+		exit(EXIT_SUCCESS);
+	}
+
 	switch (ctrl) {
 
 	/* listname+subscribe-digest@domain.tld */
--- a/src/mlmmj-process.c	Thu Apr 28 17:52:06 2005 +1000
+++ b/src/mlmmj-process.c	Thu Apr 28 20:04:11 2005 +1000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Mads Martin Joergensen <mmj at mmj.dk>
+/* Copyright (C) 2003, 2003, 2004 Mads Martin Joergensen <mmj at mmj.dk>
  *
  * $Id$
  *
@@ -473,18 +473,6 @@
 		for(i = 0; i < readhdrs[0].valuecount; i++) {
 			find_email_adr(readhdrs[0].values[i], &fromemails);
 		}
-		if(fromemails.emailcount != 1) { /* discard malformed mail */
-			discardname = concatstr(3, listdir,
-						"/queue/discarded/",
-						randomstr);
-			rename(mailfile, discardname);
-			unlink(donemailname);
-			myfree(donemailname);
-			myfree(discardname);
-			myfree(randomstr);
-			/* TODO: free emailstructs */
-			exit(EXIT_SUCCESS);
-		}
 	}
 
 	if(readhdrs[1].token) { /* To: addresses */
@@ -584,6 +572,19 @@
 		return EXIT_SUCCESS;
 	}
 
+	/* discard malformed mail with invalid From: */
+	if(fromemails.emailcount != 1) { 
+		discardname = concatstr(3, listdir,
+				"/queue/discarded/", randomstr);
+		rename(mailfile, discardname);
+		unlink(donemailname);
+		myfree(donemailname);
+		myfree(discardname);
+		myfree(randomstr);
+		/* TODO: free emailstructs */
+		exit(EXIT_SUCCESS);
+	}
+
 	myfree(delheaders);
 
 	if(efromemails.emailcount != 1) { /* don't send mails with <> in From