[Dovecot] Modifying LDAP search results for user_attrs

Timo Sirainen tss at iki.fi
Wed Apr 4 16:16:22 EEST 2012


On 4.4.2012, at 16.10, Patrick Ben Koetter wrote:

> I need to authenticate users via LDAP either by mailaddress or login name.
> In both cases the mailbox location is /src/mail/%d/%n. I can easily deduct
> that path from the mailaddress, but not so from the login name.

If you have something like mailAddress=user in your pass_attrs and user_attrs, so that the username gets translated to the mailaddress then you can use %n/%d in dovecot.conf.

> Can I get the mail address as part of fetching user_attrs and modify it on the
> fly? Something along the lines of this:
> 
> user_attrs = mail:/srv/mail/%d/%n=home,uidNumber=uid,gidNumber=gid
> 
> Or would I be able to modify this with a post-login script?


The correct syntax is:

user_attrs = =home=mail:/srv/mail/%d/%n, ..

but this assumes that the login is user at domain.

Without changing the username to mail address you can't use %d/%n directly, and post-login script would be the only way to go.




More information about the dovecot mailing list