Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

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