diff --git a/src/CommonLib/LDAPUtils.cs b/src/CommonLib/LDAPUtils.cs index 5711b86a..bba944c9 100644 --- a/src/CommonLib/LDAPUtils.cs +++ b/src/CommonLib/LDAPUtils.cs @@ -520,7 +520,7 @@ public IEnumerable DoRangedRetrieval(string distinguishedName, string at yield break; } - if (connWrapper == null) + if (connWrapper.Connection == null) yield break; var conn = connWrapper.Connection; @@ -1703,11 +1703,14 @@ private LdapConnectionWrapper CreateLDAPConnection(string target, AuthType authT if (!string.IsNullOrEmpty(baseDomainInfo.DomainSID)) { Cache.AddDomainSidMapping(baseDomainInfo.DomainFQDN, baseDomainInfo.DomainSID); + if (!string.IsNullOrEmpty(baseDomainInfo.DomainNetbiosName)) + { + Cache.AddDomainSidMapping(baseDomainInfo.DomainNetbiosName, baseDomainInfo.DomainSID); + } } if (!string.IsNullOrEmpty(baseDomainInfo.DomainNetbiosName)) { - Cache.AddDomainSidMapping(baseDomainInfo.DomainNetbiosName, baseDomainInfo.DomainSID); _netbiosCache.TryAdd(baseDomainInfo.DomainFQDN, baseDomainInfo.DomainNetbiosName); }