dovecot-2.1: LMTP: Don't add Return-Path: header when proxying.

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 19 18:22:50 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/85b3975c9008
changeset: 14429:85b3975c9008
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 19 18:22:39 2012 +0300
description:
LMTP: Don't add Return-Path: header when proxying.
The backend also adds it and we don't want duplicates.

diffstat:

 src/lmtp/commands.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 782570f644f7 -r 85b3975c9008 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Thu Apr 19 18:15:56 2012 +0300
+++ b/src/lmtp/commands.c	Thu Apr 19 18:22:39 2012 +0300
@@ -416,6 +416,9 @@
 	}
 
 	if (client->proxy != NULL) {
+		/* NOTE: if this restriction is ever removed, we'll also need
+		   to send different message bodies to local and proxy
+		   (with and without Return-Path: header) */
 		client_send_line(client, "451 4.3.0 <%s> "
 			"Can't handle mixed proxy/non-proxy destinations",
 			address);
@@ -742,9 +745,13 @@
 		rcpt_to = rcpt->address;
 	}
 
-	str_printfa(str, "Return-Path: <%s>\r\n", client->state.mail_from);
-	if (rcpt_to != NULL)
-		str_printfa(str, "Delivered-To: <%s>\r\n", rcpt_to);
+	/* don't set Return-Path when proxying so it won't get added twice */
+	if (array_count(&client->state.rcpt_to) > 0) {
+		str_printfa(str, "Return-Path: <%s>\r\n",
+			    client->state.mail_from);
+		if (rcpt_to != NULL)
+			str_printfa(str, "Delivered-To: <%s>\r\n", rcpt_to);
+	}
 
 	str_printfa(str, "Received: from %s", client->lhlo);
 	if ((host = net_ip2addr(&client->remote_ip)) != NULL)


More information about the dovecot-cvs mailing list