Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

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