The sieve-extprograms extension strips Return-Path headers before
passing mail off to the external program. The patch to remove this
behavious is trivial (and attached), but since it appears to be
deliberate I felt I should investigate further.
I believe this is basically a cut-and-paste error. The code to strip
Return-Path has been there since the sieve-pipe plugin for Dovecot 1.x,
and I believe it was copied from the equivalent code in the 'redirect'
action for passing mail off to sendmail(8). In that case, stripping
Return-Path is correct, since the message is being resubmitted for
delivery (by SMTP or otherwise), and the last step of the new delivery
will (should) add a new Return-Path header with the new envelope
information. In the case of sieve-extprograms, though, the filtering is
happening post-delivery, so a stripped Return-Path will never be
replaced.
Ben
diff -r 280d81e62433 src/sieve-extprograms-common.c
--- a/src/sieve-extprograms-common.c Sun Nov 04 13:02:14 2012 +0100
+++ b/src/sieve-extprograms-common.c Tue Nov 13 14:55:44 2012 +0000
@@ -574,25 +574,17 @@
int sieve_extprogram_set_input_mail
(struct sieve_extprogram *sprog, struct mail *mail)
{
- static const char *hide_headers[] = { "Return-Path" };
struct istream *input;
- struct istream *crlf_input;
if (mail_get_stream(mail, NULL, NULL, &input) < 0)
return -1;
- /* Remove unwanted headers */
- input = i_stream_create_header_filter
- (input, HEADER_FILTER_EXCLUDE, hide_headers,
- N_ELEMENTS(hide_headers), null_header_filter_callback, NULL);
-
/* Make sure the message contains CRLF consistently */
- crlf_input = i_stream_create_crlf(input);
+ input = i_stream_create_crlf(input);
+
+ script_client_set_input(sprog->script_client, input);
i_stream_unref(&input);
- script_client_set_input(sprog->script_client, crlf_input);
- i_stream_unref(&crlf_input);
-
return 1;
}