Example #1
0
 // Token: 0x0600036B RID: 875 RVA: 0x00012AE8 File Offset: 0x00010CE8
 private static void CreateWrappedContextForRegisterChangeNotification(ref ADObjectId baseDN, ADNotificationCallback callback, object context, out object wrappedContext)
 {
     if (callback == null)
     {
         throw new ArgumentNullException("callback");
     }
     if (baseDN == null)
     {
         ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 1089, "CreateWrappedContextForRegisterChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs");
         baseDN = topologyConfigurationSession.GetOrgContainerId();
     }
     ExTraceGlobals.ADNotificationsTracer.TraceDebug <ADObjectId, string, string>(0L, "new change notification registration for {0} from {1}.{2}", baseDN, callback.Method.DeclaringType.FullName, callback.Method.Name);
     wrappedContext = ADNotificationAdapter.CreateWrappingContext(callback, context);
 }
        public static bool ValidateDomainName(AcceptedDomain domain, Exception duplicateAcceptedDomainException, Exception conflictingAcceptedDomainException, out Exception error)
        {
            IConfigurationSession session;

            if (Globals.IsDatacenter)
            {
                try
                {
                    session = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromTenantAcceptedDomain(domain.DomainName.Domain), 432, "ValidateDomainName", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs");
                    goto IL_5C;
                }
                catch (CannotResolveTenantNameException)
                {
                    error = null;
                    return(true);
                }
            }
            session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 442, "ValidateDomainName", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs");
IL_5C:
            return(ADAccountPartitionLocator.ValidateDomainName(domain, session, duplicateAcceptedDomainException, conflictingAcceptedDomainException, out error));
        }
Example #3
0
        private static MultiValuedProperty <string> ReadLocalServerComponentStatesFromAD()
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 480, "ReadLocalServerComponentStatesFromAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ServerComponentStateManager.cs");
            string machineName = Environment.MachineName;
            Server server      = topologyConfigurationSession.FindServerByName(machineName);

            if (server != null)
            {
                return(server.ComponentStates);
            }
            topologyConfigurationSession.UseConfigNC      = false;
            topologyConfigurationSession.UseGlobalCatalog = true;
            ADComputer adcomputer = topologyConfigurationSession.FindComputerByHostName(machineName);

            if (adcomputer == null)
            {
                throw new LocalServerNotFoundException(machineName);
            }
            return(adcomputer.ComponentStates);
        }
Example #4
0
        // Token: 0x0600035A RID: 858 RVA: 0x00012274 File Offset: 0x00010474
        public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context, ExchangeTopologyScope topologyType)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 387, "RegisterExchangeTopologyChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs");
            ADObjectId childId        = topologyConfigurationSession.ConfigurationNamingContext.GetChildId("CN", "Sites");
            ADObjectId childId2       = childId.GetChildId("CN", "Inter-Site Transports").GetChildId("CN", "IP");
            ADObjectId orgContainerId = topologyConfigurationSession.GetOrgContainerId();

            ADNotificationRequest[] requests;
            switch (topologyType)
            {
            case ExchangeTopologyScope.Complete:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSubnet>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADEmailTransport>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0]
                };
                break;

            default:
                throw new ArgumentException("topologyType", "topologyType");
            }
            return(new ADNotificationRequestCookie(requests));
        }
Example #5
0
 private ADSchemaDataProvider()
 {
     this.schemaSession                   = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 82, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADSchemaDataProvider.cs");
     this.constraintDictionary            = new Dictionary <ADSchemaDataProvider.PropertyKey, PropertyDefinitionConstraint[]>();
     this.schemaAttributeObjectDictionary = new ConcurrentDictionary <string, ADSchemaAttributeObject>(StringComparer.OrdinalIgnoreCase);
 }
Example #6
0
        private static GlsLookupMode InitializeLookupMode()
        {
            string value = null;

            try
            {
                using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(GlsMServDirectorySession.RegistryKey))
                {
                    value = ((registryKey != null) ? ((string)registryKey.GetValue(GlsMServDirectorySession.GlobalDirectoryLookupTypeValue, null)) : null);
                }
            }
            catch (SecurityException ex)
            {
                ExTraceGlobals.GLSTracer.TraceError <string>(0L, "SecurityException: {0}", ex.Message);
            }
            catch (UnauthorizedAccessException ex2)
            {
                ExTraceGlobals.GLSTracer.TraceError <string>(0L, "UnauthorizedAccessException: {0}", ex2.Message);
            }
            GlsLookupMode result;

            if (Enum.TryParse <GlsLookupMode>(value, true, out result))
            {
                return(result);
            }
            if (DatacenterRegistry.IsForefrontForOffice())
            {
                return(GlsLookupMode.GlsOnly);
            }
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 694, "InitializeLookupMode", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\GlsMServDirectorySession.cs");
            ADSite localSite = topologyConfigurationSession.GetLocalSite();

            if (localSite.DistinguishedName.EndsWith("DC=extest,DC=microsoft,DC=com"))
            {
                return(GlsLookupMode.MServOnly);
            }
            return(GlsLookupMode.BothGLSAndMServ);
        }
        // Token: 0x060000A8 RID: 168 RVA: 0x000041D8 File Offset: 0x000023D8
        private IEnumerable <T> GetRefreshedData(bool forceFullReload)
        {
            IEnumerable <T> values;

            lock (this.syncRoot)
            {
                ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.NonCacheSessionFactory.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 96, "GetRefreshedData", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADConfigLoader.cs");
                long   val = this.maxUsnChanged;
                string arg;
                bool   flag2 = this.NeedFullReload(topologyConfigurationSession, forceFullReload, out arg);
                if (!flag2)
                {
                    QueryFilter     filter     = new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, SharedPropertyDefinitions.UsnChanged, this.maxUsnChanged + 1L);
                    int             num        = 0;
                    int             num2       = 0;
                    IEnumerable <T> enumerable = this.LoadData(topologyConfigurationSession, filter, true);
                    foreach (T value in enumerable)
                    {
                        val = Math.Max(val, value.UsnChanged);
                        if (value.Id.IsDeleted)
                        {
                            T t;
                            if (this.currentConfigObjects.TryGetValue(value.Id.ObjectGuid, out t))
                            {
                                this.currentConfigObjects.Remove(value.Id.ObjectGuid);
                                num2++;
                            }
                        }
                        else if (value.IsValid)
                        {
                            this.currentConfigObjects[value.Id.ObjectGuid] = value;
                            num++;
                        }
                    }
                    if (!this.CheckIfDomainControllerIsTheSame(topologyConfigurationSession, out arg))
                    {
                        flag2 = true;
                    }
                    ExTraceGlobals.ADConfigLoaderTracer.TraceDebug <int, int, string>((long)this.GetHashCode(), "Found {0} updated and {1} deleted objects of type {2}", num, num2, ADConfigLoader <T> .typeName);
                }
                if (flag2)
                {
                    ExTraceGlobals.ADConfigLoaderTracer.TraceDebug <string>((long)this.GetHashCode(), "We need full reload. Reason: {0}", arg);
                    val = 0L;
                    this.currentConfigObjects = new Dictionary <Guid, T>(1024);
                    foreach (T value2 in this.LoadData(topologyConfigurationSession, null, false))
                    {
                        if (value2.IsValid)
                        {
                            this.currentConfigObjects.Add(value2.Id.ObjectGuid, value2);
                            val = Math.Max(val, value2.UsnChanged);
                        }
                    }
                    ExTraceGlobals.ADConfigLoaderTracer.TraceDebug <int, string>((long)this.GetHashCode(), "Found {0} objects of type {1}", this.currentConfigObjects.Count, ADConfigLoader <T> .typeName);
                }
                this.maxUsnChanged    = val;
                this.domainController = topologyConfigurationSession.Source;
                values = this.currentConfigObjects.Values;
            }
            return(values);
        }
        private void ReadLocalSiteAndResetSiteRefreshTime()
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1056, "ReadLocalSiteAndResetSiteRefreshTime", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\MServDirectorySession.cs");

            MServDirectorySession.localSite            = topologyConfigurationSession.GetLocalSite();
            MServDirectorySession.lastLocalSiteRefresh = ExDateTime.Now;
        }
 internal GlobalThrottlingPolicyCache(TimeSpan refreshInterval)
 {
     this.session      = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 481, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\throttlingpolicycache.cs");
     this.refreshTimer = new GuardedTimer(new TimerCallback(this.Refresh), null, refreshInterval);
 }