[#2486] Wrong Sieve Script Generation
Summary Wrong Sieve Script Generation
Queue Ingo
Queue Version 1.0.1
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester abc (at) digithi (dot) de
Created 08/21/2005 (1236 days ago)
Due
Updated 08/22/2005 (1235 days ago)
Assigned
Resolved 08/22/2005 (1235 days ago)
Attachments
Milestone
Patch No

History
08/22/2005 Jan Schneider Comment #2
State ⇒ Resolved
Reply to this comment
Committed, thanks.
08/21/2005 abc (at) digithi (dot) de Comment #1
Queue ⇒ Ingo
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Wrong Sieve Script Generation
State ⇒ Unconfirmed
Reply to this comment
Ingo tests all rules for "From" or  "To", "Cc", "Bcc" to get the right 
information if the generated rule is applied for "header" or address" 
fields. If you generate a user-defined rule with for example 
"X-Apparently-To" ingo intreprets this as a "address" field (because 
it finds a "To"). This is wrong, it is a header field. If that wrong 
script is transferred to the sieve daemon it produces an error because 
of the malformed rule. The patch corrects the behaviour, it tests not 
only for a "To" in the whole header line, it checks that To is the 
first word in line.

--- sieve.php.orig      Tue Aug 17 07:11:58 2004
+++ sieve.php   Mon Aug 22 00:03:05 2005
@@ -532,7 +532,7 @@

                      /* Do 'smarter' searching for fields where we know we
                         have e-mail addresses. */
-                    if (preg_match('/(From|To|Cc|Bcc)/', 
$condition['field'])) {
+                    if (preg_match('/^(From|To|Cc|Bcc)/', 
$condition['field'])) {
                          $vals['addresses'] = 
preg_replace('/(?<!\\\)\,/', "\n", $condition['value']);
                          $use_address_test = true;
                      } else {