[Building Sakai] JLDAP connection

Alexandre Ballesté alexandre.balleste at udl.cat
Mon Feb 25 02:56:48 PST 2013


Hi, in the 2.9.1 update we planed to stop using openldap and use jldap. 
While I was looking the code of JLDAPDirectoryProvider, I found that 
piece of code in authenticateUser method:
---

             ldapConnectionManager.returnConnection(conn);
             conn = null;
             if ( M_log.isDebugEnabled() ) {
                 M_log.debug("authenticateUser(): attempting to allocate 
bound connection [userLogin = " +
                         userLogin + "][bind dn [" + endUserDN + "]");
             }
             conn = ldapConnectionManager.getBoundConnection(endUserDN, 
password);

             if ( M_log.isDebugEnabled() ) {
                 M_log.debug("authenticateUser(): successfully allocated 
bound connection [userLogin = " +
                         userLogin + "][bind dn [" + endUserDN + "]");
             }
             return true;

         }
         catch (LDAPException e)
         {
             if (e.getResultCode() == LDAPException.INVALID_CREDENTIALS) {
                 if ( M_log.isWarnEnabled() ) {
                     M_log.warn("authenticateUser(): invalid credentials 
[userLogin = "
                             + userLogin + "]");
                 }
                 return false;

             } else {
----

My first impression is that ldap connection is not closed if the 
getBoundConnection is successful or when an Exception is fired and is 
INVALID_CREDENTIALS type.  My question are... Is that true? Does exist a 
reason for not closing the connection before return statement? Is not 
necessary close the connections?

Thanks in advance!!!



---

-- 
Alexandre Ballesté Crevillén  alexandre.balleste at udl.cat
=====================
University of Lleida
Information and Communication Systems Service
Analyst / Programmer
Twitter: @sinmsinm

Tlf: +34 973 702148
Fax: +34 973 702130
=====================




More information about the sakai-dev mailing list