[Vmail-discuss] domain aliasing with local delivery

Paul Warren pdw@xxxxxxxxxxxxx
Fri, 26 Oct 2001 21:32:46 +0100


On Fri, Oct 26, 2001 at 10:05:54PM +0200, Jakob Hirsch wrote:
> ----- Original Message ----- From: "Paul Warren" <pdw@ex-parrot.com>
> 
> > My apologies.  This is a known issue which I have fixed locally, but
> > have not released.  If you put "limit 1" on the end of the queries then
> > this problem is alleviated.
> 
> Ok, thanks, that does it for me.
> But it's only a workaround, that only works if the real domain is
> listed in the domain-table before the alias domain.

The alias domain should not be listed in the domain-table at all - only
in the alias table.

The problem (AIUI) was that a query for e.g. mydomain.com was producing:

path    mbox_name   domain.domain_name  alias.alias
foo     bar         mydomain.com        myalias.com
foo     bar         mydomain.com
foo     bar         mydomain.com        myotheralias.com

The contents of path and mbox_name are always there, and always correct,
they just sometimes appear more than once.  The limit 1 means that only
one will be returned.  Have I missed something?

> Maybe this can't be handled in a single sql-statement...

I think the above is OK, but it's not exactly pretty.  I should have
also mentioned that the user query needs a limit 1:

user = ${lookup mysql{select unix_user from domain left join
domain_alias on domain_alias.domain_name = domain.domain_name where
domain.domain_name = '$domain' or domain_alias.alias = '$domain' limit
1}{$value}fail}

but I suspect you've already got that...

Paul