Hi,
Having just got around to trying to implement this ...
On Thu, 4 Dec 2003, PM Lashley wrote:
> --On Thursday, December 04, 2003 17:45:34 +0000 Chris Edwards <chris@???> wrote:
>
> > We thought about using exiscan's rexexp feature to detect and reject such
> > messages during the dialog. But we couldn't get this to work. Regexp
> > looking for NULL never triggered.
>
> Hmm. I've had no problem with this one:
>
> deny log_message = NUL in body
> message = Unescaped NUL character in message body\n\
> (See RFC 2822, section 2.3; and RFC 2045, sections 2.7 & 2.8)
> condition = ${if match {$message_body} {\N\x00\N} {yes} {no}}
>
> Note that it is necessary to use the \N escape to prevent the \x00
> from being converted by exim's string expansion before it can be
> parsed by the regexp routines.
[...]
.... I'm confused. I cannot get it to work, and reading the code, I don't
believe it should work. Specifically, from expand.c (4.30, line 1123) we
have:-
case vtype_msgbody: /* Pointer to msgbody string */
case vtype_msgbody_end: /* Ditto, the end of the msg */
[...]
len = read(deliver_datafile, body, len);
if (len > 0)
{
body[len] = 0;
while (len > 0)
{
if (body[--len] == '\n' || body[len] == 0) body[len] = ' ';
}
[...]
which appears to turn all NULs in $message_body into spaces. So I don't
think the 'match' is ever going to succeed. Is my interpretation wrong, or
am I doomed to failure?
TIA,
Richard Hall