private static bool TryGetConfigUnit(ExSearchResultEntry entry, EdgeSyncDiag diagSession, out string configUnitDN)
        {
            configUnitDN = null;
            DirectoryAttribute attribute = entry.GetAttribute("msExchCU");

            if (attribute != null)
            {
                configUnitDN = (string)attribute[0];
            }
            if (string.IsNullOrEmpty(configUnitDN))
            {
                diagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "ConfigUnit root DN is not specified for accepted domain with DN <{0}>; ignoring the object", new object[]
                {
                    entry.DistinguishedName
                });
                return(false);
            }
            if (ExSearchResultEntry.IsDeletedDN(configUnitDN))
            {
                diagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "ConfigUnit root DN <{0}> for accepted domain with DN <{1}> indicates that tenant organization is deleted; ignoring the object", new object[]
                {
                    configUnitDN,
                    entry.DistinguishedName
                });
                configUnitDN = null;
                return(false);
            }
            return(true);
        }
        private bool TryGetEhfMailFlowPartner(ExSearchResultEntry entry, out EhfDomainSynchronizerVersion2.EhfMailFlowPartner ehfMailFlowPartner)
        {
            ehfMailFlowPartner = null;
            DirectoryAttribute attribute = entry.GetAttribute("msExchTransportResellerSettingsLink");

            if (attribute == null)
            {
                base.DiagSession.Tracer.TraceDebug(0L, "MailFlowPartner attribute not found");
                return(false);
            }
            string text = (string)attribute[0];

            if (string.IsNullOrEmpty(text))
            {
                base.DiagSession.Tracer.TraceDebug(0L, "MailFlowPartner attribute is null or empty");
                return(false);
            }
            if (ExSearchResultEntry.IsDeletedDN(text))
            {
                base.DiagSession.LogAndTraceError("Found a reference to deleted partner <{0}> from domain <{1}>. Ignoring the partner.", new object[]
                {
                    text,
                    entry.DistinguishedName
                });
                return(false);
            }
            if (this.ehfMailFlowPartnersCache == null)
            {
                base.DiagSession.Tracer.TraceDebug(0L, "Creating MailFlowPartner cache.");
                this.ehfMailFlowPartnersCache = new Dictionary <string, EhfDomainSynchronizerVersion2.EhfMailFlowPartner>();
            }
            if (!this.ehfMailFlowPartnersCache.TryGetValue(text, out ehfMailFlowPartner))
            {
                base.DiagSession.Tracer.TraceDebug(0L, "MailFlowPartner entry not found in cache. Loading from AD");
                if (this.TryGetEhfMailFlowPartnerFromAD(text, out ehfMailFlowPartner))
                {
                    this.ehfMailFlowPartnersCache.Add(text, ehfMailFlowPartner);
                }
                else
                {
                    base.DiagSession.LogAndTraceError("Could not find mailflow partner <{0}>, referenced from domain <{1}>", new object[]
                    {
                        text,
                        entry.DistinguishedName
                    });
                }
            }
            else
            {
                base.DiagSession.Tracer.TraceDebug(0L, "MailFlowPartner entry found in cache");
            }
            return(ehfMailFlowPartner != null);
        }
예제 #3
0
 private bool TryGetTenantOrgUnitDNForChange(ExSearchResultEntry entry, out string tenantOU, out bool isOrgChange, ref bool fullLoadComplete)
 {
     tenantOU    = null;
     isOrgChange = false;
     if (entry.IsDeleted)
     {
         if (!entry.Attributes.ContainsKey("msExchOURoot"))
         {
             if (!EhfSynchronizer.LoadFullEntry(entry, EhfAdminAccountSynchronizer.AdminSyncAllAttributes, base.EhfConnection))
             {
                 return(false);
             }
             fullLoadComplete = true;
         }
         else
         {
             base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Delete change <{0}> already contains OURoot. Using that.", new object[]
             {
                 entry.DistinguishedName
             });
         }
         if (!EhfAdminAccountSynchronizer.TryGetOrganizationUnit(entry, base.DiagSession, out tenantOU))
         {
             base.DiagSession.LogAndTraceError("Could not extract OURoot attribute from deleted change entry <{0}>. Ignoring the change.", new object[]
             {
                 entry.DistinguishedName
             });
             return(false);
         }
         base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Extracted the OURoot <{0}> for the deleted change from the change entry <{1}>", new object[]
         {
             tenantOU,
             entry.DistinguishedName
         });
     }
     else if (!EhfAdminAccountSynchronizer.TryGetOURootFromDN(entry.DistinguishedName, out tenantOU, out isOrgChange))
     {
         base.DiagSession.LogAndTraceError("Failed to get the OrganizationUnit Root from the DN of <{0}>. Ignoring the item.", new object[]
         {
             entry.DistinguishedName
         });
         return(false);
     }
     if (string.IsNullOrEmpty(tenantOU))
     {
         base.DiagSession.LogAndTraceError("OrganizationUnit DN for <{0}> is null or emtpy. Ignoring the item.", new object[]
         {
             entry.DistinguishedName
         });
         return(false);
     }
     if (ExSearchResultEntry.IsDeletedDN(tenantOU))
     {
         base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "Change <{0}> is for a deleted organization <{1}>. Ignoring the item", new object[]
         {
             entry.DistinguishedName,
             tenantOU
         });
         return(false);
     }
     return(true);
 }
예제 #4
0
        private static bool IsEventForDeletedOrganization(ExSearchResultEntry entry, EdgeSyncDiag diagSession)
        {
            string distinguishedName;

            return(EhfAdminAccountSynchronizer.TryGetOrganizationUnit(entry, diagSession, out distinguishedName) && ExSearchResultEntry.IsDeletedDN(distinguishedName));
        }