Re: Sieve fails with match type "matches" if the string to match contains backslashes

Ken Murchison <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
I believe the fix for this is here: 
https://github.com/cyrusimap/cyrus-imapd/pull/3932


On 2/14/22 2:25 AM, Binarus wrote:
> Dear all,
> 
> I have a problem with Cyrus 3.0.8 and its Sieve implementation. I
> regularly get incoming messages with the following literal subject line:
> 
> [The job succeeded.] SQL Server Job System: 'Sicherung
> Mercator.Sicherung' completed on \\GARAK.
> 
> I would like Sieve to sort these messages into a subfolder. This works
> in general. With the following Sieve script, the messages indeed are
> moved into the indicated subfolder as desired:
> 
> require "fileinto";
>  if header :is "subject" "[The job succeeded.] SQL Server Job System:
> 'Sicherung Mercator.Sicherung' completed on \\\\GARAK." {
>   fileinto "INBOX/Health Reports/Garak: Backup: SQL Server";
> }
> 
> It also works with the very same script if I replace ":is" by
> ":contains".
> 
> But as soon as I use ":matches" instead of ":is" or ":contains", it
> fails: It does not put the message into the subfolder any more, but
> puts it into INBOX.
> 
> Unfortunately, I actually have to use ":matches" instead of ":is" or
> ":contains"; please let's take this a matter of fact (the subject line
> shown above is just an example; actually, there are a lot of such
> messages with slight variations in the subject line).
> 
> I have tracked down the problem so far that I am sure that the
> backslashes are the problem. I have sent test messages with the very
> same subject, but without the backslashes, and have changed the Sieve
> script accordingly, and then it worked as expected with all match
> types, including ":matches".
> 
> IMHO, Cyrus' Sieve implementation violates RFC 5228 which clearly
> states that a literal backslash in any quoted string is represented by
> \\, that a literal quote in any quoted string is represented by \",
> and that \ should not occur in quoted strings, except in the
> aforementioned cases.
> 
> Now I would like to know whether
> 
> - the problem is due to my stupidity (read: what I am doing wrong?)
> (this is my first experience with Sieve)
> - there is a workaround in Cyrus 3.0.8 (if it's not my stupidity)
> - the issue has been fixed in later versions (if it's not my stupidity)
> 
> Thank you very much in advance, and best regards,
> 
> Binarus
> 

-- 
Kenneth Murchison
Senior Software Developer
Fastmail US LLC


------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/Tdab9bf8491e4c407-Mf198f9b154356a3f6bcd4c9b
Delivery options: https://cyrus.topicbox.com/groups/info/subscription
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.