Autor: Kevin P. Fleming Data: Dla: exim-users Temat: Re: [Exim] Exim 4.14 ChangeLog item #90: local part prefixes/suffixes
Philip Hazel wrote: > This just goes to prove the old saying that one person's bug is another
> person's facility. Sigh.
<G>
> Seems like NOT using local_part_prefix is called for, so that you don't
> mess with the local part for RCPT. Then, I think, regular expressions
> are your friend. Something like
>
> ${if match{$local_part}{\N^([^+]+)\+\N}{$1}{$local_part}}
>
> should give you "user" or the full local part if there's no "+" in it.
> You can use this in the lookup that validates the local part, and also
> in setting authenticated_sender, can't you?
>
Here's what I arrived at after a few iterations. The router is:
This just replaces + characters in the local part with . characters,
then does a lookup into the Cyrus mailbox list. This actually has one
small flaw, in that if a message comes in address to user+foobar, but
"user" does not have a "foobar" folder it will get rejected. However, if
it was accepted, Cyrus would take and just put it into the user's Inbox.
Not a big deal for me.
This strips the +folder portion off the local part and supplies the
remainder as authenticated_sender. This appears to be working OK,
although there are some issues with caseful matching (Cyrus is case
sensitive on local parts and folder names, at least for now). I may go
back to having a router ahead of "local" that uses redirect to lowercase
the entire local part before "local" gets it; this avoids the issue
because then Exim use the lowercased part everywhere.
Ideally, I could avoid the complicated router if I could do an LMTP
callforward. However, making the callout code be able to handle AUTH is
a non-trivial exercise. If you're interested, I'd like to discuss it
with you, Philip, just to see if it's doable.