Once upon a time, Chris Adams <cma at cmadams.net> said:> I can confirm that a message with multiple Subject: and multiple From: > headers does not get filed correctly into the Spam folder. The > sieve-test tools shows the correct action, but when the message comes in > via LMTP, it goes into INBOX.Okay, digging some more, it looks like something in sieve is overwriting the wrong thing when it gets messages with some headers (at least From: and Subject:) repeated. I enabled the vnd.dovecot.debug sieve plugin, and used this sieve script: require [ "fileinto", "variables", "vnd.dovecot.debug" ]; if header :matches "from" "*" { set "from" "${1}"; } if header :matches "subject" "*" { set "subject" "${1}"; } if header :matches "x-spam-flag" "*" { set "spam" "${1}"; } debug_log "From='${from}' Subject='${subject}' Spam='${spam}'"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } When I feed a message to dovecot-lda with single From: and Subject: headers and X-Spam-Flag: YES set, I get this logged: May 19 14:25:25 hosting dovecot: lda(local at example.com): sieve: default: line 6: DEBUG: From='test at cmadams.net' Subject='Test' Spam='YES' If I duplicate the From: and Subject: headers, I get: May 19 14:25:29 hosting dovecot: lda(local at example.com): sieve: default: line 6: DEBUG: From='test at cmadams.net' Subject='Test' Spam='local at example.com' So, X-Spam-Flag: is somehow getting the To: address in it? Oddly, with this debugging enabled, even though the message with the duplicate headers appears to have the wrong value for X-Spam-Flag:, it then procedes to actually match the YES somehow and file the message in the Spam folder. -- Chris Adams <cma at cmadams.net>
Once upon a time, Chris Adams <cma at cmadams.net> said:> Okay, digging some more, it looks like something in sieve is overwriting > the wrong thing when it gets messages with some headers (at least From: > and Subject:) repeated. I enabled the vnd.dovecot.debug sieve plugin, > and used this sieve script:And I guess something is re-parsing them at some point? The following sieve script has the problem: # compile with "sievec /etc/dovecot/default.sieve" require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } Doubling up the test makes it work however: # compile with "sievec /etc/dovecot/default.sieve" require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } ??? -- Chris Adams <cma at cmadams.net>
On 5/19/2015 10:00 PM, Chris Adams wrote:> Once upon a time, Chris Adams <cma at cmadams.net> said: >> Okay, digging some more, it looks like something in sieve is overwriting >> the wrong thing when it gets messages with some headers (at least From: >> and Subject:) repeated. I enabled the vnd.dovecot.debug sieve plugin, >> and used this sieve script: > And I guess something is re-parsing them at some point? The following > sieve script has the problem: > > # compile with "sievec /etc/dovecot/default.sieve" > require "fileinto"; > if header :contains "X-Spam-Flag" "YES" { > fileinto "Spam"; > } > > Doubling up the test makes it work however: > > # compile with "sievec /etc/dovecot/default.sieve" > require "fileinto"; > if header :contains "X-Spam-Flag" "YES" { > fileinto "Spam"; > } > if header :contains "X-Spam-Flag" "YES" { > fileinto "Spam"; > }I will probably have time to investigate this more this weekend. BTW, you're using a pretty old version of Dovecot and Pigeonhole. Do you have the possibility to try a newer version? Regards, Stephan.
On 5/19/2015 10:00 PM, Chris Adams wrote:> Once upon a time, Chris Adams <cma at cmadams.net> said: >> Okay, digging some more, it looks like something in sieve is overwriting >> the wrong thing when it gets messages with some headers (at least From: >> and Subject:) repeated. I enabled the vnd.dovecot.debug sieve plugin, >> and used this sieve script: > And I guess something is re-parsing them at some point? The following > sieve script has the problem:You're using Dovecot 2.2.10, which is quite old. I remembered a bug like this, but I had to look it up. This is the original bug report: http://www.dovecot.org/list/dovecot/2014-August/097375.html Here's the fix: http://hg.dovecot.org/dovecot-2.2/rev/0e1a3c909a13 You'll need to upgrade to a version >= 2.2.14 to fix your problem. Regards, Stephan.