Sub addressing delimiters

Kurt Fitzner kurt+dove at va1der.ca
Sun Aug 28 02:33:52 UTC 2016


On 2016-08-24 09:20, Tanstaafl wrote:

> Objection: assumes facts not in evidence.
> 
> This is the way it is supposed to work now in dovecot, so, either it is
> now broken, was always broken ... or you are not doing it right.
> 
> But we'd need to see your config to make that determination...

How about source tree?

I now present my case to the court. :)

1) The changelog: 2009-11-10  * src/lib-lda/lda-settings.c, 
src/lmtp/commands.c: recipient_delimiter: Allow multi-character 
delimiters. [0d659ac4656d] <HEAD> (taken from the change log in 2.2.13 
since this entry is no longer visible in the change log in 2.2.13.  
There are no other relevant entries referencing recipient_delimiter in 
2.2.25.  This isn't a sure indication, but it seems to me to imply what 
the intention was.

2) rcpt_address_parse() in lmtp/commands.c

   domain = strchr(address, '@');
   p = strstr(address, client->unexpanded_lda_set->recipient_delimiter);

This function is looking for the domain separation with strchr(), but 
looking for the username and detail separation with strstr().  To treat 
recipient_delimiter as a list of single-character delimiters you can 
pick from, then you'd need to loop through recipient_delimiter and use 
strchr() for each character.

3) Right now I have recipient_delimiter set to + and it works.  When I 
tried to set it to +_ to use either a plus or underscore, then sent test 
email to name_detail at domain.org it caused an error, but 
name+_detail at domain.org was delivered correctly.  Reversing the order in 
dovecot's recipient_delimiter setting to _+ caused only 
name_+detail at domain.org to work in test emails.

Switching to the behaviour where recipient_delimiter is treated as a 
list of usable delimiters might not be totally trivial.  If you look in 
address_add_detail() in lmtp/commands.c you'll see why. This function is 
trying to recreate a complete email address from the recipient, the 
detail, and domain but since the delimiter that was used when the 
username/detail was split isn't saved, it simply uses the 
multi-character recipient_delimiter setting in its entirety.

     Kurt



More information about the dovecot mailing list