Re: [Exim] Modifying Key For Database Lookups

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Oliver Cook
CC: exim-users
Subject: Re: [Exim] Modifying Key For Database Lookups
On Wed, 28 Feb 2001, Oliver Cook wrote:

> Is it possible to change what key is used for a lookup in any way?
>
> For example something similar to:
>
> local_domains = cdb;/usr/exim/domains.cdb
>
> ... is what we use at the moment, but we also have a users.cdb
> which is much smaller. domains.cdb is just users.cdb with an
> extension on the end of every username.
>
> I am trying to get local_domains to do a lookup on the 'username'
> part of the domain. (domains are like username.domain.com)


You don't mean that literally, I presume. What you really mean, I think
(after some thought), is "If the domain is of the form *.domain.com, how
can I then check it's a local domain by looking up just the first
component?"

> I tried this:
>
> local_domains = ${lookup {${extract{1}{.}{$key}}} cdb {/usr/exim/users.cdb}}


Won't work; local_domains is not an expanded string.

I cannot offhand think of an easy way of achieving precisely what (I
think) you want. If you just want to treat *.domain.com as local, then
just put *.domain.com - that will be very fast. Assuming that domain.com
is your domain, it may not matter if you treat x.domain.com as local
when x isn't actually valid. You can always put this as your first
director if it matters:

check_domain:
  driver = smartuser
  domains = *.domain.com 
  condition = ${lookup {${extract{1}{.}{$domain}}} cdb {/usr/exim/users.cdb}\
    {no}{yes}} 
  new_address = :fail: Unknown domain





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