6.0.0-beta1
7/6/25

[#7023] Wrong "Received:" regexp used in vacation date with sieve
Summary Wrong "Received:" regexp used in vacation date with sieve
Queue Ingo
Queue Version 1.2
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester bb (at) apc (dot) ag
Created 07/04/2008 (6211 days ago)
Due
Updated 07/04/2008 (6211 days ago)
Assigned
Resolved 07/04/2008 (6211 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/04/2008 05:00:32 PM Jan Schneider Comment #3
Assigned to Jan Schneider
State ⇒ Resolved
Patch ⇒ No
Reply to this comment
Both is quite common, so I had to go the [0  ] route.
07/04/2008 04:58:20 PM Jan Schneider Deleted Original Message
 
07/04/2008 04:58:19 PM CVS Commit Comment #2 Reply to this comment
07/04/2008 10:14:03 AM bb (at) apc (dot) ag Comment #1
Priority ⇒ 2. Medium
New Attachment: sieve-vacation-date.patch
Patch ⇒ Yes
Milestone ⇒
Summary ⇒ Wrong "Received:" regexp used in vacation date with sieve
Type ⇒ Bug
State ⇒ Unconfirmed
Queue ⇒ Ingo
Reply to this comment
The sieve module of Ingo creates date matching rules if a vacation 
date (start and end) is specified. These rules work correctly from the 
10th to the 31st of each month but not from the 1st until the 9th.



The reason is that the generated regex searches for dates like '04 Jul 
2008'. However, each server I've seen (Postfix, MS Exchange) inserts 
this date as '4 Jul 2008', without a leading zero.



The following diff seems to fix this issue.



# diff --normal lib/Script/sieve.php.ori lib/Script/sieve.php

2753c2753

<         $code = 'if  header :regex "Received" "^.*(' . 
str_pad($begin, 2, '0', STR_PAD_LEFT);

---
         $code = 'if  header :regex "Received" "^.*(' . 
str_pad($begin, 2, ' ', STR_PAD_LEFT);
2755c2755

<             $code .= '|' . str_pad($i, 2, '0', STR_PAD_LEFT);

---
             $code .= '|' . str_pad($i, 2, ' ', STR_PAD_LEFT);
If there are mail servers that use the 04 format, maybe we should use 
"[0 ]$i" instead of the str_pad stuff in the regexp.

Saved Queries