Re: Rewrite rules

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Jon Morby
CC: exim-users
Sujet: Re: Rewrite rules
On Thu, 6 Mar 1997, Jon Morby wrote:

> So, question ... is it possible to incorporate the rewrite section as a dbm
> include, and if so how? (probably a fairly simple question, but it's
> bugged me since Monday and I haven't sussed it).


It should be possible to set up rewrite rules that are table driven. For
example, you could have

partial-dbm;/rewrite/rules     ${lookup{$local_part}dbm{/user/rewrites}\
                               {$value}fail}


This would first of all try to match the address using the lhs lookup,
first doing a partial lookup on the domain, and if that fails, doing an
exact lookup on the complete address. If the address matches, then the
rhs rule is used. My example just looks up the local part, but of course
you could look up $local_part@$domain or do a separate lookup for the
domain or whatever.

You can also just have one file for everything:

*@*    ${lookup{$local_part@$domain}dbm{/user/rewrites}{$value}fail}


if you wanted to be explicit for each case.

> For those who're interested I'm doing something like this ...
>
> *@*.f153.n254.z2.fidonet.org    $1@???
> *@f153.n254.z2.fidonet.org      $1@???


Hmm. I see the problem. The lhs could be done as above, but there isn't
an easy way to specify a lookup for the rhs because what you want to use
for the key is *part* of the domain. The opposite of what you want -
access to the wild part of the domain - is available, but not the rest.
I will have to think about a possible future extension for that.

> The other question is, I'm doing this as a rewrite, is there a
> better/simpler place to do it?


Not if you want it to affect the message's headers. If it's just a
routing thing, you could use a domainlist router, but I don't think it's
any more flexible at present.

--
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714