Re: [Exim] Canonicalizing Addresses

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: John Lawless
CC: Exim List
Subject: Re: [Exim] Canonicalizing Addresses
On Sat, 11 Sep 1999, John Lawless wrote:

>      Suppose exim is attempting to route an address user1@Xe.  If this
> address were looked up in /etc/hosts, exim would find that the full address
> is, say, user1@??? with IP=192.168.1.2.

>
>      I have tried to use:

>
> lanroute:
> driver = lookuphost
> domains = 192.168.0.0/16
> transport = remote_smtp
> gethostbyname
>
> but, AFAIK, exim doesn't check the IP address of the host until after the
> router accepts the address. I also tried


No, that's no good because 192.168.0.0/16 is not an email domain. The
domains option checks the domain, not any IP addresses.

> lanroute:
> driver = lookuphost
> domains = *.internal
> transport = remote_smtp
> gethostbyname
>
> but this fails if exim is passed an address that is not fully canonicalized,
> apparently because exim does not check with etc/hosts until *after* the
> router accepts or rejects the address.


gethostbyname simply calls the gethostbyname() function. The order in
which your OS looks at the DNS and/or /etc/hosts is controlled by your
system configuration. I see the problem - this router doesn't get called
for abbreviated addresses.

>    How do I force the /etc/hosts lookup to happen before the routers
> make their decisions?  Or, is there a better way for exim to distinguish local
> network domains from internet domains?


I take it that by "local domains" you mean "domains not in the DNS"?
Can you not solve this by using two routers like this?

internet:
driver = lookuphost
transport = remote_smtp

local:
driver = lookuphost
transport = remote_smtp
gethostbyname

The first one looks up the domain in the DNS - if it finds it, fine. If
not, the second one looks up the domain by calling gethostbyname()
which should consult /etc/hosts. Or you could use a domainlist router

local:
driver = domainlist
transport = remote_smtp
route_list = "* $domain byname"

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.