Courtesy of one of my colleagues:

There's a bug in the sieve bytecode interpreter implementation of the address :regex test. The regex is matched against the whole of the RFC822 address from the header (including display name etc.) instead of just the address part (all/domain/etc.) that was specified. This is most noticeable if you use an anchored regex.

Here's a patch. (The code for non-regex comparisons in the following lines is correct, and this patch makes the regex code pass the same two initial parameters to the comparator.)

--- sieve/bc_eval.c     13 Feb 2007 15:06:54 -0000
+++ sieve/bc_eval.c     30 Jul 2007 15:06:27 -0000
@@ -591,7 +591,7 @@
                                    goto alldone;
                                }

-                               res |= comp(val[y], strlen(val[y]),
+                               res |= comp(addr, strlen(addr),
                                            (const char *)reg, comprock);
                                free(reg);
                            } else {

We have been running with this patch for a little over a week now and
it certainly seems to have fixed the problem.

--
David Carter                             Email: [EMAIL PROTECTED]
University Computing Service,            Phone: (01223) 334502
New Museums Site, Pembroke Street,       Fax:   (01223) 334679
Cambridge UK. CB2 3QH.

Reply via email to