Re: [EXIM] Case of local parts

Etusivu
Poista viesti
Vastaa
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: Bruce Bowler
Kopio: Chad Leigh, vtmue, eml
Aihe: Re: [EXIM] Case of local parts
On Wed, 24 Feb 1999, Bruce Bowler wrote:

> 1) Check as now, if found - deliver
> 2) Check as presented in address, if found - deliver


Remember that "deliver" in Exim terms means "send to a specific
transport". The transport, however, may itself want to use the local
part in some way - e.g. in /var/mail/$local_part - and so it too needs
to know what case to use.

I had the following thoughts overnight:

1. Unix user names are caseful.

2. People out in the world expect email local parts to be
case-independent.

3. We can probably assume that no Unix system admin will create two
accounts that differ only in their case.

4. Therefore, the problem is to find the correctly cased version of an
incoming local part.

5. Exim's default algorithm for doing this is "lower case it", because
that works in by far the majority of cases. (I would suspect it
really is around 99%.)

6. Exim's alternative algorithm is "leave it alone".

7. I cannot see that there are any other "obvious" algorithms that it
would be sensible to build in.

8. So, we have to find some way for the admin of such a system to
provide one.

9. It's not just a matter of persuading the localuser director to use
the right value - it has got to be available in other places as well,
e.g. for .forward files and for the mailbox name.

10. Therefore, the tidy way to do it is to transform the local part at 
    the start of processing, so that everything else uses the correctly 
    cased local part.


11. The smartuser director can be used to do this. If locally_caseless 
    is set false, and the first director 
    is


    fix_case:
      driver = smartuser
      new_address = <some magic>@$domain


    then it will create a modified new address that is handled by 
    everything else. (For maximum efficiency, it would be best to set


    new_director = name_of_subsequent_director


    to save it reprocessing the new local part again. The problem now 
    reduces to finding what to use for <some magic>.


12. If you have a simple algorithm, e.g. "first two characters are 
    always upper case, rest is lower case" you can write a string 
    expansion that does it:


    new_address = "${uc:${substr_0,2:$local_part}}\
                   ${lc:${substr_2:$local_part}}@$domain"


    which might work for BBowler, but probably not for root. If you want 
    to do something esoteric such as read /etc/passwd and do caseless 
    matching, or fuzzy matching, or anything else, you can use the 
    embedded Perl feature of Exim to get it to run a Perl function for 
    you:


    new_address = ${perl{$fix_local_part}{$local_part}}


    That is expensive, of course, but it will allow you to implement any 
    rule you choose. 


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



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