Re: [EXIM] rewrite/${if match problem

Top Pagina
Delete this message
Reply to this message
Auteur: Philip Hazel
Datum:  
Aan: Peter Radcliffe
CC: exim-users
Onderwerp: Re: [EXIM] rewrite/${if match problem
On Fri, 12 Dec 1997, Peter Radcliffe wrote:

> I end up with, for testing (lines broken to be readable):
>
> uucp@??? ${if match{$header_from:}{<(\\S)>}{$1}fail} F
> ^(?i)([^!.@]+)!([^@]*)@local.host.qualification
>    $2@${lookup{$1}dbm{/usr/local/etc/exim/dbm/uucpdomDBEXT}{$value}fail} qhF

>
> The problem is the ${if match - you can't have a space there or it thinks
> m... are rewrite flags, but I can't find any character/method to put
> something else there to let it work.


But you can put the item in quotes, for precisely this reason. From
chapter 33 of the spec:

The rewriting configuration consists of lines of rewriting rules in the
form

    <source pattern>  <replacement>  <flags>


The rules are scanned in order and relacements from earlier rules can
themselves be replaced as a result of later rules (but see the 'q' flag).
Long rules can be split over several lines by terminating all but the last
with a backslash character. Leading white space on continuation lines is
ignored. If the replacement string contains spaces, which can happen for
certain forms of expansion expression, it must be enclosed in double
quotes, and the normal quoting conventions apply inside them.

Remember to double up those \ characters when you put it in quotes.

> The other problem is traceability - especially if I'm rewriting the
> enevelope from to be the From: line customers could untracably abuse it.


Some rewrites cause the addition of X-headers, but I don't recall
exactly which and why. You can add log_write calls to the rewrite.c
module if you want. I guess I could add an option for this.

> Much of this will have to be done as how uucp calls exim (the rmail joys)
> but the ability to define which options exim is called with when it is
> called as 'rmail' (with the default as -i to retain current behaviour)
> would be nice.


You can always turn "rmail" into a script that calls Exim with the
options of your choice.

> [1] It would be nicer to rewrite the From: line and then rewrite the
>     envelope from to be that, but it appears $header_from: isn't
>     updated during rewrites.


The order of rewriting is not defined...

> [2] From: foo bar <foo@???> or From: foo@??? or
>     From: foo@??? (Foo Bar), etc, etc. Anyone got a regexp for
>     obtaining the email address out of that lot ?


Well, you could look at the one in the appendix of Jeff Friedl's book,
but it is about 5,000 characters long... (It is actually one of the
test expressions in the PCRE distribution in Exim 1.80.) I don't know if
Exim could handle an expression that big.

Philip

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***