Hi!
I don't think there's a good way to solve this currently.
I also think so, we "solved" the problem by putting the complete homepath in LDAP.
pass_attrs = uid=user,userPassword=password,mailMessageStore=home=%$/telefonica.de/%Ln,mailFilterStore=sieve_dir=%$/telefonica.de/%Ln
Do mailMessageStore and mailFilterStore return different directories? If not, maybe you could just put those settings into plugin {} section. Then the %Ln is guaranteed to be what you want.
That doesn't seem to work.
Dec 11 10:43:59 dovecot: Fatal: userdb didn't return a home directory, but mail location used it (%h): %h/:INDEX=/mail/index/%Lu/
The problem seems to be, that dovecot replaces values "on the fly" while retrieving from ldap. Not in the order it is mentioned in config file.
Greetings
Thorsten