Re: [Exim] No searchable archives?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: John Horne
Dátum:  
Címzett: Exim Users List
Tárgy: Re: [Exim] No searchable archives?
On 21-Jun-00 at 08:23:28 Philip Hazel wrote:
> Your example isn't precise enough to show exactly what you are doing.
>

On 20-Jun-00 at 21:52:18 Vadim Vygonets wrote:
> I never had that problem. Show me your lookup and I'll try to
> see what's wrong with it.
>

Well, you two asked for it...:-) The actual bit of the configuration is this:

new_address = "${if match {$local_part} {\\\\.} \
                  {${lookup {${lc:$local_part}} cdb {TABLES/aliases.cdb} \
                             {$value} fail}} \
             {${lookup {${lc:$local_part}:alias} cdb {TABLES/aliases.cdb} \
                        {${lookup {${lc:$value}} cdb {TABLES/aliases.cdb} \
                             {$value} fail}} fail}}}"


This is within a smartuser director. Sorry it looks a bit messy.

It basically says (I hope) that if the local part has dot in it then lookup
the local part in the aliases file and return the value or fail. If it
doesn't have a dot in it then lookup the value with the 'alias' key word in
the aliases file. If the lookup fails then fail completely. If the lookup
works then lookup the returned value itself in the aliases file and again
return the newly found value or fail.

> There are two ways to do it. The first is this:
> ${lookup{x}lsearch{/file1}{${lookup{$value}lsearch{/file2 .... } fail}
> The second is this
> ${lookup{${lookup{x}lsearch{/file1}{$value}{*}}}lsearch{/file2}...
>
> The first way fails in the way you describe because the contents of
> $value are reset at the start of a lookup item;
>

Yup, I'm using the first method and yes $value does seem to end up as null.

> the second one should work.
>

Okay, I'll try it. However, I'm also considering an alternative solution
involving the S rewrite flag - there will be a question about this sent to
the list today probably :-)

> I will see if I can delay the resetting of $value until after the
> expansion of the key and file strings so that the first way will also
> work, but in the meantime, the workaround is to use the second form.
>

Thanks.

John.

--------------------------------------------------------------------------
John Horne, University of Plymouth, UK             Tel: +44 (0)1752 233914
E-mail: jhorne@???
PGP key available from public key servers