Skip to content

Commit

Permalink
Remove case sensitivity when searching in distinguishedName
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Aug 30, 2021
1 parent 8c6f0f7 commit 5a4e1b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions LDAPCP/LDAPCPConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,10 +1247,11 @@ public static void GetDomainInformation(string distinguishedName, out string dom
{
StringBuilder sbDomainFQDN = new StringBuilder();
domainName = String.Empty;
if (distinguishedName.Contains("DC="))
// String search in distinguishedName should not be case sensitive - https://github.com/Yvand/LDAPCP/issues/147
if (distinguishedName.IndexOf("DC=", StringComparison.InvariantCultureIgnoreCase) > 0)
{
int start = distinguishedName.IndexOf("DC=", StringComparison.InvariantCultureIgnoreCase);
string[] dnSplitted = distinguishedName.Substring(start).Split(new string[] { "DC=" }, StringSplitOptions.RemoveEmptyEntries);
string[] dnSplitted = distinguishedName.ToUpper().Substring(start).Split(new string[] { "DC=" }, StringSplitOptions.RemoveEmptyEntries);
bool setDomainName = true;
foreach (string dc in dnSplitted)
{
Expand Down

0 comments on commit 5a4e1b5

Please sign in to comment.