Esempio n. 1
0
 private ActiveDirectoryConnectivityOutcome SearchUsingADDriver()
 {
     return(this.RunSearchOperationWithTimeCheck(delegate
     {
         QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ObjectClass, "*");
         base.Context.RecipientSession.Find(ADSession.GetDomainNamingContextForLocalForest(), QueryScope.Base, filter, null, 2);
         base.Context.CurrentDomainController = base.Context.RecipientSession.LastUsedDc;
         return 1;
     }));
 }
        // Token: 0x060007E9 RID: 2025 RVA: 0x0001D104 File Offset: 0x0001B304
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (subTreeSession == null)
            {
                throw new ArgumentNullException("subTreeSession");
            }
            EnumerableWrapper <T> enumerableWrapper = null;

            enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason));
            if (enumerableWrapper.HasElements())
            {
                return(enumerableWrapper);
            }
            if (!typeof(T).IsAssignableFrom(typeof(AccountPartition)))
            {
                return(enumerableWrapper);
            }
            if (this.fqdn != null)
            {
                ADObjectId adobjectId = ADSession.GetDomainNamingContextForLocalForest();
                adobjectId = adobjectId.GetChildId("System").GetChildId(this.fqdn.ToString());
                ADPagedReader <T> collection = session.FindPaged <T>(rootId, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, AccountPartitionSchema.TrustedDomainLink, adobjectId.DistinguishedName), null, 0, null);
                enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, collection);
                if (enumerableWrapper.HasElements())
                {
                    return(enumerableWrapper);
                }
                Guid g;
                Guid.TryParse(this.fqdn, out g);
                if (TopologyProvider.LocalForestFqdn.Equals(this.fqdn.ToString(), StringComparison.OrdinalIgnoreCase) || ADObjectId.ResourcePartitionGuid.Equals(g))
                {
                    collection        = session.FindPaged <T>(rootId, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, AccountPartitionSchema.IsLocalForest, true), null, 0, null);
                    enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, collection);
                }
                if (enumerableWrapper.HasElements())
                {
                    return(enumerableWrapper);
                }
                PartitionId partitionId;
                if (ADAccountPartitionLocator.IsSingleForestTopology(out partitionId) && this.fqdn.ToString().Equals(partitionId.ForestFQDN, StringComparison.OrdinalIgnoreCase) && partitionId.PartitionObjectId != null)
                {
                    base.UpdateInternalADObjectId(new ADObjectId(partitionId.PartitionObjectId.Value));
                    enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, base.GetExactMatchObjects <T>(rootId, session, optionalData));
                }
            }
            return(enumerableWrapper);
        }
Esempio n. 3
0
 protected bool IsMultitenancyEnabled()
 {
     return(ADSession.GetRootDomainNamingContextForLocalForest().Equals(ADSession.GetDomainNamingContextForLocalForest()) && !ADSession.IsBoundToAdam);
 }
        internal static MultiValuedProperty <ReconciliationCookie> GetReconciliationCookiesForNextCycle(string dc, Task.TaskErrorLoggingDelegate errorLogger)
        {
            MultiValuedProperty <ReconciliationCookie> multiValuedProperty = new MultiValuedProperty <ReconciliationCookie>();
            ITopologyConfigurationSession topologyConfigurationSession     = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(dc, true, ConsistencyMode.IgnoreInvalid, null, ADSessionSettings.FromRootOrgScopeSet(), 126, "GetReconciliationCookiesForNextCycle", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Common\\ProvisioningReconciliationHelper.cs");

            topologyConfigurationSession.UseConfigNC = false;
            MultiValuedProperty <ReplicationCursor> multiValuedProperty2 = topologyConfigurationSession.ReadReplicationCursors(ADSession.GetDomainNamingContextForLocalForest());

            topologyConfigurationSession.UseConfigNC = true;
            foreach (ReplicationCursor replicationCursor in multiValuedProperty2)
            {
                if (replicationCursor.SourceDsa != null)
                {
                    ADServer adserver = topologyConfigurationSession.FindDCByInvocationId(replicationCursor.SourceInvocationId);
                    if (adserver != null)
                    {
                        string dnsHostName        = adserver.DnsHostName;
                        ReconciliationCookie item = new ReconciliationCookie(ProvisioningReconciliationHelper.CurrentCookieVersion, dnsHostName, replicationCursor.SourceInvocationId, replicationCursor.UpToDatenessUsn);
                        multiValuedProperty.Add(item);
                    }
                }
            }
            return(multiValuedProperty);
        }
Esempio n. 5
0
        protected override void InternalProcessRecord()
        {
            if (this.Identity == null)
            {
                throw new ArgumentNullException("Identity");
            }
            TaskLogger.LogEnter();
            LocalizedString?localizedString;
            IEnumerable <ExchangeConfigurationUnit> dataObjects = base.GetDataObjects <ExchangeConfigurationUnit>(this.Identity, base.DataSession, this.RootId, base.OptionalIdentityData, out localizedString);
            OrganizationId organizationId = null;

            using (IEnumerator <ExchangeConfigurationUnit> enumerator = dataObjects.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ExchangeConfigurationUnit exchangeConfigurationUnit = enumerator.Current;
                    organizationId = exchangeConfigurationUnit.OrganizationId;
                    string originatingServer = exchangeConfigurationUnit.OriginatingServer;
                }
            }
            if (!base.HasErrors && organizationId == null)
            {
                base.WriteError(new ManagementObjectNotFoundException(localizedString ?? base.GetErrorMessageObjectNotFound(this.Identity.ToString(), typeof(ExchangeConfigurationUnit).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), (ErrorCategory)1003, null);
            }
            this.directoryInfo = new DirectoryBindingInfo();
            string name = organizationId.ConfigurationUnit.ToString();
            string distinguishedName = organizationId.OrganizationalUnit.DistinguishedName;
            DirectoryObjectCollection orgUnit;

            using (SearchResultCollection subtree = this.GetSubtree(distinguishedName))
            {
                orgUnit = new DirectoryObjectCollection(distinguishedName, subtree);
            }
            string     text       = organizationId.ConfigurationUnit.DistinguishedName;
            ADObjectId adobjectId = new ADObjectId(text);

            text = adobjectId.AncestorDN(1).ToDNString();
            DirectoryObjectCollection configUnit;

            using (SearchResultCollection subtree2 = this.GetSubtree(text))
            {
                configUnit = new DirectoryObjectCollection(text, subtree2);
            }
            this.WriteResult(new OrganizationData(name, orgUnit, configUnit, base.RootOrgContainerId.ToString(), ADSession.GetDomainNamingContextForLocalForest().ToString(), this.site.Name));
            TaskLogger.LogExit();
        }