Friday, March 30, 2007

Sakai LDAP Provider

Ok so I was attempting to connect Sakai up to our LDAP server to get user details and after a successful user login was seeing an error in the logs:

WARN: getUser() from LDAP directory exceptionnull (2007-03-29 17:32:34,597 http-
8443-Processor25_edu.amc.sakai.user.JLDAPDirectoryProvider)

Not the most helpful error so I edited the source so that it logged the stack trace as well:

java.lang.NullPointerException
       at com.novell.ldap.asn1.ASN1OctetString.<init>(Unknown Source)
       at com.novell.ldap.rfc2251.RfcLDAPString.<init>(Unknown Source)
       at com.novell.ldap.rfc2251.RfcAttributeDescription.<init>(Unknown Source
)
       at com.novell.ldap.rfc2251.RfcAttributeDescriptionList.<init>(Unknown So
urce)
       at com.novell.ldap.LDAPSearchRequest.<init>(Unknown Source)
       at com.novell.ldap.LDAPConnection.search(Unknown Source)
       at com.novell.ldap.LDAPConnection.search(Unknown Source)
       at edu.amc.sakai.user.JLDAPDirectoryProvider.getEntryFromDirectory(JLDAP
DirectoryProvider.java:360)
       at edu.amc.sakai.user.JLDAPDirectoryProvider.getUser(JLDAPDirectoryProvi
der.java:247)

Now we are getting a null pointer exception thrown from inside the novell LDAP library (not a good sign or very helpful). After a little bit of digging around I found the call line:

conn.search(getBasePath(), LDAPConnection.SCOPE_SUB, searchFilter, attribs, false, cons);

and it turns out (half an hour later) that one of the elements in the attribs array was set to null. This was caused by having a sakai configuration where I had removed the attribute mapping for the group memberships as I wasn't using it but it turns out that the provider was still attempting to retreive this value from the configuration and then using it. It really shouldn't be this hard to fix simple configuration problems.

I believe that this LDAP provider has had some work done on it for 2.4 and I'll check to see if this bug still exists in 2.4 and if it does send in a patch.

2 comments:

Term Papers said...
This comment has been removed by a blog administrator.
Cedric said...
This comment has been removed by a blog administrator.