Re: [Exim] Virtual users and `prefixed lookups'

Página Inicial
Delete this message
Reply to this message
Autor: Andreas J Mueller
Data:  
Para: exim-users
Assunto: Re: [Exim] Virtual users and `prefixed lookups'
Hi Adam!

Monday, December 29, 2003, 12:56:23 PM, you wrote:

> localuser_adamb:
> driver = accept
> domains = adam-barratt.org.uk
> local_parts = "lsearch;/etc/exim/mailusers.adam-barratt"
> retry_use_local_part
> transport = local_delivery
> user = ${lookup {$local_part} lsearch {/etc/exim/mailusers.adam-barratt}
> {$value} }


First of all, the idea of having a separate router for each domain is
not very appealing to me. It might me feasible for a few domains
which rarely change, but in other cases it's a maintainance headache.

> The problem we've got is making the `local_parts' clause work. Basically,
> given a mailusers file containing:


> fish-foo: mailuser
> ab-adam: adam
> ab-usenet: mailuser
> tree-fir: mailuser
> ab-foo: mailuser


You cannot make the local_parts clause work using this file. lsearch
is designed to look up single keys, whereas you are trying to look up
multiple keys (e.g., all entries starting with "ab-"). What you *can*
do is replace the local_parts clause with a general condition, and
modify the user option accordingly, like this:

    condition = ${lookup {ab-$local_part} lsearch {/etc/exim/mailusers} \
                  {yes}{no}}
    user = ${lookup {ab-$local_part} lsearch {/etc/exim/mailusers} \
             {$value} }


Do this for every router, replacing the prefix for each domain, and
you're basically done. One remaining problem would be to deliver
mail into mailboxes that also have the domain prefix (which I assume
you are going to do).

Andy