Re: [Exim] expansion string syntax

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Wakko Warner
Date:  
À: Rick Ennis
CC: exim-users
Sujet: Re: [Exim] expansion string syntax
> We have a fairly small site (< 20 users) and I'm playing around trying to

That's large compared to mine =) (I only host myself noone else)

> headers_add = ${lookup pgsql{insert into filter_private (username, address)
> values ('${expand:{match{$h_Received:}{\Nas user (\w+)@\N} }}',
> '$local_part@$domain')}}


Someone may say this is the wrong place for it. I'm sure a router can see
the address, you just have to figure out how to keep it to 1.
the match{}{} is a condition for use in ${if ... not for use the way you're
using it.

> I'm doing it in a headers_add directive b/c I couldn't find a better place
> to do the expansion. In this case, I only care if the INSERT actually
> works, not any resulting header. So I'm trying to use the regex "as
> user(\w+)@" to pull the sender's username out of the Received header. The
> $local_part@$domain part works great. But the expansion fails with:


Read how ${lookup works. at the end, if you really want nothing to be
added, make sure you put {}{} just before the last } that way, if the
"lookup" succeeds, it's nothing and if the lookup fails (due to server down
or something) it'll be nothing.

> 2003-06-05 15:25:43 19O0Mn-00071c-NW == sdsdfsdf333332@??? R=dns_mx
> T=remote_smtp defer (-25): failed to expand headers_add or headers_remove:
> lookup of "insert into filter_private (username, address) values
> ('{match{from nobody by han.ecloud.net with local (Exim 4.20)\n       id
> 19O0Mn-00071c-NW\n   for sdsdfsdf333332@???; Thu, 05 Jun 2003
> 15:25:41 -0400\nfrom 66.31.42.79 ( [66.31.42.79])\n      as user
> ennis@192.168.0.2 by ecloud.net with HTTP;\n    Thu,  5 Jun 2003
> 15:25:41 -0400{as user (\w+)@" gave DEFER: PGSQL: query failed: ERROR:
> parser: unterminated quoted string at or near "'{match{from nobody by

                                                  ^^^^^^^^

> Could this be a quoting issue like it says? I'm using \N on the regex and
> ${quote: on the received header.
> I'm out of ideas. Any suggestions?


Looks like an RTFM issue. \N tells the expansion routine to stop expanding
and copy literally until the next \N or EOL.

--
Lab tests show that use of micro$oft causes cancer in lab animals