Hello,
Sometimes, when delivering mails, this warning appears in my syslog:
lda(...): Warning: Failed to parse return-path header: Invalid character in localpart
dovecot-lda still exits with 0 and the mail is inserted into my inbox.
Looking at the mails in question, I determined that the error is caused by a multiline Return-Path header. Here's a testcase:
--- snip --- Return-Path: <nowhere@example.com> From: "Nowhere" <nowhere@example.com> To: redacted@example.com Subject: Testcase for lda warnings Date: Wed, 31 Jan 2018 12:00:00 +0000
This is a message body. --- snap ---
Copy into a file, with \r\n line endings, then run something like this:
cat testcase.txt | /usr/lib/dovecot/dovecot-lda -e -d '<username>' with a username recognized by your running dovecot installation.
The header is 'Return-Path:', \r\n, two spaces, '<...>', \r\n
According to rfc2822 folding rules, that should be valid - the Return-Path header allows CFWS at that location.
The error message originates in lib-lda/mail-deliver.c in mail_deliver_get_return_address(), while the invalid character message seems to originate from one of several places in lib-lda/mail-deliver.c
Ciao, Christian Authmann