changeset 106:1f0d63713a1c

masqmail now *always* removes Bcc: headers this is the most simple way and taken by other MTAs (courier, postfix) too
author meillo@marmaro.de
date Tue, 29 Jun 2010 10:37:18 +0200 (2010-06-29)
parents 47ee3fbcecd2
children 9104234a56a5
files man/masqmail.8 src/accept.c src/masqmail.c src/masqmail.h
diffstat 4 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/man/masqmail.8	Tue Jun 29 10:20:09 2010 +0200
+++ b/man/masqmail.8	Tue Jun 29 10:37:18 2010 +0200
@@ -214,6 +214,7 @@
 
 Read recipients from headers.
 Delete `Bcc:' headers.
+(Since 0.2.25, masqmail deletes Bcc: headers in all cases.)
 If any arguments are given, these are interpreted as recipient addresses
 and the message will not be sent to these,
 although they might appear in To:, Cc:, or Bcc: headers.
--- a/src/accept.c	Tue Jun 29 10:20:09 2010 +0200
+++ b/src/accept.c	Tue Jun 29 10:37:18 2010 +0200
@@ -214,7 +214,6 @@
 		gboolean has_date = FALSE;
 		gboolean has_sender = FALSE;
 		gboolean has_from = FALSE;
-		gboolean has_rcpt = FALSE;
 		gboolean has_to_or_cc = FALSE;
 		GList *hdr_node, *hdr_node_next;
 		header *hdr;
@@ -239,21 +238,21 @@
 				break;
 			case HEAD_TO:
 			case HEAD_CC:
+				has_to_or_cc = TRUE;
+				/* fall through */
 			case HEAD_BCC:
-				has_rcpt = TRUE;
 				if (flags & ACC_RCPT_FROM_HEAD) {
 					DEBUG(5) debugf("hdr->value = %s\n", hdr->value);
 					if (hdr->value) {
 						msg->rcpt_list = addr_list_append_rfc822(msg->rcpt_list, hdr->value, conf.host_name);
 					}
 				}
-				if ((flags & ACC_DEL_BCC) && (hdr->id == HEAD_BCC)) {
+				if (hdr->id == HEAD_BCC) {
 					DEBUG(3) debugf("removing 'Bcc' header\n");
 					msg->hdr_list = g_list_remove_link(msg->hdr_list, hdr_node);
 					g_list_free_1(hdr_node);
 					destroy_header(hdr);
-				} else
-					has_to_or_cc = TRUE;
+				}
 				break;
 			case HEAD_ENVELOPE_TO:
 				if (flags & ACC_SAVE_ENVELOPE_TO) {
@@ -349,15 +348,10 @@
 			                                msg->return_path->local_part, msg->return_path->domain)
 			                );
 		}
-		if ((flags & ACC_HEAD_FROM_RCPT) && !has_rcpt) {
-			DEBUG(3) debugf("no To: or Cc: header, hence adding `undisclosed recipients' header\n");
+		if (!has_to_or_cc) {
+			DEBUG(3) debugf("no To: or Cc: header, hence adding `To: undisclosed recipients:;'\n");
 			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_TO, "To: undisclosed-recipients:;\n"));
 		}
-		if ((flags & ACC_DEL_BCC) && !has_to_or_cc) {
-			/* Bcc headers have been removed, and there are no remaining rcpt headers */
-			DEBUG(3) debugf("adding empty 'Bcc:' header\n");
-			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_BCC, "Bcc:\n"));
-		}
 		if (!has_date) {
 			DEBUG(3) debugf("adding 'Date:' header\n");
 			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_DATE, "Date: %s\n", rec_timestamp()));
--- a/src/masqmail.c	Tue Jun 29 10:20:09 2010 +0200
+++ b/src/masqmail.c	Tue Jun 29 10:37:18 2010 +0200
@@ -813,7 +813,7 @@
 
 	case MODE_ACCEPT:
 		{
-			guint accept_flags = (opt_t ? ACC_DEL_RCPTS | ACC_DEL_BCC | ACC_RCPT_FROM_HEAD : ACC_HEAD_FROM_RCPT)
+			guint accept_flags = (opt_t ? ACC_DEL_RCPTS | ACC_RCPT_FROM_HEAD : ACC_HEAD_FROM_RCPT)
 			                     | (opt_i ? ACC_NODOT_TERM : ACC_NODOT_RELAX);
 			mode_accept(return_path, full_sender_name, accept_flags, &(argv[arg]), argc - arg);
 			exit(exit_failure ? EXIT_FAILURE : EXIT_SUCCESS);
--- a/src/masqmail.h	Tue Jun 29 10:20:09 2010 +0200
+++ b/src/masqmail.h	Tue Jun 29 10:37:18 2010 +0200
@@ -311,7 +311,6 @@
 /*#define ACC_LOCAL      0x01 (we better use received_host == NULL) */
 #define ACC_HEAD_FROM_RCPT 0x01  /* create To: Header from rcpt_list (cmd line) */
 #define ACC_DEL_RCPTS      0x02  /* -t option, delete rcpts */
-#define ACC_DEL_BCC        0x04  /* -t option, delete Bcc header */
 #define ACC_RCPT_FROM_HEAD 0x08  /* -t option, get rcpts from headers */
 #define ACC_NODOT_TERM     0x10  /* a dot on a line itself does not end the message (-oi option) */
 #define ACC_MAIL_FROM_HEAD 0x40  /* get return path from header */