Ejemplo n.º 1
0
        public override EdgeConfigStatus Validate(EdgeConnectionInfo subscription)
        {
            EdgeConfigStatus edgeConfigStatus = base.Validate(subscription);

            this.ValidateExchangeServerRecipient(edgeConfigStatus);
            return(edgeConfigStatus);
        }
Ejemplo n.º 2
0
        public override EdgeConfigStatus Validate(EdgeConnectionInfo subscription)
        {
            this.SaveEdgeConnection(subscription);
            EdgeConfigStatus edgeConfigStatus = new EdgeConfigStatus();

            try
            {
                List <string> list = ConfigValidator.CombineAttributes(this.PayloadAttributes, this.ReadAttributes);
                Dictionary <string, ExSearchResultEntry> adentries = this.GetADEntries();
                bool flag = true;
                int  num  = 0;
                uint num2 = 0U;
                this.adamRootPath = DistinguishedName.Concatinate(new string[]
                {
                    "CN=First Organization,CN=Microsoft Exchange,CN=Services",
                    subscription.EdgeConnection.AdamConfigurationNamingContext
                });
                if (base.ProgressMethod != null)
                {
                    base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num));
                }
                foreach (ExSearchResultEntry exSearchResultEntry in subscription.EdgeConnection.PagedScan(this.ADAMSearchPath, this.ADAMLdapQuery, this.searchScope, list.ToArray()))
                {
                    string adamRelativePath = this.GetAdamRelativePath(exSearchResultEntry);
                    if (adentries.ContainsKey(adamRelativePath))
                    {
                        if (this.Filter(adentries[adamRelativePath]))
                        {
                            if (!this.CompareAttributes(exSearchResultEntry, adentries[adamRelativePath], this.PayloadAttributes) && !this.IsInChangeWindow(adentries[adamRelativePath]))
                            {
                                if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.ConflictObjects.Count))
                                {
                                    edgeConfigStatus.ConflictObjects.Add(new ADObjectId(adentries[adamRelativePath].DistinguishedName));
                                }
                                flag = false;
                            }
                            else
                            {
                                num2 += 1U;
                            }
                        }
                        else if (this.FilterEdge(exSearchResultEntry))
                        {
                            if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.EdgeOnlyObjects.Count))
                            {
                                edgeConfigStatus.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName));
                            }
                            flag = false;
                        }
                        adentries.Remove(adamRelativePath);
                    }
                    else if (this.FilterEdge(exSearchResultEntry))
                    {
                        if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.EdgeOnlyObjects.Count))
                        {
                            edgeConfigStatus.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName));
                        }
                        flag = false;
                    }
                    if (num % 500 == 0 && base.ProgressMethod != null)
                    {
                        base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num));
                    }
                    num++;
                }
                if (base.ProgressMethod != null)
                {
                    base.ProgressMethod(Strings.LoadingADAMComparisonList(this.configObjectName, subscription.EdgeServer.Name), Strings.LoadedADAMObjectCount(num));
                }
                foreach (ExSearchResultEntry exSearchResultEntry2 in adentries.Values)
                {
                    if (this.Filter(exSearchResultEntry2) && !this.IsInChangeWindow(exSearchResultEntry2))
                    {
                        if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)edgeConfigStatus.OrgOnlyObjects.Count))
                        {
                            edgeConfigStatus.OrgOnlyObjects.Add(new ADObjectId(exSearchResultEntry2.DistinguishedName));
                        }
                        flag = false;
                    }
                }
                edgeConfigStatus.SyncStatus          = (flag ? SyncStatus.Synchronized : SyncStatus.NotSynchronized);
                edgeConfigStatus.SynchronizedObjects = num2;
            }
            catch (ExDirectoryException)
            {
                edgeConfigStatus.SyncStatus = SyncStatus.DirectoryError;
            }
            return(edgeConfigStatus);
        }
Ejemplo n.º 3
0
        private void ValidateExchangeServerRecipient(EdgeConfigStatus status)
        {
            Connection connection = null;

            if (status.SyncStatus != SyncStatus.NotSynchronized && status.SyncStatus != SyncStatus.Synchronized)
            {
                return;
            }
            try
            {
                ADObjectId adobjectId    = null;
                string     absolutePath  = "CN=" + ADMicrosoftExchangeRecipient.DefaultName + ",CN=Transport Settings," + this.orgConfigRoot;
                string     absolutePath2 = "CN=" + ADMicrosoftExchangeRecipient.DefaultName + ",CN=Transport Settings," + base.AdamRootPath;
                connection = new Connection(this.DataSession.GetReadConnection(null, ref adobjectId));
                ExSearchResultEntry exSearchResultEntry  = connection.ReadObjectEntry(absolutePath, Schema.ExchangeRecipient.PayloadAttributes);
                ExSearchResultEntry exSearchResultEntry2 = base.CurrentEdgeConnection.EdgeConnection.ReadObjectEntry(absolutePath2, Schema.ExchangeRecipient.PayloadAttributes);
                if (exSearchResultEntry != exSearchResultEntry2)
                {
                    if (exSearchResultEntry == null)
                    {
                        status.SyncStatus = SyncStatus.NotSynchronized;
                        if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.EdgeOnlyObjects.Count))
                        {
                            status.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry2.DistinguishedName));
                        }
                    }
                    else if (exSearchResultEntry2 == null)
                    {
                        status.SyncStatus = SyncStatus.NotSynchronized;
                        if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.OrgOnlyObjects.Count))
                        {
                            status.OrgOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName));
                        }
                    }
                    else
                    {
                        if (!base.CompareAttributes(exSearchResultEntry2, exSearchResultEntry, Schema.ExchangeRecipient.PayloadAttributes))
                        {
                            status.SyncStatus = SyncStatus.NotSynchronized;
                            if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.ConflictObjects.Count))
                            {
                                status.ConflictObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName));
                            }
                        }
                        if (status.SyncStatus == SyncStatus.Synchronized)
                        {
                            status.SynchronizedObjects += 1U;
                        }
                    }
                }
            }
            catch (ExDirectoryException)
            {
                status.SyncStatus = SyncStatus.DirectoryError;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                    connection = null;
                }
            }
        }