diff --git a/src/CommonLib/LdapConnectionPool.cs b/src/CommonLib/LdapConnectionPool.cs index 604591a2..813f5f08 100644 --- a/src/CommonLib/LdapConnectionPool.cs +++ b/src/CommonLib/LdapConnectionPool.cs @@ -31,7 +31,7 @@ internal class LdapConnectionPool : IDisposable{ private const int BackoffDelayMultiplier = 2; private const int MaxRetries = 3; private static readonly ConcurrentDictionary DCInfoCache = new(); - private static readonly ConcurrentHashSet _blacklistedDomains = new(); + private static readonly ConcurrentHashSet _excludedDomains = new(); public LdapConnectionPool(string identifier, string poolIdentifier, LdapConfig config, PortScanner scanner = null, NativeMethods nativeMethods = null, ILogger log = null) { _connections = new ConcurrentBag(); @@ -596,8 +596,8 @@ private bool CallDsGetDcName(string domainName, out NetAPIStructs.DomainControll } public async Task<(bool Success, LdapConnectionWrapper ConnectionWrapper, string Message)> GetConnectionAsync() { - if (_blacklistedDomains.Contains(_identifier)) { - return (false, null, $"Identifier {_identifier} blacklisted for connection attempt"); + if (_excludedDomains.Contains(_identifier)) { + return (false, null, $"Identifier {_identifier} excluded for connection attempt"); } if (!_connections.TryTake(out var connectionWrapper)) { @@ -618,10 +618,10 @@ private bool CallDsGetDcName(string domainName, out NetAPIStructs.DomainControll } public async Task<(bool Success, LdapConnectionWrapper ConnectionWrapper, string Message)> GetGlobalCatalogConnectionAsync() { - if (_blacklistedDomains.Contains(_identifier)) { - return (false, null, $"Identifier {_identifier} blacklisted for connection attempt"); + if (_excludedDomains.Contains(_identifier)) { + return (false, null, $"Identifier {_identifier} excluded for connection attempt"); } - + if (!_globalCatalogConnection.TryTake(out var connectionWrapper)) { var (success, connection, message) = await CreateNewConnection(true); if (!success) { @@ -700,7 +700,7 @@ public void Dispose() { _log.LogDebug( "Could not get domain object from GetDomain, unable to create ldap connection for domain {Domain}", _identifier); - _blacklistedDomains.Add(_identifier); + _excludedDomains.Add(_identifier); return (false, null, "Unable to get domain object for further strategies"); } tempDomainName = domainObject.Name.ToUpper().Trim(); @@ -735,7 +735,7 @@ public void Dispose() { } } catch (Exception e) { _log.LogInformation(e, "We will not be able to connect to domain {Domain} by any strategy, leaving it.", _identifier); - _blacklistedDomains.Add(_identifier); + _excludedDomains.Add(_identifier); } return (false, null, "All attempted connections failed");