From 6efb354cce5b6b9f82b91c8813a9b1641b793b2d Mon Sep 17 00:00:00 2001 From: Dylan Plecki Date: Tue, 30 Jun 2015 12:12:40 -0500 Subject: [PATCH] Fix LDAP DN component matching with negative lookbehind RegEx --- .../org/keycloak/federation/ldap/idm/model/LDAPDn.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/federation/ldap/src/main/java/org/keycloak/federation/ldap/idm/model/LDAPDn.java b/federation/ldap/src/main/java/org/keycloak/federation/ldap/idm/model/LDAPDn.java index e47c897c7e..f4db5937a7 100644 --- a/federation/ldap/src/main/java/org/keycloak/federation/ldap/idm/model/LDAPDn.java +++ b/federation/ldap/src/main/java/org/keycloak/federation/ldap/idm/model/LDAPDn.java @@ -12,15 +12,12 @@ public class LDAPDn { private final Deque entries = new LinkedList<>(); - private static final Pattern dnRegex = Pattern.compile("[^,\\\\]*(?:\\\\.[^,\\\\]*)"); - public static LDAPDn fromString(String dnString) { LDAPDn dn = new LDAPDn(); - Matcher dnMatches = dnRegex.matcher(dnString); - - while (dnMatches.find()) { - String[] rdn = dnMatches.group(1).split("="); + String[] rdns = dnString.split("(?