masqmail

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
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 diff
     1.1 --- a/man/masqmail.8	Tue Jun 29 10:20:09 2010 +0200
     1.2 +++ b/man/masqmail.8	Tue Jun 29 10:37:18 2010 +0200
     1.3 @@ -214,6 +214,7 @@
     1.4  
     1.5  Read recipients from headers.
     1.6  Delete `Bcc:' headers.
     1.7 +(Since 0.2.25, masqmail deletes Bcc: headers in all cases.)
     1.8  If any arguments are given, these are interpreted as recipient addresses
     1.9  and the message will not be sent to these,
    1.10  although they might appear in To:, Cc:, or Bcc: headers.
     2.1 --- a/src/accept.c	Tue Jun 29 10:20:09 2010 +0200
     2.2 +++ b/src/accept.c	Tue Jun 29 10:37:18 2010 +0200
     2.3 @@ -214,7 +214,6 @@
     2.4  		gboolean has_date = FALSE;
     2.5  		gboolean has_sender = FALSE;
     2.6  		gboolean has_from = FALSE;
     2.7 -		gboolean has_rcpt = FALSE;
     2.8  		gboolean has_to_or_cc = FALSE;
     2.9  		GList *hdr_node, *hdr_node_next;
    2.10  		header *hdr;
    2.11 @@ -239,21 +238,21 @@
    2.12  				break;
    2.13  			case HEAD_TO:
    2.14  			case HEAD_CC:
    2.15 +				has_to_or_cc = TRUE;
    2.16 +				/* fall through */
    2.17  			case HEAD_BCC:
    2.18 -				has_rcpt = TRUE;
    2.19  				if (flags & ACC_RCPT_FROM_HEAD) {
    2.20  					DEBUG(5) debugf("hdr->value = %s\n", hdr->value);
    2.21  					if (hdr->value) {
    2.22  						msg->rcpt_list = addr_list_append_rfc822(msg->rcpt_list, hdr->value, conf.host_name);
    2.23  					}
    2.24  				}
    2.25 -				if ((flags & ACC_DEL_BCC) && (hdr->id == HEAD_BCC)) {
    2.26 +				if (hdr->id == HEAD_BCC) {
    2.27  					DEBUG(3) debugf("removing 'Bcc' header\n");
    2.28  					msg->hdr_list = g_list_remove_link(msg->hdr_list, hdr_node);
    2.29  					g_list_free_1(hdr_node);
    2.30  					destroy_header(hdr);
    2.31 -				} else
    2.32 -					has_to_or_cc = TRUE;
    2.33 +				}
    2.34  				break;
    2.35  			case HEAD_ENVELOPE_TO:
    2.36  				if (flags & ACC_SAVE_ENVELOPE_TO) {
    2.37 @@ -349,15 +348,10 @@
    2.38  			                                msg->return_path->local_part, msg->return_path->domain)
    2.39  			                );
    2.40  		}
    2.41 -		if ((flags & ACC_HEAD_FROM_RCPT) && !has_rcpt) {
    2.42 -			DEBUG(3) debugf("no To: or Cc: header, hence adding `undisclosed recipients' header\n");
    2.43 +		if (!has_to_or_cc) {
    2.44 +			DEBUG(3) debugf("no To: or Cc: header, hence adding `To: undisclosed recipients:;'\n");
    2.45  			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_TO, "To: undisclosed-recipients:;\n"));
    2.46  		}
    2.47 -		if ((flags & ACC_DEL_BCC) && !has_to_or_cc) {
    2.48 -			/* Bcc headers have been removed, and there are no remaining rcpt headers */
    2.49 -			DEBUG(3) debugf("adding empty 'Bcc:' header\n");
    2.50 -			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_BCC, "Bcc:\n"));
    2.51 -		}
    2.52  		if (!has_date) {
    2.53  			DEBUG(3) debugf("adding 'Date:' header\n");
    2.54  			msg->hdr_list = g_list_append(msg->hdr_list, create_header(HEAD_DATE, "Date: %s\n", rec_timestamp()));
     3.1 --- a/src/masqmail.c	Tue Jun 29 10:20:09 2010 +0200
     3.2 +++ b/src/masqmail.c	Tue Jun 29 10:37:18 2010 +0200
     3.3 @@ -813,7 +813,7 @@
     3.4  
     3.5  	case MODE_ACCEPT:
     3.6  		{
     3.7 -			guint accept_flags = (opt_t ? ACC_DEL_RCPTS | ACC_DEL_BCC | ACC_RCPT_FROM_HEAD : ACC_HEAD_FROM_RCPT)
     3.8 +			guint accept_flags = (opt_t ? ACC_DEL_RCPTS | ACC_RCPT_FROM_HEAD : ACC_HEAD_FROM_RCPT)
     3.9  			                     | (opt_i ? ACC_NODOT_TERM : ACC_NODOT_RELAX);
    3.10  			mode_accept(return_path, full_sender_name, accept_flags, &(argv[arg]), argc - arg);
    3.11  			exit(exit_failure ? EXIT_FAILURE : EXIT_SUCCESS);
     4.1 --- a/src/masqmail.h	Tue Jun 29 10:20:09 2010 +0200
     4.2 +++ b/src/masqmail.h	Tue Jun 29 10:37:18 2010 +0200
     4.3 @@ -311,7 +311,6 @@
     4.4  /*#define ACC_LOCAL      0x01 (we better use received_host == NULL) */
     4.5  #define ACC_HEAD_FROM_RCPT 0x01  /* create To: Header from rcpt_list (cmd line) */
     4.6  #define ACC_DEL_RCPTS      0x02  /* -t option, delete rcpts */
     4.7 -#define ACC_DEL_BCC        0x04  /* -t option, delete Bcc header */
     4.8  #define ACC_RCPT_FROM_HEAD 0x08  /* -t option, get rcpts from headers */
     4.9  #define ACC_NODOT_TERM     0x10  /* a dot on a line itself does not end the message (-oi option) */
    4.10  #define ACC_MAIL_FROM_HEAD 0x40  /* get return path from header */