protected void PopulateDomainNamingContexts(string partitionFqdn) { TopologyProvider.EnforceNonEmptyPartition(partitionFqdn); ADServerInfo defaultServerInfo = this.GetDefaultServerInfo(partitionFqdn); if (string.IsNullOrEmpty(defaultServerInfo.WritableNC) || string.IsNullOrEmpty(defaultServerInfo.RootDomainNC)) { PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, defaultServerInfo, LocatorFlags.None); try { if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.WritableNC) && !TopologyProvider.IsAdamTopology()) { this.LogRootDSEReadFailureAndThrow("domainNamingContext", defaultServerInfo.FqdnPlusPort); } this.domainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.WritableNC); if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.RootDomainNC) && !TopologyProvider.IsAdamTopology()) { this.LogRootDSEReadFailureAndThrow("rootDomainNamingContext", defaultServerInfo.FqdnPlusPort); } this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.RootDomainNC); return; } finally { pooledLdapConnection.ReturnToPool(); } } this.domainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(defaultServerInfo.WritableNC); this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(defaultServerInfo.RootDomainNC); }
protected void PopulateConfigNamingContexts(string partitionFqdn) { TopologyProvider.EnforceNonEmptyPartition(partitionFqdn); ADServerInfo configDCInfo = this.GetConfigDCInfo(partitionFqdn, true); if (string.IsNullOrEmpty(configDCInfo.ConfigNC) || string.IsNullOrEmpty(configDCInfo.SchemaNC)) { PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, configDCInfo, LocatorFlags.None); try { if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.ConfigNC)) { this.LogRootDSEReadFailureAndThrow("configurationNamingContext", configDCInfo.FqdnPlusPort); } this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.ConfigNC); if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.SchemaNC)) { this.LogRootDSEReadFailureAndThrow("schemaNamingContext", configDCInfo.FqdnPlusPort); } this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.SchemaNC); return; } finally { pooledLdapConnection.ReturnToPool(); } } this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.ConfigNC); this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.SchemaNC); }
// Token: 0x060005AE RID: 1454 RVA: 0x0001FBF4 File Offset: 0x0001DDF4 protected void InternalAddPreferredDC(ADServerInfo serverInfo) { if (serverInfo == null) { throw new ArgumentNullException("serverInfo"); } if (string.IsNullOrEmpty(serverInfo.WritableNC)) { throw new ArgumentException("serverInfo.WritableNC should not be null or empty"); } ADObjectId key = new ADObjectId(serverInfo.WritableNC); if (this.serverPerDomain.ContainsKey(key)) { return; } Fqdn value = new Fqdn(serverInfo.Fqdn); lock (this.syncRoot) { if (!this.serverPerDomain.ContainsKey(key)) { this.serverPerDomain = new Dictionary <ADObjectId, Fqdn>(this.serverPerDomain) { { key, value } }; this.cachedPreferredDCList = new MultiValuedProperty <Fqdn>(this.serverPerDomain.Values); } } }
public override ADServerInfo GetServerFromDomainDN(string distinguishedName, NetworkCredential credential) { ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Need server from domain {0}. Credentials {1} NULL", distinguishedName, (credential == null) ? "are" : "are NOT"); ADServerInfo remoteServerFromDomainFqdn = this.GetRemoteServerFromDomainFqdn(NativeHelpers.CanonicalNameFromDistinguishedName(distinguishedName), credential); ExTraceGlobals.TopologyProviderTracer.TraceDebug <string>((long)this.GetHashCode(), "GetServerFromDomainDN returning {0}", remoteServerFromDomainFqdn.FqdnPlusPort); return(remoteServerFromDomainFqdn); }
internal string GetConfigDC(bool throwOnFailure) { ADServerInfo configDCInfo = this.GetConfigDCInfo(TopologyProvider.LocalForestFqdn, throwOnFailure); string text = (configDCInfo == null) ? null : configDCInfo.Fqdn; ExTraceGlobals.TopologyProviderTracer.TraceDebug <string>((long)this.GetHashCode(), "Topology Service reported Config DC: {0}", text ?? "<null>"); return(text); }
// Token: 0x060005A7 RID: 1447 RVA: 0x0001F8C9 File Offset: 0x0001DAC9 internal virtual void AddPreferredDC(ADServerInfo serverInfo) { if (this.EnforceIsUpdatableByADSession && !this.IsUpdatableByADSession) { throw new NotSupportedException("AddPreferredDC passing ADServerInfo is not supported on " + base.GetType().Name); } this.InternalAddPreferredDC(serverInfo); }
protected override IList <ADServerInfo> InternalGetServersForRole(string partitionFqdn, IList <string> currentlyUsedServers, ADServerRole role, int serversRequested, bool forestWideAffinityRequested = false) { LdapTopologyProvider.MiniTopology miniTopology = new LdapTopologyProvider.MiniTopology(partitionFqdn); miniTopology = this.topologies.GetOrAdd(partitionFqdn, miniTopology); if (ExTraceGlobals.TopologyProviderTracer.IsTraceEnabled(TraceType.DebugTrace)) { ExTraceGlobals.TopologyProviderTracer.TraceDebug((long)this.GetHashCode(), "PartitionFqdn {0}. GetServersForRole {1}, {2} current: [{3}], need {4} servers", new object[] { partitionFqdn, role, currentlyUsedServers.Count, string.Join(",", currentlyUsedServers ?? Enumerable.Empty <string>()), serversRequested }); } ADServerInfo adserverInfo = null; if (miniTopology.DCInfo == null) { adserverInfo = this.GetDirectoryServer(partitionFqdn, ADRole.DomainController); miniTopology.SetServerInfo(adserverInfo, ADServerRole.DomainController); miniTopology.IncrementTopologyVersion(); adserverInfo = null; } switch (role) { case ADServerRole.GlobalCatalog: adserverInfo = miniTopology.GCInfo; if (adserverInfo == null) { adserverInfo = this.GetDirectoryServer(partitionFqdn, ADRole.GlobalCatalog); miniTopology.SetServerInfo(adserverInfo, role); miniTopology.IncrementTopologyVersion(); } break; case ADServerRole.DomainController: case ADServerRole.ConfigurationDomainController: adserverInfo = ((ADServerRole.DomainController == role) ? miniTopology.DCInfo : miniTopology.CDCInfo); if (adserverInfo == null) { adserverInfo = this.GetDirectoryServer(partitionFqdn, ADRole.DomainController); miniTopology.SetServerInfo(adserverInfo, role); miniTopology.IncrementTopologyVersion(); } break; } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "PartitionFqdn {0}. GetServerForRole returning 1 server {1}", partitionFqdn, adserverInfo.FqdnPlusPort); ADProviderPerf.AddDCInstance(adserverInfo.Fqdn); ADServerInfo adserverInfo2 = (ADServerInfo)adserverInfo.Clone(); adserverInfo2.Mapping = (adserverInfo2.Fqdn.Equals((currentlyUsedServers == null || currentlyUsedServers.Count == 0) ? string.Empty : currentlyUsedServers[0], StringComparison.OrdinalIgnoreCase) ? 0 : -1); return(new List <ADServerInfo> { adserverInfo2 }); }
public void SetServerInfo(ADServerInfo serverInfo, ADServerRole role) { ArgumentValidator.ThrowIfNull("serverInfo", serverInfo); if (role == ADServerRole.None) { throw new ArgumentException("Invalid ADServerRole value. None"); } switch (role) { case ADServerRole.GlobalCatalog: { this.GCInfo = serverInfo; if (!Globals.IsDatacenter || (this.DCInfo != null && this.CDCInfo != null)) { return; } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0}. GC {1} will be set as DC or CDC", this.PartitionFqdn, serverInfo.Fqdn); ADServerInfo adserverInfo = serverInfo.CloneAsRole(ADRole.DomainController); if (this.DCInfo == null) { this.DCInfo = adserverInfo; } if (this.CDCInfo == null) { this.CDCInfo = adserverInfo; return; } return; } case ADServerRole.DomainController: case ADServerRole.ConfigurationDomainController: { if (this.CDCInfo == null) { this.CDCInfo = serverInfo; } if (this.DCInfo == null) { this.DCInfo = serverInfo; } if (!Globals.IsDatacenter || this.GCInfo != null) { return; } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0}. DC {1} will be set as GC", this.PartitionFqdn, serverInfo.Fqdn); ADServerInfo gcinfo = serverInfo.CloneAsRole(ADRole.GlobalCatalog); if (this.GCInfo == null) { this.GCInfo = gcinfo; return; } return; } } throw new NotSupportedException("Role Not Supported"); }
// Token: 0x0600057E RID: 1406 RVA: 0x0001ECF7 File Offset: 0x0001CEF7 public ADRole GetADRole(ADServerInfo adServerInfo) { ArgumentValidator.ThrowIfNull("adServerInfo", adServerInfo); if (adServerInfo.Port != 389) { return(ADRole.GlobalCatalog); } return(ADRole.DomainController); }
public string GetConfigDC(string partitionFqdn, bool throwOnFailure) { ADServerInfo configDCInfo = this.GetConfigDCInfo(partitionFqdn, throwOnFailure); if (configDCInfo != null) { return(configDCInfo.Fqdn); } return(null); }
internal override void AddPreferredDC(ADServerInfo serverInfo) { ADObjectId key = new ADObjectId(serverInfo.WritableNC); if (this.userServerPerDomain.ContainsKey(key)) { return; } base.AddPreferredDC(serverInfo); }
// Token: 0x060005A8 RID: 1448 RVA: 0x0001F900 File Offset: 0x0001DB00 internal virtual void AddPreferredDC(Fqdn fqdn) { if (this.EnforceIsUpdatableByADSession && !this.IsUpdatableByADSession) { throw new NotSupportedException("AddPreferredDC passing Fqdn is not supported on " + base.GetType().Name); } ADServerInfo serverInfoFromFqdn = ADServerSettings.GetServerInfoFromFqdn(fqdn, ConnectionType.DomainController); this.InternalAddPreferredDC(serverInfoFromFqdn); }
// Token: 0x0600057B RID: 1403 RVA: 0x0001EB18 File Offset: 0x0001CD18 private ADServerInfo InternalClone(string serverFqdn, ADRole?role = null) { if (string.IsNullOrEmpty(serverFqdn) && string.IsNullOrEmpty(this.Fqdn)) { throw new NotSupportedException("ServerFqdn can't null if this.Fqdn is null."); } if (!string.IsNullOrEmpty(this.Fqdn) && !string.IsNullOrEmpty(serverFqdn) && !string.Equals(this.Fqdn, serverFqdn, StringComparison.OrdinalIgnoreCase)) { throw new NotSupportedException("Current ADServerInfo already has serverName resolved. Names doesn't match"); } int port = this.Port; if (role != null) { ADRole adserverRole = this.GetADServerRole(); if (role.Value != adserverRole) { if (ADRole.GlobalCatalog == role.Value) { port = 3268; } else { port = 389; } } } ADServerInfo adserverInfo; if (!string.IsNullOrEmpty(this.PartitionFqdn)) { adserverInfo = new ADServerInfo(serverFqdn ?? this.Fqdn, this.PartitionFqdn, port, this.writableNC, this.DnsWeight, this.authType, true); } else { adserverInfo = new ADServerInfo(serverFqdn ?? this.Fqdn, port, this.writableNC, this.DnsWeight, this.authType); } if (!string.IsNullOrEmpty(this.siteName)) { adserverInfo.siteName = this.siteName; } if (!string.IsNullOrEmpty(this.ConfigNC)) { adserverInfo.ConfigNC = this.ConfigNC; } if (!string.IsNullOrEmpty(this.RootDomainNC)) { adserverInfo.RootDomainNC = this.RootDomainNC; } if (!string.IsNullOrEmpty(this.SchemaNC)) { adserverInfo.SchemaNC = this.SchemaNC; } return(adserverInfo); }
// Token: 0x060005A3 RID: 1443 RVA: 0x0001F7A0 File Offset: 0x0001D9A0 internal virtual void SetConfigurationDomainController(string partitionFqdn, ADServerInfo serverInfo) { if (this.EnforceIsUpdatableByADSession && !this.IsUpdatableByADSession) { throw new NotSupportedException("SetConfigurationDomainController passing ADServerInfo is not supported on " + base.GetType().Name); } lock (this.syncRoot) { this.configurationDomainController[partitionFqdn] = new Fqdn(serverInfo.Fqdn); } }
// Token: 0x0600059F RID: 1439 RVA: 0x0001F60C File Offset: 0x0001D80C internal virtual void SetPreferredGlobalCatalog(string partitionFqdn, ADServerInfo serverInfo) { if (this.EnforceIsUpdatableByADSession && !this.IsUpdatableByADSession) { throw new NotSupportedException("SetPreferredGlobalCatalog passing ADServerInfo is not supported on " + base.GetType().Name); } lock (this.syncRoot) { this.preferredGlobalCatalog[partitionFqdn] = new Fqdn(serverInfo.Fqdn); } }
private RunspaceServerSettings(string partitionFqdn, ADServerInfo serverInfo, string token) : this() { base.Token = token; this.partitionFqdn = partitionFqdn; if (serverInfo != null) { this.SetPreferredGlobalCatalog(partitionFqdn, serverInfo); this.SetConfigurationDomainController(partitionFqdn, serverInfo); this.AddPreferredDC(serverInfo); } }
private RunspaceServerSettings(string partitionFqdn, ADServerInfo gc, ADServerInfo cdc) : this() { this.partitionFqdn = partitionFqdn; if (gc != null) { this.SetPreferredGlobalCatalog(partitionFqdn, gc); } if (cdc != null) { this.SetConfigurationDomainController(partitionFqdn, cdc); } }
// Token: 0x0600050F RID: 1295 RVA: 0x0001C9CC File Offset: 0x0001ABCC public ADServerInfoState(ADServerInfo serverInfo, bool isLazySite) { this.serverInfo = serverInfo; this.isDown = false; this.isLazySite = isLazySite; if (isLazySite) { this.isInLocalSite = false; return; } this.isInLocalSite = ADRunspaceServerSettingsProvider.ADServerInfoState.IsDcInLocalSite(serverInfo); }
internal static RunspaceServerSettings CreateRunspaceServerSettings(string partitionFqdn, bool forestWideAffinityRequested = false) { ADRunspaceServerSettingsProvider instance = ADRunspaceServerSettingsProvider.GetInstance(); bool flag; ADServerInfo gcFromToken = instance.GetGcFromToken(partitionFqdn, null, out flag, forestWideAffinityRequested); RunspaceServerSettings runspaceServerSettings = new RunspaceServerSettings(partitionFqdn, gcFromToken, instance.GetConfigDc(partitionFqdn)); if (flag) { runspaceServerSettings.AddPreferredDC(gcFromToken); } return(runspaceServerSettings); }
// Token: 0x06000DC7 RID: 3527 RVA: 0x0003F2F4 File Offset: 0x0003D4F4 internal void AppendCustomServer(ADServerInfo serverInfo, ref bool presentAndDownOrDisconnected) { presentAndDownOrDisconnected = false; try { this.poolLock.AcquireWriterLock(-1); if (!this.isActive) { ExTraceGlobals.GetConnectionTracer.TraceWarning((long)this.GetHashCode(), "Pool is not active, skipping AppendCustomServer"); } else { for (int i = 0; i < this.connectionInfos.Length; i++) { ConnectionInfo connectionInfo = this.connectionInfos[i]; if (connectionInfo.ADServerInfo.Equals(serverInfo)) { ExTraceGlobals.GetConnectionTracer.TraceWarning <string>((long)this.GetHashCode(), "AppendCustomServer: {0} is already in the list", serverInfo.FqdnPlusPort); if (connectionInfo.ConnectionState == ConnectionState.Disconnected || (connectionInfo.ConnectionState == ConnectionState.Connected && !connectionInfo.PooledLdapConnection.IsUp)) { ExTraceGlobals.GetConnectionTracer.TraceWarning <string, string>((long)this.GetHashCode(), "AppendCustomServer: {0} is {1}", serverInfo.FqdnPlusPort, (connectionInfo.ConnectionState == ConnectionState.Disconnected) ? "Disconnected" : "Down"); presentAndDownOrDisconnected = true; } return; } } ExTraceGlobals.GetConnectionTracer.TraceDebug <string>((long)this.GetHashCode(), "Adding custom connection to {0}", serverInfo.Fqdn); ADProviderPerf.AddDCInstance(serverInfo.Fqdn); ConnectionInfo[] array = new ConnectionInfo[this.connectionInfos.Length + 1]; this.connectionInfos.CopyTo(array, 0); array[array.Length - 1] = new ConnectionInfo(serverInfo); this.connectionInfos = array; ADServerInfo[] array2 = new ADServerInfo[this.serverInfos.Length + 1]; this.serverInfos.CopyTo(array2, 0); array2[array2.Length - 1] = serverInfo; this.serverInfos = array2; } } finally { try { this.poolLock.ReleaseWriterLock(); } catch (ApplicationException) { } } }
// Token: 0x06000DC8 RID: 3528 RVA: 0x0003F4A4 File Offset: 0x0003D6A4 internal void MergePool(LdapConnectionPool sourcePool, List <PooledLdapConnection> connectionsToRelease) { if (!this.isActive || !sourcePool.isActive) { ExTraceGlobals.GetConnectionTracer.TraceWarning <bool, bool>((long)this.GetHashCode(), "MergePool - Pool not active. sourcePool = {0}, targetPool = {1}. skipping", sourcePool.isActive, this.isActive); return; } foreach (ConnectionInfo connectionInfo in sourcePool.connectionInfos) { ADServerInfo serverInfo = new ADServerInfo(connectionInfo.ADServerInfo.Fqdn, connectionInfo.ADServerInfo.PartitionFqdn, connectionInfo.ADServerInfo.Port, connectionInfo.ADServerInfo.WritableNC, connectionInfo.ADServerInfo.DnsWeight, connectionInfo.ADServerInfo.AuthType, true); bool flag = false; this.AppendCustomServer(serverInfo, ref flag); } this.MoveConnectionAcrossPool(sourcePool, connectionsToRelease); }
// Token: 0x06000514 RID: 1300 RVA: 0x0001CA44 File Offset: 0x0001AC44 private static bool IsDcInLocalSite(ADServerInfo serverInfo) { bool flag = false; if (!string.IsNullOrEmpty(serverInfo.PartitionFqdn) && !PartitionId.IsLocalForestPartition(serverInfo.PartitionFqdn)) { ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, string>((long)serverInfo.GetHashCode(), "Server {0} is in forest {1} which is not local forest, return IsDcInLocalSite == false", serverInfo.Fqdn, serverInfo.PartitionFqdn); return(false); } if (ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName == null) { try { ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName = NativeHelpers.GetSiteName(false); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)serverInfo.GetHashCode(), "Setting the local site name to {0}", ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName); } catch (CannotGetSiteInfoException) { ExTraceGlobals.ServerSettingsProviderTracer.TraceError((long)serverInfo.GetHashCode(), "GetSiteName has thrown a CannotGetSiteInfoException"); } } if (ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName != null) { if (Globals.IsMicrosoftHostedOnly && !string.IsNullOrEmpty(serverInfo.SiteName)) { flag = string.Equals(serverInfo.SiteName, ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName, StringComparison.OrdinalIgnoreCase); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug((long)serverInfo.GetHashCode(), "local site is: {0}, server {1} is in site {2}, return IsDcInLocalSite == {3}", new object[] { ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName, serverInfo.Fqdn, serverInfo.SiteName, flag }); return(flag); } try { StringCollection dcSiteCoverage = NativeHelpers.GetDcSiteCoverage(serverInfo.Fqdn); flag = dcSiteCoverage.Contains(ADRunspaceServerSettingsProvider.ADServerInfoState.localSiteName); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, string>((long)serverInfo.GetHashCode(), "Server {0} {1} in the local site", serverInfo.Fqdn, flag ? "is" : "is not"); } catch (CannotGetSiteInfoException) { ExTraceGlobals.ServerSettingsProviderTracer.TraceError((long)serverInfo.GetHashCode(), "GetDcSiteCoverage has thrown a CannotGetSiteInfoException"); } } return(flag); }
public override ADServerInfo GetServerFromDomainDN(string distinguishedName, NetworkCredential credential) { ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ServiceTopologyprovider - Need server from domain {0}. Credentials are {1}NULL", distinguishedName, (credential == null) ? string.Empty : "NOT "); ADServerInfo serverInfo = null; this.serviceProxyPool.CallServiceWithRetry(delegate(IPooledServiceProxy <ITopologyClient> proxy) { ServerInfo serverFromDomainDN = proxy.Client.GetServerFromDomainDN(distinguishedName); if (serverFromDomainDN != null) { serverInfo = serverFromDomainDN.ToADServerInfo(); } }, string.Format("GetServerFromDomainDN {0}", distinguishedName), 3); ExTraceGlobals.TopologyProviderTracer.TraceDebug <string>((long)this.GetHashCode(), "GetServerFromDomainDN returning {0}", (serverInfo != null) ? serverInfo.FqdnPlusPort : "<NULL>"); return(serverInfo); }
private ADServerInfo GetDirectoryServer(string partitionFqdn, ADRole role) { ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, ADRole>((long)this.GetHashCode(), "GetDirectoryServer PartitionFqdn {0}. Role {1}", partitionFqdn, role); LocatorFlags locatorFlags = LocatorFlags.ForceRediscovery | LocatorFlags.DirectoryServicesRequired | LocatorFlags.ReturnDnsName; string text = partitionFqdn; if (ADRole.GlobalCatalog == role) { ADObjectId rootDomainNamingContext = base.GetRootDomainNamingContext(partitionFqdn); ADObjectId domainNamingContext = base.GetDomainNamingContext(partitionFqdn); if (!rootDomainNamingContext.DistinguishedName.Equals(domainNamingContext.DistinguishedName, StringComparison.OrdinalIgnoreCase)) { text = NativeHelpers.CanonicalNameFromDistinguishedName(rootDomainNamingContext.DistinguishedName); } locatorFlags |= LocatorFlags.GCRequired; } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string, LocatorFlags>((long)this.GetHashCode(), "GetDirectoryServer. Partition Fqdn {0} Parent Domain {1}. Flags {2}", partitionFqdn, text, locatorFlags); ADServerInfo serverInfo = new ADServerInfo(null, text, (ADRole.GlobalCatalog == role) ? 3268 : 389, null, 100, AuthType.Kerberos, true); PooledLdapConnection pooledLdapConnection = null; ADServerInfo adserverInfo = null; try { pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, serverInfo, locatorFlags); if (!string.IsNullOrEmpty(pooledLdapConnection.SessionOptions.HostName)) { adserverInfo = pooledLdapConnection.ADServerInfo.CloneWithServerNameResolved(pooledLdapConnection.SessionOptions.HostName); } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "GetDirectoryServer. Partition Fqdn {0}. Server {1}", partitionFqdn, pooledLdapConnection.SessionOptions.HostName ?? string.Empty); } finally { if (pooledLdapConnection != null) { pooledLdapConnection.ReturnToPool(); } } string text2; LocalizedString localizedString; if (adserverInfo != null && SuitabilityVerifier.IsServerSuitableIgnoreExceptions(adserverInfo.Fqdn, ADRole.GlobalCatalog == role, null, out text2, out localizedString)) { return(adserverInfo); } return(LdapTopologyProvider.FindDirectoryServerForForestOrDomain(text, null, ADRole.GlobalCatalog == role)); }
// Token: 0x06000507 RID: 1287 RVA: 0x0001C79C File Offset: 0x0001A99C internal ADServerInfo GetGcFromToken(string partitionFqdn, string token, out bool isInLocalSite, bool forestWideAffinityRequested = false) { PartitionBasedADRunspaceServerSettingsProvider providerForPartition = this.GetProviderForPartition(partitionFqdn); if (providerForPartition != null) { ADServerInfo gcFromToken = providerForPartition.GetGcFromToken(token, out isInLocalSite, forestWideAffinityRequested); if (gcFromToken != null) { return(gcFromToken); } } if (Globals.IsDatacenter) { throw new ADTransientException(DirectoryStrings.ExceptionADTopologyNoServersForPartition(partitionFqdn)); } throw new ADTransientException(DirectoryStrings.ExceptionADTopologyHasNoAvailableServersInForest(partitionFqdn)); }
public override void ReportServerDown(string partitionFqdn, string serverName, ADServerRole role) { if (string.IsNullOrEmpty(serverName)) { ExTraceGlobals.TopologyProviderTracer.TraceWarning <string>((long)this.GetHashCode(), "PartitionFqdn {0}. ServerName is null or empty", partitionFqdn); return; } ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn); ArgumentValidator.ThrowIfNullOrEmpty("serverName", serverName); ExTraceGlobals.TopologyProviderTracer.TraceWarning <string, string, ADServerRole>((long)this.GetHashCode(), "PartitionFqdn {0}. {1} is down for role {2}. If this server is part of topology we will bump topology version.", partitionFqdn, serverName, role); LdapTopologyProvider.MiniTopology miniTopology = null; if (!this.topologies.TryGetValue(partitionFqdn, out miniTopology)) { ExTraceGlobals.TopologyProviderTracer.TraceWarning <string>((long)this.GetHashCode(), "PartitionFqdn {0} NOT FOUND.", partitionFqdn); return; } ADServerInfo dcinfo = miniTopology.DCInfo; ADServerInfo cdcinfo = miniTopology.CDCInfo; ADServerInfo gcinfo = miniTopology.GCInfo; ADServerRole adserverRole = ADServerRole.None; if (dcinfo != null && serverName.Equals(dcinfo.Fqdn, StringComparison.OrdinalIgnoreCase)) { miniTopology.ResetServerInfoForRole(ADServerRole.DomainController); adserverRole |= ADServerRole.DomainController; } if (cdcinfo != null && serverName.Equals(cdcinfo.Fqdn, StringComparison.OrdinalIgnoreCase)) { miniTopology.ResetServerInfoForRole(ADServerRole.ConfigurationDomainController); adserverRole |= ADServerRole.ConfigurationDomainController; } if (gcinfo != null && gcinfo.Fqdn.Equals(serverName, StringComparison.OrdinalIgnoreCase)) { miniTopology.ResetServerInfoForRole(ADServerRole.GlobalCatalog); adserverRole |= ADServerRole.GlobalCatalog; } if (adserverRole != ADServerRole.None) { miniTopology.IncrementTopologyVersion(); } ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, ADServerRole, int>((long)this.GetHashCode(), "PartitionFqdn {0}. Role(s) {1} were reported as down. Topology version change {2}.", partitionFqdn, adserverRole, miniTopology.Version); }
internal override ADServerInfo GetConfigDCInfo(string partitionFqdn, bool throwOnFailure) { Exception ex = null; ADServerInfo result = null; try { IList <ADServerInfo> list = this.InternalServiceProviderGetServersForRole(partitionFqdn, new List <string>(), ADServerRole.ConfigurationDomainController, 1, throwOnFailure, false); if (list.Count == 0) { result = null; } else { result = list[0]; } } catch (ADTransientException ex2) { ex = ex2; } catch (ADTopologyPermanentException ex3) { ex = ex3; } catch (ADTopologyUnexpectedException ex4) { ex = ex4; } finally { if (ex != null) { ExTraceGlobals.TopologyProviderTracer.TraceError <string>((long)this.GetHashCode(), "ServiceTopologyprovider - Could not get Config DC: {0}", ex.Message); if (throwOnFailure) { throw ex; } } } return(result); }
public static string GetConfigDC(string partitionFqdn, string serverName) { if (!Globals.IsDatacenter) { ExTraceGlobals.ADTopologyTracer.TraceDebug <string, string>(0L, "ADSession::GetConfigDC '{0}' will use local forest '{1}'", partitionFqdn, TopologyProvider.LocalForestFqdn); partitionFqdn = TopologyProvider.LocalForestFqdn; } string fqdn; using (ServiceTopologyProvider serviceTopologyProvider = new ServiceTopologyProvider(serverName)) { ADServerInfo configDCInfo = serviceTopologyProvider.GetConfigDCInfo(partitionFqdn, false); if (configDCInfo == null) { throw new ADTransientException(DirectoryStrings.ExceptionADTopologyUnexpectedError(serverName, string.Empty)); } fqdn = configDCInfo.Fqdn; } return(fqdn); }
// Token: 0x06000521 RID: 1313 RVA: 0x0001D2B0 File Offset: 0x0001B4B0 internal ADServerInfo GetGcFromToken(string token, out bool isInLocalSite, bool forestWideAffinityRequested = false) { isInLocalSite = false; if (forestWideAffinityRequested) { if (this.inForestGCs != null) { ADServerInfo serverFromToken = this.GetServerFromToken(token, this.allInForestGCs, this.inForestGCs, PartitionBasedADRunspaceServerSettingsProvider.hashBaseForest); isInLocalSite = false; if (serverFromToken != null) { return(serverFromToken); } ExTraceGlobals.ServerSettingsProviderTracer.TraceWarning <string>((long)this.GetHashCode(), "{0} - There is no Global Catalog available in the forest.", this.partitionFqdn); } } else { isInLocalSite = true; if (this.inSiteGCs != null && this.allInSiteGCs != null) { ADServerInfo serverFromToken = this.GetServerFromToken(token, this.allInSiteGCs, this.inSiteGCs, PartitionBasedADRunspaceServerSettingsProvider.hashBase); if (serverFromToken != null) { return(serverFromToken); } ExTraceGlobals.ServerSettingsProviderTracer.TraceWarning <string, string>((long)this.GetHashCode(), "{0} - There is no Global Catalog available in the local site for token {1}", this.partitionFqdn, token ?? "<null>"); } isInLocalSite = false; if (this.outOfSiteGCs != null && this.allOutOfSiteGCs != null) { ADServerInfo serverFromToken = this.GetServerFromToken(token, this.allOutOfSiteGCs, this.outOfSiteGCs, PartitionBasedADRunspaceServerSettingsProvider.hashBase); if (serverFromToken != null) { return(serverFromToken); } ExTraceGlobals.ServerSettingsProviderTracer.TraceWarning <string, string>((long)this.GetHashCode(), "{0} - There is no Global Catalog available in remote site for token {1}", this.partitionFqdn, token ?? "<null>"); } } return(null); }
internal static RunspaceServerSettings CreateGcOnlyRunspaceServerSettings(string token, string partitionFqdn, bool forestWideAffinityRequested = false) { if (string.IsNullOrEmpty(token)) { throw new ArgumentNullException("token"); } if (string.IsNullOrEmpty(partitionFqdn)) { throw new ArgumentNullException("partitionFqdn"); } ADRunspaceServerSettingsProvider instance = ADRunspaceServerSettingsProvider.GetInstance(); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)instance.GetHashCode(), "GetGcOnlyRunspaceServerSettings for token {0}", token); bool flag; ADServerInfo gcFromToken = instance.GetGcFromToken(partitionFqdn, token, out flag, forestWideAffinityRequested); return(new RunspaceServerSettings(partitionFqdn, gcFromToken, token) { ViewEntireForest = true }); }