Esempio n. 1
0
        // Token: 0x0600050A RID: 1290 RVA: 0x0001C860 File Offset: 0x0001AA60
        private PartitionBasedADRunspaceServerSettingsProvider GetProviderForPartition(string partitionFqdn)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn);
            TopologyProvider instance = TopologyProvider.GetInstance();
            SyncWrapper <PartitionBasedADRunspaceServerSettingsProvider> orAdd = this.internalProviders.GetOrAdd(partitionFqdn, (string key) => new SyncWrapper <PartitionBasedADRunspaceServerSettingsProvider>());
            PartitionBasedADRunspaceServerSettingsProvider value = orAdd.Value;

            if (value != null && Globals.GetTickDifference(value.LastTopoRecheck, Environment.TickCount) < (ulong)((long)instance.TopoRecheckIntervalMsec))
            {
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)this.GetHashCode(), "ADRunspaceServerSettingsProvider {0} ignoring topology version recheck for partition.", partitionFqdn);
                return(value);
            }
            lock (orAdd)
            {
                value = orAdd.Value;
                if (value == null || Globals.GetTickDifference(value.LastTopoRecheck, Environment.TickCount) > (ulong)((long)TopologyProvider.GetInstance().TopoRecheckIntervalMsec))
                {
                    int topologyVersion = instance.GetTopologyVersion(partitionFqdn);
                    if (value == null || value.TopologyVersion != topologyVersion)
                    {
                        ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)this.GetHashCode(), "ADRunspaceServerSettingsProvider {0}. Creating new provider version {1}", partitionFqdn, topologyVersion);
                        PartitionBasedADRunspaceServerSettingsProvider value2;
                        if (PartitionBasedADRunspaceServerSettingsProvider.TryCreateNew(partitionFqdn, instance, value, out value2))
                        {
                            orAdd.Value = value2;
                            orAdd.Value.TopologyVersion = topologyVersion;
                            orAdd.Value.LastTopoRecheck = Environment.TickCount;
                        }
                    }
                }
            }
            return(orAdd.Value);
        }
Esempio n. 2
0
 internal static ADObjectId GetRootDomainNamingContext(string partitionFqdn)
 {
     if (!Globals.IsDatacenter)
     {
         ExTraceGlobals.ADTopologyTracer.TraceDebug <string, string>(0L, "ADSession::GetRootDomainNamingContext '{0}' will use local forest '{1}'", partitionFqdn, TopologyProvider.LocalForestFqdn);
         partitionFqdn = TopologyProvider.LocalForestFqdn;
     }
     return(TopologyProvider.GetInstance().GetRootDomainNamingContext(partitionFqdn));
 }
Esempio n. 3
0
        public static void SetCurrentConfigDC(string serverName, string partitionFqdn)
        {
            if (string.IsNullOrEmpty(serverName))
            {
                throw new ArgumentNullException("serverName");
            }
            if (string.IsNullOrEmpty(partitionFqdn))
            {
                throw new ArgumentNullException("partitionFqdn");
            }
            TopologyProvider instance = TopologyProvider.GetInstance();

            instance.SetConfigDC(partitionFqdn, serverName, instance.DefaultDCPort);
        }
Esempio n. 4
0
        public static string GetCurrentConfigDC(string partitionFqdn)
        {
            ADSessionSettings adsessionSettings;

            if (PartitionId.IsLocalForestPartition(partitionFqdn))
            {
                adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            else
            {
                adsessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(new PartitionId(partitionFqdn));
            }
            Fqdn fqdn = adsessionSettings.ServerSettings.ConfigurationDomainController(partitionFqdn);

            if (fqdn != null)
            {
                return(fqdn.ToString());
            }
            return(TopologyProvider.GetInstance().GetConfigDC(partitionFqdn));
        }
        // Token: 0x060000AA RID: 170 RVA: 0x0000450C File Offset: 0x0000270C
        private bool NeedFullReload(ITopologyConfigurationSession session, bool forceFullReload, out string reason)
        {
            if (forceFullReload)
            {
                reason = "Full reload forced";
                return(true);
            }
            if (string.IsNullOrEmpty(this.domainController))
            {
                reason = "First read";
                return(true);
            }
            string configDCForLocalForest = TopologyProvider.GetInstance().GetConfigDCForLocalForest();

            if (!this.domainController.Equals(configDCForLocalForest, StringComparison.OrdinalIgnoreCase))
            {
                reason = string.Format("Config DC changed from {0} to {1}", this.domainController, configDCForLocalForest);
                return(true);
            }
            ExTraceGlobals.ADConfigLoaderTracer.TraceDebug((long)this.GetHashCode(), "Skipping full reload");
            reason = null;
            return(false);
        }
        // Token: 0x06000595 RID: 1429 RVA: 0x0001EE98 File Offset: 0x0001D098
        internal static ADServerInfo GetServerInfoFromFqdn(string fqdn, ConnectionType connectionType)
        {
            PooledLdapConnection pooledLdapConnection = null;
            string       empty = string.Empty;
            ADServerInfo adserverInfo;

            try
            {
                string partitionFqdn = Globals.IsMicrosoftHostedOnly ? ADServerSettings.GetPartitionFqdnFromADServerFqdn(fqdn) : TopologyProvider.LocalForestFqdn;
                pooledLdapConnection = ConnectionPoolManager.GetConnection(connectionType, partitionFqdn, null, fqdn, (connectionType == ConnectionType.GlobalCatalog) ? TopologyProvider.GetInstance().DefaultGCPort : TopologyProvider.GetInstance().DefaultDCPort);
                string writableNC = pooledLdapConnection.ADServerInfo.WritableNC;
                if (!pooledLdapConnection.SessionOptions.HostName.Equals(fqdn, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ADOperationException(DirectoryStrings.ErrorInvalidServerFqdn(fqdn, pooledLdapConnection.SessionOptions.HostName));
                }
                adserverInfo = pooledLdapConnection.ADServerInfo;
            }
            finally
            {
                if (pooledLdapConnection != null)
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            return(adserverInfo);
        }