Daniel Fisher created DIRAPI-122:
------------------------------------

             Summary: startTLS does not throw on handshake exceptions
                 Key: DIRAPI-122
                 URL: https://issues.apache.org/jira/browse/DIRAPI-122
             Project: Directory Client API
          Issue Type: Bug
    Affects Versions: 1.0.0-M16, 1.0.0-M15
            Reporter: Daniel Fisher


Invoking LdapNetworkConnection#startTls() does not propagate handshake 
exceptions out to the caller.
Instead, an InvalidConnectionException is experienced by the client on the next 
operation that uses the connection.
IMO, the call to #startTls() should throw any exception experienced by the 
extended operation.
Perhaps the method should also return the extended response, rather than void.

Sample code, connect to any directory server you don't trust:
{code}
import org.apache.directory.ldap.client.api.*;

public class StartTLS
{
  public static void main(String[] args)
    throws Exception
  {
    LdapConnectionConfig lcc = new LdapConnectionConfig();
    lcc.setLdapHost(args[0]);
    lcc.setLdapPort(Integer.parseInt(args[1]));
    LdapNetworkConnection lc = new LdapNetworkConnection(lcc);
    lc.connect();
    lc.startTls();
    System.out.println("StartTLS completed");
    System.out.println(lc.lookup("uid=foo,dc=example,dc=com"));
  }
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to