Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

4683cf
diff --git openjdk.orig/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java openjdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4683cf
index 70903206ea0..09956084cf9 100644
4683cf
--- openjdk.orig/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4683cf
+++ openjdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4683cf
@@ -189,6 +189,10 @@ public final class LdapCtxFactory implements ObjectFactory, InitialContextFactor
4683cf
                     ctx = getLdapCtxFromUrl(
4683cf
                             r.getDomainName(), url, new LdapURL(u), env);
4683cf
                     return ctx;
4683cf
+                } catch (AuthenticationException e) {
4683cf
+                    // do not retry on a different endpoint to avoid blocking
4683cf
+                    // the user if authentication credentials are wrong.
4683cf
+                    throw e;
4683cf
                 } catch (NamingException e) {
4683cf
                     // try the next element
4683cf
                     lastException = e;
4683cf
@@ -241,6 +245,10 @@ public final class LdapCtxFactory implements ObjectFactory, InitialContextFactor
4683cf
         for (String u : urls) {
4683cf
             try {
4683cf
                 return getUsingURL(u, env);
4683cf
+            } catch (AuthenticationException e) {
4683cf
+                // do not retry on a different URL to avoid blocking
4683cf
+                // the user if authentication credentials are wrong.
4683cf
+                throw e;
4683cf
             } catch (NamingException e) {
4683cf
                 ex = e;
4683cf
             }