masqmail

diff src/accept.c @ 276:1abc1faeb45d

for -t cmdline args are now added to the rcpt list instead of substracted Please read the diff and the section about -t in man/masqmail.8. Masqmail's behavior had been like the one of exim/smail, now it's similar to postfix. Masqmail does it now the most simple way, regarding the code. Also, addr args are always recipients, -t does not change their meaning. -t makes the addrs from rcpt hdrs, rcpt addrs too. It would have been logical too, to ignore the cmdline args, in the sense of ``headers *instead of* args'' but none of the popular MTAs does it that way and it would have been a bit more complicated in the code. Anyway, this is a corner-case that should better be avoided completely.
author markus schnalke <meillo@marmaro.de>
date Fri, 03 Dec 2010 21:05:34 -0300
parents 1405012509e3
children bb3005ce0837
line diff
     1.1 --- a/src/accept.c	Fri Dec 03 19:35:34 2010 -0300
     1.2 +++ b/src/accept.c	Fri Dec 03 21:05:34 2010 -0300
     1.3 @@ -55,12 +55,10 @@
     1.4  }
     1.5  
     1.6  /* accept message from anywhere.
     1.7 -   A locally originating message is indicated by msg->recieved_host == NULL
     1.8 +   A message from local is indicated by msg->recieved_host == NULL
     1.9  
    1.10 -   The -t option:
    1.11 -   The ACC_RCPT_FROM_HEAD flag adds the recipients found in To/Cc/Bcc
    1.12 -   headers to the recipients list. The recipients given on the
    1.13 -   command line are removed from the ones given in headers.
    1.14 +   The -t option: With the ACC_RCPT_FROM_HEAD flag the addrs found found
    1.15 +   in To/Cc/Bcc headers are added to the recipient list.
    1.16  */
    1.17  
    1.18  accept_error
    1.19 @@ -187,7 +185,6 @@
    1.20  accept_message_prepare(message * msg, guint flags)
    1.21  {
    1.22  	struct passwd *passwd = NULL;
    1.23 -	GList *non_rcpt_list = NULL;
    1.24  	time_t rec_time = time(NULL);
    1.25  
    1.26  	DEBUG(5) debugf("accept_message_prepare()\n");
    1.27 @@ -216,12 +213,6 @@
    1.28  		g_free(path);
    1.29  	}
    1.30  
    1.31 -	/* -t option (see comment above) */
    1.32 -	if (flags & ACC_RCPT_FROM_HEAD) {
    1.33 -		non_rcpt_list = msg->rcpt_list;
    1.34 -		msg->rcpt_list = NULL;
    1.35 -	}
    1.36 -
    1.37  	/* scan headers */
    1.38  	{
    1.39  		gboolean has_id = FALSE;
    1.40 @@ -273,7 +264,7 @@
    1.41  				if (flags & ACC_SAVE_ENVELOPE_TO) {
    1.42  					DEBUG(3) debugf("creating 'X-Orig-Envelope-To' header\n");
    1.43  					msg->hdr_list = g_list_prepend(msg->hdr_list, create_header(HEAD_UNKNOWN,
    1.44 -					                               "X-Orig-Envelope-to: %s", hdr->value));
    1.45 +					                               "X-Orig-Envelope-To: %s", hdr->value));
    1.46  				}
    1.47  				DEBUG(3) debugf("removing 'Envelope-To' header\n");
    1.48  				msg->hdr_list = g_list_remove_link(msg->hdr_list, hdr_node);
    1.49 @@ -331,25 +322,8 @@
    1.50  			}
    1.51  		}
    1.52  
    1.53 -		if (flags & ACC_RCPT_FROM_HEAD) {
    1.54 -			/* remove the recipients given on the command line
    1.55 -			   from the ones given in headers
    1.56 -			   -t option (see comment above) */
    1.57 -			GList *rcpt_node;
    1.58 -			foreach(non_rcpt_list, rcpt_node) {
    1.59 -				address *rcpt = (address *) (rcpt_node->data);
    1.60 -				GList *node;
    1.61 -				if ((node = g_list_find_custom(msg->rcpt_list, rcpt, _g_list_addr_isequal))) {
    1.62 -					DEBUG(3) debugf("removing rcpt address %s\n", addr_string(node->data));
    1.63 -					msg->rcpt_list = g_list_remove_link(msg->rcpt_list, node);
    1.64 -					destroy_address((address *) (node->data));
    1.65 -					g_list_free_1(node);
    1.66 -				}
    1.67 -			}
    1.68 -		}
    1.69 -
    1.70  		/* here we should have our recipients, fail if not: */
    1.71 -		if (msg->rcpt_list == NULL) {
    1.72 +		if (!msg->rcpt_list) {
    1.73  			logwrite(LOG_WARNING, "no recipients found in message\n");
    1.74  			return AERR_NORCPT;
    1.75  		}