Thanks for helping me to understand the problem. I will work with saving the sAMAccountName values in Active Directory in lower-case.
On Mon, Nov 7, 2016 at 5:24 PM, Viktor Dukhovni <postfix-us...@dukhovni.org> wrote: > > > On Nov 7, 2016, at 2:39 PM, Peter Fraser <petros.fra...@gmail.com> > wrote: > > > > I am using postfix to perform LDAP lookups on an Active Directory > Server. My ldap-users is below. I have noticed that the samaccountname > lookup is case sensitive so that when a user sends an email, it creates a > Maildir for the recipient with the samaccountname of the user. How can I > turn the case sensitivity off? > > > > query_filter = (&(objectclass=person)(mail=%s)) > > result_attribute = samaccountname > > result_format = %s/Maildir/ > > 1. The lookup is NOT case-sensitive, Postfix maps the input key > to lower-case, and even if it had not, LDAP matches for "mail" > are case-insensitive. > > 2. Your problem is that the *output* of the query is not folded > to lower-case. This is not "case-sensitivity". What's case > sensitive in this case is the filesystem in which the maildirs > are stored. > > 3. The best solution is to ensure that all the "sAMAccountName" > values in Active Directory are in lower-case. > > 4. If you're using Postfix 3.0 or later, you could use "pipemap" > to case-fold the output of LDAP lookups, given some table > that downcases arbitrary input strings. No such table is > built-in. That would require new code. The table could be > loaded dynamically, but I don't expect you'll want to take this > route. > > > -- > Viktor. > >