Re: [Exim] Rewrite rules not applied to unqualified addresse…

Top Page
Delete this message
Reply to this message
Author: Tore Anderson
Date:  
To: exim-users
Subject: Re: [Exim] Rewrite rules not applied to unqualified addresses in headers?
* Tore Anderson

> So I thought the problem must be that the unqualified address I first
> tried isn't considered an e-mail address at all,


* Philip Hazel

> Correct. Take a look at sender_unqualified_hosts.


But why, then, doesn't the 'w' flag change this? As I read the
specification that should make the rewrite rule apply to the entire
header, not only the address part..?

sender_unqualified_hosts doesn't quite do the trick for me, as
that will only qualify the address using the qualify_domain. I want
to use the domain supplied in the envelope from (if any) for
qualification, so therefore the non-expanded qualify_domain setting
isn't flexible enough.

I've accomplished my goal by adding some headers in the data acl, and
juggling them some in the system filter. Just a shame I couldn't use
rewriting for this, as I thought this was finally the day I would be
able to make use of it and learn how it's done. :-)

During my foiled testing of the rewrite facilities I noticed
something strange I thought you might be interested in. If I set
headers_rewrite in a transport, the From header will automatically
be qualified with qualify_domain - even if the rewrite rule doesn't
match! For instance, I can have this in the transport:

    rewrite_headers = \N$^\N bogus@bogus fw


and set qualify_domain to e.g. "Q-D", ensure sender_unqualified_hosts
is unset, and empty the rewrite section of the configuration file, this
is the (somewhat unexpected) result:

    $ exim -Mvh 1BVqGW-0006ky-2Q
    [...]
    023F From: unqualified-from


    $ exim -d+rewrite -M 1BVqGW-0006ky-2Q
    [...]
      SMTP>> writing message and terminating "."
    rewrite_one_header: type=F:
      From: unqualified-from
    address match: subject=unqualified-from@q-d pattern=$^
    q-d in "$^"? no (end of list)
    unqualified-from@Q-D in "$^"? no (end of list)
    newlen=27 newtype=F newtext:
    From: unqualified-from@Q-D
    remainder:
    writing data block fd=6 size=262 timeout=300
    read response data: size=28
      SMTP<< 250 OK id=1BVqHE-0007WO-8s
    [...]


..and indeed, the arrives with the "Q-D" string in the From header.
If I uncomment the headers_rewrite directive, however:

    $ exim -d+rewrite -M 1BVqKI-0006rA-DA
    [...]
      SMTP>> writing message and terminating "."
    writing data block fd=6 size=258 timeout=300
    read response data: size=28
      SMTP<< 250 OK id=1BVqKX-0007cl-Hq
    [...]


No rewriting. And the message arrives at its destination with an
unchanged, unqualified From header.

I would've expected the rewriting to happen iff the rewrite rule
in headers_rewrite matched, but it seems as if the mere presence of
headers_rewrite is enough to trip the internal domain-qualifying
rewrite rule. Is this behaviour intentional?

By the way, thank you very much for adding the iplsearch lookup I
requested so quickly! I owe you a beer or fourteen. ;-)

--
Tore Anderson