cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
528 stars 145 forks source link

Regex in sieve broken in 2.4? #1352

Closed brong closed 13 years ago

brong commented 13 years ago

From: Øyvind Kolbu Bugzilla-Id: 3442 Version: 2.4.x (next) Owner: Bron Gondwana

brong commented 13 years ago

From: Øyvind Kolbu

We recently upgraded a few of our imap servers to 2.4.8beta1 from 2.3.16 and found that sieve filters with regex are broken. The filtering rule is ignored and the message delivered to INBOX, so at least not gone.

Example filter:

require  ["fileinto","regex"];

if
header :regex :comparator "i;ascii-casemap" "X-UiO-Spam-score" "s{3,}"
{ fileinto "INBOX.spam"; stop; }

This fails to compile on 2.4.8: root@mail-utv2.uio.no tmp# sievec phpscript.script phpscript.bc Unable to parse script: script errors: line 4: bad argument at offset 0
while on 2.3.16 this is no problem: root@mail-imap2.uio.no tmp# sievec phpscript.script phpscript.bc root@mail-imap2.uio.no tmp#

The filter is generated using the avelsieve plugin in Squrrielmail. Neither of them have defined the option sieve_extensions in imapd.conf.

./configure reported that it found pcre headers: checking pcreposix.h usability... yes checking pcreposix.h presence... yes checking for pcreposix.h... yes checking for utf8 enabled pcre... yes

and sievec and other binaries are linked with libpcre.

Any ideas?

brong commented 13 years ago

From: Bron Gondwana

I'm going to look at this one now :)

brong commented 13 years ago

From: Bron Gondwana

Hmm... works for me:

Fresh build from 2.4.8beta1 tag. I wonder if you have broken pcre libraries? What OS/compiler? Hmm... looks like we don't have the option to disable PCRE!

root@launde:/tmp/ct-slot2/conf/sieve/f/foo# cat sieve.script require ["fileinto","regex"];

if
header :regex :comparator "i;ascii-casemap" "X-UiO-Spam-score" "s{3,}"
{ fileinto "INBOX.spam"; stop; }

root@launde:/tmp/ct-slot2/conf/sieve/f/foo# /usr/cyrus/bin/sievec -C /tmp/ct-slot2/etc/imapd.conf sieve.script sievebc root@launde:/tmp/ct-slot2/conf/sieve/f/foo# ls -la total 16 drwxr-xr-x 2 cyrus root 4096 2011-04-14 20:44 . drwxr-xr-x 3 cyrus root 4096 2011-04-14 20:44 .. lrwxrwxrwx 1 root root 7 2011-04-14 20:44 defaultbc -> sievebc -rw-r--r-- 1 cyrus root 128 2011-04-14 20:44 sievebc -rw-r--r-- 1 cyrus root 155 2011-04-14 20:38 sieve.script

brong@launde:/extra/src/git/cmu/cyrus-imapd$ telnet slot2 2003 Trying 127.0.0.52... Connected to slot2. Escape character is '^]'. 220 test_slot2_30188 Cyrus LMTP git2.4.8beta1+0 server ready LHLO me 250-test_slot2_30188 250-8BITMIME 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-SIZE 250 IGNOREQUOTA MAIL FROM:<brong@fastmail.fm> 250 2.1.0 ok RCPT TO:<foo> 250 2.1.5 ok DATA 354 go ahead Subject: test email for SPAM folder X-UiO-Spam-score: sssss

body .

Apr 14 20:53:49 localhost test_slot2_30188/lmtp[30210]: auditlog: append sessionid=<test_slot2_30188-30210-1302807197-1> mailbox=<user.foo.spam> uniqueid=<0ef92f0e4da74147> uid=<1> guid=<49645b7cba69943210d567da8735f9b83e2a2ed9>

brong commented 13 years ago

From: Øyvind Kolbu

(In reply to comment #2) > Fresh build from 2.4.8beta1 tag. I wonder if you have broken pcre libraries?

Perhaps.. they are in fact locally compiled and not used for anything else. They are version 8.10.

> What OS/compiler?

Red Hat EL 4 gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-60)

I'll try to remove the local installed pcre and try to build it again.

Thanks for testing!

brong commented 13 years ago

From: Øyvind Kolbu

Building without pcre installed did work! Strange that having pcre installed broke it. Did your build link with pcre?

From configure: checking pcreposix.h usability... no checking pcreposix.h presence... no checking for pcreposix.h... no and the binaries are not linked with pcre.

brong commented 13 years ago

From: Bron Gondwana

(In reply to comment #4) > Building without pcre installed did work! Strange that having pcre installed > broke it. Did your build link with pcre? > > From configure: > checking pcreposix.h usability... no > checking pcreposix.h presence... no > checking for pcreposix.h... no > and the binaries are not linked with pcre.

Yes my build links with PCRE. I will add an option to disable PCRE to --configure.

brong commented 13 years ago

From: Bron Gondwana

There is now a way to disable PCRE by adding '--disable-pcre' to your configure script, so you don't need to uninstall it.