[exim] Bug / Feature of Exim rewriting

Top Page
Delete this message
Reply to this message
Author: jori.hamalainen
Date:  
To: exim-users
CC: jori.hamalainen
Subject: [exim] Bug / Feature of Exim rewriting
Hi,

Sorry about using old exim (4.10) but it is at production and not so easy to swap to newer version. But if rewrite code & router code is not affected much between 4.1 to 4.6 so same thing could be introducable in later versions. I simplified this domain & range information to most simplified form to understand (I hope). "rewrite-range" is regexp to capture a range what needs other domain, "norewrite" is outside of this regexp and unaltered in any form.

At configuration I have rewrite section which does domain rewrite based on local part:

rewrite-range@domain1    rewrite-range@domain2    T


So only SMTP envelope RCPT TO: is rewritten. Exim -brw confirms this.

Then at routers-configuration I have "from-conversion" router which rewrites MAIL FROM-field based on MAIL FROM & RCPT TO -pairs. And uses router attribute errors_to to rewrite MAIL FROM. This works very well on every case except address falls to regexp "rewrite-domain@domain1".

Delivery chain is:
MTA1 - my MTA - MTA2

inbound to "my MTA" I receive

MAIL FROM: rewrite-range@domain2
RCPT TO: something@domain3

This is trapped by "from-conversion" router (indicated with =>)

MAIL FROM: rewrite-range@domain2 => rewrite-range@domain1
RCPT TO: something@domain3

This is ok and expected&wanted, but now comes the unexpected. "From-conversion" verifies the address "rewrite-range@domain1" with successfull status, but also rewrite configuration with "T" is ran for it, so actually "rewrite-range@domain2" is ok. Also @domain1 would also be OK, but before it gets checked, it is already overwritten by @domain2. And this @domain2 is copied to "errors_to" 'variable' instead of @domain1 programmed into redirect-router.

So transaction between "my MTA" and MTA2 is

MAIL FROM: rewrite-range@domain2
RCPT TO: something@domain3

But this is unwanted effect. Because MAIL FROM: should be "rewrite-range@domain1". IMO SMTP ENV TO rewrite should apply just when I send messages toward MTA1.

To summarize MAIL FROM:

norewrite@domain2    OK        (gets rewritten to norewrite@domain1 as needed, and this verifies successfully with @domain1)
rewrite-range@domain2    NOT OK    (gets rewritten to domain1, but it is rewritten back to domain2)


Is this OK behaviour and planned behaviour of Exim? I realize I can replace this general rewrite with redirect router, and disable it from verify.

Regards,
Jori