Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

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