Re: [EXIM] Virtual domains and partial matches

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: Lars Kellogg-Stedman
Cc: exim-users
Asunto: Re: [EXIM] Virtual domains and partial matches
On Mon, 30 Nov 1998, Lars Kellogg-Stedman wrote:

> LOCAL=partial-lsearch;/usr/exim/localdomains
> local_domains=LOCAL
>
> However, I want to have a per-domain alias file,
> /usr/exim/virtual/virtdomain/aliases. For addresses of the form
> 'user@???', this works just dandy:
>
>   virtual_domains:
>     driver=aliasfile
>     domains=LOCAL
>     file=/usr/exim/virtual/${domain}/aliases
>     search_type=lsearch

>
> However, if the address is something like 'user@???' this
> fails because /usr/exim/virtual/host.virtdomain.org/ does not exist. In
> this situation, I'd like the director to fall back to
> '/usr/exim/virtual/virtdomain.com/' instead.


There are several ways you could go about this.

You could replace the setting of "file" by something like

     file = "${if exists{/usr/exim/virtual/${domain}/aliases}\
             {/usr/exim/virtual/${domain}/aliases}\
             {/usr/exim/virtual/\
             ${if match{$domain}{^[^\\\\.]+(.*)\\$}{$1}{default}}/aliases}}"


That tests for the existence of /usr/exim/virtual/host.virtdomain.org/,
and falls back if it doesn't exist.

OR

Add the "optional" option to your director, so that non-existence of the
file just causes it to fail to handle the address, and add a second
director below it of the form

   virtual_domains_default:
     driver=aliasfile
     domains=LOCAL
     file=/usr/exim/virtual/${if match{$domain}{^[^\\.]+(.*)\$}{$1}{default}}/aliases
     search_type=lsearch


(Note the different use of \\ because I haven't put that one in "".)

OR You could even put the name of the alias file for each domain as the
data in the list of domains, with lines like

*.virtdomain.org /usr/exim/virtual/virtdomain.com

and set file=${lookup{$domain}partial-lsearch{.... etc.



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



--
*** Exim information can be found at http://www.exim.org/ ***