apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
485 stars 136 forks source link

[LDAP] uid mapping not taken into account #485

Open Senso opened 7 years ago

Senso commented 7 years ago

I have LDAP setup and can bind to it. I also have the following in my plist.conf:

        <key>mapping</key>
        <dict>
          <key>uid</key>
          <array>
            <string>mail</string>
          </array>

Our company LDAP is made in such a way that our uids are not descriptive enough and we require everybody to use their email address as their username everywhere.

Yet, every time I try to log in with my email address, I get an error like this: [caldav-0] [txweb2.dav.resource#info] Could not find the principal resource for user id: toto@example.com

And in my OpenLDAP logs, on the server: conn=2952 op=2 SRCH base="<snip>" scope=2 deref=0 filter="(uid=toto@example.com)"

No matter how I change the config, it still always try to bind using uid=. Right now I got a workaround by doing an ugly hack:

.develop/virtualenv/src/twextpy/twext/who/ldap/_service.py
677a678
+                         filteredQuery = filteredQuery.replace('uid=', 'mail=')

is it possible that uid is NOT supposed to by mapped to anything else? In that case, I'll have to stay with code tweaks to make it work.