I was having a problem where the module wasn't grabbing the email attribute from LDAP. As it turns out, the part of code that's trying to get the email attribute is binding as the user trying to log in. The LDAP server we're using doesn't seem to allow users to even view their own email attribute.

I have the module configured for non-anonymous searches, and the code didn't seem to be taking advantage of that. I'm submitting a simple patch that seems to work for me. It basically checks to see if the ldap_search_as_dn variable is set. If so, close the current ldap connection, grab the ldap_search_as_pass, and re-bind to the LDAP server.

CommentFileSizeAuthor
non-anonymous.patch.txt521 bytesjs1

Comments

pablobm’s picture

Title: non-anonymous searches » Module fails to retrieve e-mail when user first logs in
Assigned: Unassigned » pablobm

Thanks for the tip. Yes, it looks to me I'm connect()-ing as the wrong user there. I changed the connect() line so it logs in as the "editor super-user", as it does when accessing anything else from ldapdata. It should therefore work now properly.

pablobm’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)