src/share/classes/com/sun/jndi/ldap/LdapClient.java
Print this page
@@ -148,10 +148,15 @@
synchronized LdapResult
authenticate(boolean initial, String name, Object pw, int version,
String authMechanism, Control[] ctls, Hashtable<?,?> env)
throws NamingException {
+ int readTimeout = conn.readTimeout;
+ conn.readTimeout = conn.connectTimeout;
+ LdapResult res = null;
+
+ try {
authenticateCalled = true;
try {
ensureOpen();
} catch (IOException e) {
@@ -171,12 +176,10 @@
default:
throw new CommunicationException("Protocol version " + version +
" not supported");
}
- LdapResult res = null;
-
if (authMechanism.equalsIgnoreCase("none") ||
authMechanism.equalsIgnoreCase("anonymous")) {
// Perform LDAP bind if we are reauthenticating, using LDAPv2,
// supporting failover to LDAPv2, or controls have been supplied.
@@ -291,11 +294,14 @@
throw new AuthenticationException(
getErrorMessage(res.status, res.errorMessage));
}
conn.setV3(isLdapv3);
return res;
+ } finally {
+ conn.readTimeout = readTimeout;
}
+ }
/**
* Sends an LDAP Bind request.
* Cannot be private; called by LdapSasl
* @param dn The possibly null DN to use in the BIND request. null if anonymous.