[EXIM] rewrite/${if match problem

Top Page
Delete this message
Reply to this message
Author: Peter Radcliffe
Date:  
To: exim-users
Subject: [EXIM] rewrite/${if match problem
I'm working on replacing our sendmail relays with exim based relays and
one of the requirements is to be able to deal with single ! uucp paths
from our few uucp customers to and from taylor uucp.

I have a driver/transport set up that works and in the testing I've done
so far everything is working fine, apart from the logs/Received header
and the envelope from.

I'm rewriting node!user addresses according to a db file to get the
domain foe the uucp node for our customers, which works fine, but I
want to set the envelope from to be the same rewritten address -
simple, I thought: when the sender is uucp@???
rewrite the envelope from to be the From: line, which will then be
rewritten along with the From: [1].

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.

To test the theory, I tried:
uucp@???
${substr_11_8:$header_from:}@${qualify_recipient} F

(where substr_11_8 extracts the right section from my test email) and it
works perfectly. I did find I'll need several cases above - those where
there is a @ in the address or not (foo!bar gets rewritten[1] if foo is a
customer uucp node) and the other various forms of valid addresses[2].


The other problem is traceability - especially if I'm rewriting the
enevelope from to be the From: line customers could untracably abuse it.
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.
I see in the archives that at least two other people have been wanting to
achive something like that.


Hope this makes some sense :)

Peter.

[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.


[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 ?


--
Peter Radcliffe | pir@??? | Shore.net systems administrator.


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