4 messages in net.sourceforge.lists.courier-sqwebmail[sqwebmail] Re: Edit Mail Filter prob...
FromSent OnAttachments
Eric BerggrenOct 25, 2004 11:00 am 
Eric BerggrenOct 25, 2004 3:02 pm 
Sam VarshavchikOct 25, 2004 3:36 pm 
Eric BerggrenOct 26, 2004 11:25 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[sqwebmail] Re: Edit Mail Filter problem with regexp'sActions...
From:Eric Berggren (eri@transmeta.com)
Date:Oct 26, 2004 11:25:32 am
List:net.sourceforge.lists.courier-sqwebmail

In SQwebmail 4.0.7 (first version we've used), noticed that one can't use a '[0-9]' style regexp ([a-z] or simply have '-' in between []'s); gives 'ERROR: Invalid or missing header pattern or recipient address, please reenter'. One can use '[:digit:]' etc, however, but the others should be acceptable (maildrop itself has no problem with it).

It's a bug in the regexp validation routine.

Just duplicate the ending character, for now: [0-99]

I somehow got a funky busybox grep(1) manpage or something (i'm used to using egrep anyway).

The pre-filter code comes right out of maildrop - i just removed some lines from maildir_filter_ruleupdate() validation function, which seemed at first to also be used when loading a .mailfilter file, but apparently not (i'm too lazy to go digging for it).

It's certainly not going to catch all possible formats and invalid expressions, which would cause maildrop to fail; why not simply regcomp(3) it and see if it's valid ? (i suppose this is better addressed on the maildrop list)

-ericb

*** sqwebmail-4.0.7/maildir/maildirfilter.c.orig Sat Jan 24 21:38:50 2004 --- sqwebmail-4.0.7/maildir/maildirfilter.c Tue Oct 26 11:01:33 2004 *************** *** 207,225 **** if (!*c) return (-1); if ((int)(unsigned char)*c < ' ') return (-1); - ++c; - if (*c == ']') break; - if (*c != '-') continue; - ++c;

! if (*c == '\'' || *c == '"' || ! *c == '`') ! return (-1); /* must be quoted*/ ! if (*c == '\\') ! ++c; ! if ((int)(unsigned char)*c < ' ') ! return (-1); ! if (!*c) return (-1); ++c; } ++c; --- 207,214 ---- if (!*c) return (-1); if ((int)(unsigned char)*c < ' ') return (-1);

! if (*c == ']') break; ++c; } ++c;