Re: [exim] RegEx longer than maximum string length in system…

Top Page
Delete this message
Reply to this message
Author: Ted Cooper
Date:  
To: exim-users
Subject: Re: [exim] RegEx longer than maximum string length in system filter
Schramm, Dominik wrote:
> Hi there,
>
> I have a regular expression that is longer than 1024 characters.
> Can I still use it in a system filter although the maximum string
> length is 1024?


I only had a glance at this since I'm late for work :P Please take
everything with a grain of salt as i may have completely missing some
critical piece of code that makes all the difference.

The 1024 buffer size seems to be present in filter.c for reading single
words. There doesn't seem to be a line limit of 1024 as such, just for
single components of those lines.

A regex seems to be considered to be a word and will be limited to 1024
unsigned chars. I can find no special code for reading regex so I assume
the normal nextitem call handles it.

Can you split the regex up into multiple components? ie match a common
bit to all of them and then use the extra differences in other if/then
statements. That should remove the limit but maybe cause it run slowly.

The rather more risky venture might be to run through filter.c and
increase the size of all the buffers to 2048 (or some other number you
deem fit), but that may break things elsewhere. I have no idea if that
buffer's size carries itself out of the filter and into anything else.
It may cause the PCRE library to blow up, or possibly even early onset
male pattern baldness.

Have fun!


--
The Exim Manual
http://www.exim.org/docs.html
http://docs.exim.org/current/