internal static IEnumerable <QueryFilter> ConflictingDomainFilters(AcceptedDomain domain, bool ignoreStars) { if (domain != null && domain.DomainName != null) { if (domain.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain)) { yield return(new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Guid, domain.Guid)); } else { if (ignoreStars || domain.DomainName.IncludeSubDomains) { yield return(new AndFilter(new QueryFilter[] { new TextFilter(AcceptedDomainSchema.DomainName, '.' + domain.DomainName.Domain, MatchOptions.Suffix, MatchFlags.IgnoreCase), new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Guid, domain.Guid) })); } string s = domain.DomainName.SmtpDomain.Domain; for (int i = s.IndexOf('.', 0); i != -1; i = s.IndexOf('.', i + 1)) { yield return(new TextFilter(AcceptedDomainSchema.DomainName, ignoreStars ? s.Substring(i + 1) : ("*" + s.Substring(i)), MatchOptions.FullString, MatchFlags.IgnoreCase)); } yield return(new TextFilter(AcceptedDomainSchema.DomainName, "*", MatchOptions.FullString, MatchFlags.IgnoreCase)); } } yield break; }
public FederatedOrganizationId GetFederatedOrganizationIdByDomainName(string domainName) { AcceptedDomain acceptedDomainByDomainName = this.GetAcceptedDomainByDomainName(domainName); if (acceptedDomainByDomainName == null || acceptedDomainByDomainName.FederatedOrganizationLink == null) { return(null); } return(this.Read <FederatedOrganizationId>(acceptedDomainByDomainName.FederatedOrganizationLink)); }
private static string[] FilterAcceptedDomains(PSObject[] acceptedDomainObjects, Func <Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain, bool> domainFilter) { List <string> list = new List <string>(); foreach (PSObject psobject in acceptedDomainObjects) { Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain acceptedDomain = (Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)psobject.BaseObject; if (!acceptedDomain.DomainName.IsStar) { string domain = acceptedDomain.DomainName.Domain; if (!list.Contains(domain, StringComparer.OrdinalIgnoreCase) && domainFilter(acceptedDomain)) { list.Add(domain); } } } return(list.ToArray()); }
private DomainCacheValue QueryFromADAndAddToCache(SmtpDomainWithSubdomains smtpDomainWithSubdomains, OrganizationId orgId) { ADSessionSettings sessionSettings = null; if (Datacenter.IsMultiTenancyEnabled()) { try { if (orgId != null) { sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId); } else { sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(smtpDomainWithSubdomains.ToString()); } goto IL_51; } catch (CannotResolveTenantNameException) { sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); goto IL_51; } } sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); IL_51: IConfigurationSession configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 159, "QueryFromADAndAddToCache", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\DomainCache.cs"); DomainCacheValue domainCacheValue = null; ADNotificationAdapter.TryRunADOperation(delegate() { AcceptedDomain acceptedDomainByDomainName = configSession.GetAcceptedDomainByDomainName(smtpDomainWithSubdomains.ToString()); if (acceptedDomainByDomainName != null) { domainCacheValue = new DomainCacheValue(); domainCacheValue.OrganizationId = acceptedDomainByDomainName.OrganizationId; domainCacheValue.LiveIdInstanceType = acceptedDomainByDomainName.LiveIdInstanceType; domainCacheValue.AuthenticationType = acceptedDomainByDomainName.AuthenticationType; this.InsertLimitedSliding(acceptedDomainByDomainName.DomainName, domainCacheValue, DomainCache.slidingTimeOut.Value, DomainCache.absoluteTimeOut.Value, null); } }); return(domainCacheValue); }
public AcceptedDomainEntry(AcceptedDomain domain, OrganizationId organizationId) { this.name = domain.Name; this.domain = domain.DomainName; this.DomainType = domain.DomainType; this.MatchSubDomains = domain.MatchSubDomains; this.IsDefault = domain.Default; this.AddressBookEnabled = domain.AddressBookEnabled; this.Guid = domain.Guid; this.syncedToPerimeterAsGuidDomain = (domain.PerimeterDuplicateDetected || domain.OutboundOnly); if (domain.CatchAllRecipientID != null) { this.catchAllRecipientID = domain.CatchAllRecipientID.ObjectGuid; } if (organizationId == null || organizationId == OrganizationId.ForestWideOrgId || organizationId.ConfigurationUnit == null) { this.tenantId = Guid.Empty; return; } this.tenantId = organizationId.ConfigurationUnit.ObjectGuid; }
private DomainProperties QueryFromAD(SmtpDomainWithSubdomains smtpDomainWithSubdomains) { ADSessionSettings adsessionSettings = null; if (Datacenter.IsMultiTenancyEnabled()) { try { adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(smtpDomainWithSubdomains.ToString()); goto IL_5C; } catch (CannotResolveTenantNameException arg) { DomainPropertyCache.Tracer.TraceError <SmtpDomainWithSubdomains, CannotResolveTenantNameException>((long)this.GetHashCode(), "Failed to resolve tenant with domain {0}. Error: {1}", smtpDomainWithSubdomains, arg); adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); goto IL_5C; } } adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); IL_5C: DomainPropertyCache.Tracer.TraceDebug <SmtpDomainWithSubdomains, OrganizationId>((long)this.GetHashCode(), "The OrganizationId for domain {0} is {1}.", smtpDomainWithSubdomains, adsessionSettings.CurrentOrganizationId); IConfigurationSession configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, adsessionSettings, 219, "QueryFromAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\DomainPropertyCache.cs"); DomainProperties domainProperty = null; ADNotificationAdapter.TryRunADOperation(delegate() { AcceptedDomain acceptedDomainByDomainName = configSession.GetAcceptedDomainByDomainName(smtpDomainWithSubdomains.ToString()); if (acceptedDomainByDomainName != null) { domainProperty = new DomainProperties(smtpDomainWithSubdomains.SmtpDomain); domainProperty.OrganizationId = acceptedDomainByDomainName.OrganizationId; domainProperty.LiveIdInstanceType = acceptedDomainByDomainName.LiveIdInstanceType; DomainPropertyCache.Tracer.TraceDebug <AcceptedDomain, OrganizationId>((long)this.GetHashCode(), "Accepted domain {0} in organization {1}", acceptedDomainByDomainName, acceptedDomainByDomainName.OrganizationId); } }); return(domainProperty); }
// Token: 0x0600002B RID: 43 RVA: 0x000035DC File Offset: 0x000017DC internal override void OnStart() { lock (ModeratedDLApplication.SyncRoot) { if (ModeratedDLApplication.refCount == 0) { MessageTrackingLog.Start("MSGTRKMA"); Server server = null; ADNotificationAdapter.TryRunADOperation(delegate() { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 144, "OnStart", "f:\\15.00.1497\\sources\\dev\\Approval\\src\\Applications\\ModeratedDLApplication\\ModeratedDLApplication.cs"); this.serverConfigNotificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(topologyConfigurationSession.GetOrgContainerId(), new ADNotificationCallback(ModeratedDLApplication.ServerChangeCallback)); server = topologyConfigurationSession.ReadLocalServer(); Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain acceptedDomain = topologyConfigurationSession.GetDefaultAcceptedDomain(); if (acceptedDomain != null && acceptedDomain.DomainName.SmtpDomain != null) { this.defaultAcceptedDomain = acceptedDomain.DomainName.SmtpDomain.Domain; } }); if (server == null) { ModeratedDLApplication.diag.TraceError((long)this.GetHashCode(), "Cannot read local server for message tracking"); } MessageTrackingLog.Configure(server); } ModeratedDLApplication.refCount++; } base.OnStart(); }
public static void GetAutoDiscoverAcceptDomainPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow row = dataTable.Rows[0]; object dataObject = store.GetDataObject("AcceptedDomainWholeObject"); if (dataObject != null && dataObject is IEnumerable) { foreach (object obj in (dataObject as IEnumerable)) { Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain acceptedDomain = obj as Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain; if (acceptedDomain != null) { CertificateHelper.GetOneItem(row, "AutoExternalDomain", "AutoDiscover." + acceptedDomain.DomainName.Domain); } } } }
private static bool IsSelectableDomain(Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain domain, List <string> optionList) { SmtpDomain smtpDomain = domain.DomainName.SmtpDomain; return(domain.DomainType != AcceptedDomainType.ExternalRelay && smtpDomain != null && (optionList == null || optionList.Contains(smtpDomain.ToString(), StringComparer.OrdinalIgnoreCase))); }