Re: [Exim] lookups with explicit keys

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Philip Hazel
Data:  
Para: Paul Makepeace
CC: exim-users
Asunto: Re: [Exim] lookups with explicit keys
On Tue, 31 Jul 2001, Paul Makepeace wrote:

> Is it possible to do a lookup on something besides $local_part in a DBM
> file? E.g., using $domain in the user = cdb;/.. directive? The nisplus
> example isn't quite enough (for me) to extrapolate something simpler.


What exactly do you want do to? Which option are you trying to set? If
you are talking about the "user" option in a local transport, then the
syntax you've used above is not correct. I know it's confusing, but
there is a clear difference:

(1) When you are providing a lookup as a means of giving a list of
values for something (domain, host, etc.) then your syntax is the one to
use. For example

   local_domains = lsearch;/some/file        main config
   local_parts = cdb;/some/file              router or director


These items are always one form of item in a list. Exim is checking to
see if the (domain, host, etc) it is dealing with is on your list.

(2) When you are providing a value to be SET for some purpose, and the
option is specified as an expanded string, you need the string expansion
syntax. We don't have a list here; it's just one string. In the case of
"user" on a transport, this is what you need:

user = ${lookup{$domain}cdb{/some/file}{found-string}{not-found-string}}

Note that I've used $domain as the key (as you asked). You can have
anything you like, of course, and the found/not-found facility allows
you to specify defaults.

(3) It gets somewhat confusing when (1) and (2) are combined, as in the
"domains" and "local_parts" options on routers/directors. FIRST the
string is treated as in (2); THEN it is treated as in (1). Aarrgghh!!
What is this monster I have created?

> http://www.exim.org/exim-html-3.20/doc/html/spec_6.html#SEC142 scares
> me. This is one part of exim I would love to see overhauled and
> simplified.


It will be a *little* simpler in Exim 4 in that lookups will come in 2
forms rather than 3. (The search_type options of aliasfile and
domainlist are no more.)

BTW, please give a chapter or section number when posting references to
the manual. It saves me having to use a browser to find out which bit
you are actually referring to. Thanks.

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