Esempio n. 1
0
        internal static Organization GetRootOrgContainer(string partitionFqdn, string domainController, NetworkCredential credential)
        {
            bool       flag = string.IsNullOrEmpty(domainController);
            ADObjectId adobjectId;

            if (!PartitionId.IsLocalForestPartition(partitionFqdn))
            {
                adobjectId = ADSession.GetConfigurationNamingContext(partitionFqdn);
            }
            else if (flag)
            {
                adobjectId = ADSession.GetConfigurationNamingContextForLocalForest();
            }
            else
            {
                adobjectId = ADSession.GetConfigurationNamingContext(domainController, credential);
            }
            ADSessionSettings             sessionSettings = ADSessionSettings.FromRootOrgBootStrapSession(adobjectId);
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.NonCacheSessionFactory.CreateTopologyConfigurationSession(domainController, true, ConsistencyMode.PartiallyConsistent, flag ? null : credential, sessionSettings, 226, "GetRootOrgContainer", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ADSystemConfigurationSession.cs");

            Organization[] array = topologyConfigurationSession.Find <Organization>(adobjectId, QueryScope.SubTree, null, null, 1);
            if (array != null && array.Length > 0)
            {
                if (string.IsNullOrEmpty(domainController) && credential == null)
                {
                    InternalDirectoryRootOrganizationCache.PopulateCache(partitionFqdn, array[0]);
                }
                return(array[0]);
            }
            if (flag && (Globals.IsDatacenter || PartitionId.IsLocalForestPartition(partitionFqdn)))
            {
                throw new OrgContainerNotFoundException();
            }
            RootDse rootDse = topologyConfigurationSession.GetRootDse();

            if (rootDse.ConfigurationNamingContext.Equals(ADSession.GetConfigurationNamingContext(partitionFqdn)))
            {
                throw new OrgContainerNotFoundException();
            }
            return(null);
        }
Esempio n. 2
0
        public void RegisterForEdgeTransportEvents()
        {
            if (!this.NeedExplicitDeletedObjectSubscription)
            {
                return;
            }
            ADObjectId rootOrgContainerIdForLocalForest = TransportADNotificationAdapter.GetRootOrgContainerIdForLocalForest();
            ADObjectId childId            = rootOrgContainerIdForLocalForest.GetChildId("Administrative Groups").GetChildId(AdministrativeGroup.DefaultName);
            ADObjectId childId2           = rootOrgContainerIdForLocalForest.GetChildId(AcceptedDomain.AcceptedDomainContainer.Parent.Name);
            ADObjectId childId3           = childId.GetChildId(ServersContainer.DefaultName);
            ADObjectId childId4           = childId2.GetChildId(AcceptedDomain.AcceptedDomainContainer.Name);
            ADObjectId childId5           = childId3.GetChildId(Environment.MachineName).GetChildId(ProtocolsContainer.DefaultName).GetChildId(ReceiveConnector.DefaultName);
            ADObjectId childId6           = rootOrgContainerIdForLocalForest.GetChildId("Global Settings").GetChildId("Internet Message Formats");
            ADObjectId childId7           = childId.GetChildId(DatabasesContainer.DefaultName);
            ADObjectId childId8           = childId2.GetChildId("Rules").GetChildId("TransportVersioned");
            ADObjectId childId9           = childId2.GetChildId("Rules").GetChildId("JournalingVersioned");
            ADObjectId descendantId       = rootOrgContainerIdForLocalForest.GetDescendantId(InterceptorRule.InterceptorRulesContainer);
            ADObjectId childId10          = ADSession.GetConfigurationNamingContextForLocalForest().GetChildId(SitesContainer.DefaultName);
            ADObjectId childId11          = childId10.GetChildId("Inter-Site Transports").GetChildId("IP");
            ADObjectId childId12          = childId.GetChildId(RoutingGroupsContainer.DefaultName).GetChildId(RoutingGroup.DefaultName).GetChildId("Connections");
            ADObjectId parentContainerId  = childId12;
            ADObjectId parentContainerId2 = childId12;

            this.RegisterChangeNotificationForDeletedObject <AcceptedDomain>(childId4, new ADNotificationCallback(this.HandleAcceptedDomainDeleted));
            this.RegisterChangeNotificationForDeletedObject <ADSiteLink>(childId11, new ADNotificationCallback(this.HandleADSiteLinkDeleted));
            this.RegisterChangeNotificationForDeletedObject <DeliveryAgentConnector>(parentContainerId, new ADNotificationCallback(this.HandleDeliveryAgentConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <DomainContentConfig>(childId6, new ADNotificationCallback(this.HandleRemoteDomainDeleted));
            this.RegisterChangeNotificationForDeletedObject <ForeignConnector>(parentContainerId2, new ADNotificationCallback(this.HandleForeignConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <MailboxDatabase>(childId7, new ADNotificationCallback(this.HandleDatabaseDeleted));
            this.RegisterChangeNotificationForDeletedObject <ReceiveConnector>(childId5, new ADNotificationCallback(this.HandleReceiveConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <Server>(childId3, new ADNotificationCallback(this.HandleExchangeServerDeleted));
            this.RegisterChangeNotificationForDeletedObject <SmtpSendConnectorConfig>(childId12, new ADNotificationCallback(this.HandleSmtpSendConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <TransportRule>(childId8, new ADNotificationCallback(this.HandleTransportRuleDeleted));
            this.RegisterChangeNotificationForDeletedObject <TransportRule>(childId9, new ADNotificationCallback(this.HandleJournalRuleDeleted));
            this.RegisterChangeNotificationForDeletedObject <InterceptorRule>(descendantId, new ADNotificationCallback(this.HandleInterceptorRuleDeleted));
        }