internal static bool TryCreateImap4Service(MiniEmailTransport emailTransport, TopologyServerInfo serverInfo, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod, out Service service) { if (emailTransport.IsImap4) { service = new Imap4Service(serverInfo, clientAccessType, authenticationMethod, emailTransport); return(true); } service = null; return(false); }
internal static Service CreateEmailTransportService(MiniEmailTransport emailTransport, TopologyServerInfo serverInfo, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod) { foreach (ServiceTypeInfo serviceTypeInfo in ServiceTypeInfo.serviceTypeInfos) { ServiceTypeInfo.TryCreateEmailTransportServiceDelegate tryCreateEmailTransportServiceDelegate = serviceTypeInfo.tryCreateServiceDelegate as ServiceTypeInfo.TryCreateEmailTransportServiceDelegate; Service result; if (tryCreateEmailTransportServiceDelegate != null && tryCreateEmailTransportServiceDelegate(emailTransport, serverInfo, clientAccessType, authenticationMethod, out result)) { return(result); } } throw new InvalidOperationException(ServerStrings.ExInvalidServiceType); }
private Imap4Service(TopologyServerInfo serverInfo, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod, MiniEmailTransport emailTransport) : base(serverInfo, ServiceType.Imap4, clientAccessType, authenticationMethod, emailTransport) { }
private void AddEmailTransportServiceToDictionaries(string localServerFqdn, Dictionary <ServiceType, List <Service> > serviceLists, TopologyServerInfo serverInfo, MiniEmailTransport emailTransport, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod) { Service service = ServiceTypeInfo.CreateEmailTransportService(emailTransport, serverInfo, clientAccessType, authenticationMethod); ServiceTopology.AddServiceToServiceListDictionary(serviceLists, service); ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug <Service, string, Site>((long)this.GetHashCode(), "ServiceTopology::AddServiceToDictionaries. Found Service. Service = {0}. ServerFqdn = {1}. Site = {2}.", service, serverInfo.ServerFullyQualifiedDomainName, serverInfo.Site); }
internal ServiceTopology(ExchangeTopology topology, [CallerFilePath] string callerFilePath = null, [CallerMemberName] string memberName = null, [CallerLineNumber] int callerFileLine = 0) { ServiceTopologyLog.Instance.Append(callerFilePath, memberName, callerFileLine); ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug((long)this.GetHashCode(), "ServiceTopology::Constructor. Creating a ServiceTopology object..."); if (topology.LocalServer == null) { ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug((long)this.GetHashCode(), "ServiceTopology::ServiceTopology.ctor. Cannot find the local server from ExchangeTopology. topology.LocalServer == null."); throw new ServerNotFoundException(ServerStrings.ExServerNotFound("localhost"), "localhost"); } string fqdn = topology.LocalServer.Fqdn; this.discoveryStarted = topology.DiscoveryStarted; Dictionary <string, TopologyServerInfo> dictionary = new Dictionary <string, TopologyServerInfo>(topology.AllTopologyServers.Count, StringComparer.OrdinalIgnoreCase); Dictionary <string, Site> dictionary2 = new Dictionary <string, Site>(topology.AllTopologyServers.Count, StringComparer.OrdinalIgnoreCase); List <string> list = new List <string>(); Dictionary <Site, List <TopologyServerInfo> > dictionary3 = new Dictionary <Site, List <TopologyServerInfo> >(topology.AllTopologySites.Count); ServiceTopology.All all = new ServiceTopology.All(topology); foreach (TopologyServer topologyServer in topology.AllTopologyServers) { if (topologyServer.TopologySite != null) { if (!dictionary2.ContainsKey(topologyServer.Fqdn)) { TopologyServerInfo topologyServerInfo = TopologyServerInfo.Get(topologyServer, all); Site site = topologyServerInfo.Site; dictionary.Add(topologyServer.Fqdn, topologyServerInfo); dictionary2.Add(topologyServer.Fqdn, site); List <TopologyServerInfo> list2; if (!dictionary3.TryGetValue(site, out list2)) { list2 = new List <TopologyServerInfo>(); dictionary3.Add(site, list2); } list2.Add(topologyServerInfo); ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug <string, string, Site>((long)this.GetHashCode(), "ServiceTopology::Constructor. Found Server in topology. ServerDn = {0}. Server Fqdn = {1}. Site = {2}.", topologyServer.DistinguishedName, topologyServer.Fqdn, site); } else { string arg = string.Empty; foreach (KeyValuePair <string, TopologyServerInfo> keyValuePair in all.Servers) { if (keyValuePair.Value.ServerFullyQualifiedDomainName.Equals(topologyServer.Fqdn)) { arg = keyValuePair.Key; break; } } ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "ServiceTopology::Constructor. There are two servers with the same fqdn in the topology. The second server was ignored. Fqdn = {0}. Server1Dn = {1}. Server2Dn = {2}.", topologyServer.Fqdn, arg, topologyServer.DistinguishedName); } } else { ExTraceGlobals.ServiceDiscoveryTracer.TraceDebug <string>((long)this.GetHashCode(), "ServiceTopology::Constructor. Found a Server in the topology without a defined Site. Server = {0}.", topologyServer.DistinguishedName); if (fqdn.Equals(topologyServer.Fqdn)) { throw new ServerNotInSiteException(ServerStrings.ExCurrentServerNotInSite(fqdn), fqdn); } if (!list.Contains(topologyServer.Fqdn)) { list.Add(topologyServer.Fqdn); } } } Dictionary <ServiceType, List <Service> > serviceLists = new Dictionary <ServiceType, List <Service> >(); Dictionary <ServiceType, List <Service> > serviceLists2 = new Dictionary <ServiceType, List <Service> >(); ReadOnlyCollection <MiniVirtualDirectory> allVirtualDirectories = topology.AllVirtualDirectories; if (allVirtualDirectories != null) { foreach (MiniVirtualDirectory miniVirtualDirectory in allVirtualDirectories) { TopologyServerInfo serverInfo; if (all.Servers.TryGetValue(miniVirtualDirectory.Server.DistinguishedName, out serverInfo)) { if (HttpService.IsFrontEndRole(miniVirtualDirectory, serverInfo)) { this.AddHttpServiceToDictionaries(fqdn, serviceLists2, serverInfo, miniVirtualDirectory, ClientAccessType.Unknown, null, AuthenticationMethod.None); } if (miniVirtualDirectory.InternalUrl != null) { AuthenticationMethod authenticationMethod = ServiceTopology.GetAuthenticationMethod(miniVirtualDirectory[MiniVirtualDirectorySchema.InternalAuthenticationMethodFlags]); this.AddHttpServiceToDictionaries(fqdn, serviceLists, serverInfo, miniVirtualDirectory, ClientAccessType.Internal, miniVirtualDirectory.InternalUrl, authenticationMethod); } if (miniVirtualDirectory.IsWebServices && miniVirtualDirectory.InternalNLBBypassUrl != null) { AuthenticationMethod authenticationMethod2 = ServiceTopology.GetAuthenticationMethod(miniVirtualDirectory[MiniVirtualDirectorySchema.InternalAuthenticationMethodFlags]); this.AddHttpServiceToDictionaries(fqdn, serviceLists, serverInfo, miniVirtualDirectory, ClientAccessType.InternalNLBBypass, miniVirtualDirectory.InternalNLBBypassUrl, authenticationMethod2); } if (miniVirtualDirectory.ExternalUrl != null) { AuthenticationMethod authenticationMethod3 = ServiceTopology.GetAuthenticationMethod(miniVirtualDirectory[MiniVirtualDirectorySchema.ExternalAuthenticationMethodFlags]); this.AddHttpServiceToDictionaries(fqdn, serviceLists, serverInfo, miniVirtualDirectory, ClientAccessType.External, miniVirtualDirectory.ExternalUrl, authenticationMethod3); } } } } ReadOnlyCollection <MiniEmailTransport> allEmailTransports = topology.AllEmailTransports; if (allEmailTransports != null) { foreach (MiniEmailTransport miniEmailTransport in allEmailTransports) { if (miniEmailTransport.IsPop3 || miniEmailTransport.IsImap4) { MiniEmailTransport miniEmailTransport2 = miniEmailTransport; TopologyServerInfo topologyServerInfo2; if (all.Servers.TryGetValue(miniEmailTransport2.Server.DistinguishedName, out topologyServerInfo2)) { bool flag = miniEmailTransport2.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010); ServerVersion serverVersion = new ServerVersion(topologyServerInfo2.VersionNumber); flag |= (VariantConfiguration.InvariantNoFlightingSnapshot.DataStorage.CheckR3Coexistence.Enabled && serverVersion.Major == Server.Exchange2009MajorVersion && serverVersion.Build == 482); if ((miniEmailTransport2.InternalConnectionSettings != null && miniEmailTransport2.InternalConnectionSettings.Count > 0) || flag) { this.AddEmailTransportServiceToDictionaries(fqdn, serviceLists, topologyServerInfo2, miniEmailTransport2, ClientAccessType.Internal, AuthenticationMethod.None); } if ((miniEmailTransport2.ExternalConnectionSettings != null && miniEmailTransport2.ExternalConnectionSettings.Count > 0) || flag) { this.AddEmailTransportServiceToDictionaries(fqdn, serviceLists, topologyServerInfo2, miniEmailTransport2, ClientAccessType.External, AuthenticationMethod.None); } } } } } ReadOnlyCollection <MiniReceiveConnector> allSmtpReceiveConnectors = topology.AllSmtpReceiveConnectors; if (allSmtpReceiveConnectors != null) { foreach (MiniReceiveConnector miniReceiveConnector in allSmtpReceiveConnectors) { TopologyServerInfo serverInfo2; if (all.Servers.TryGetValue(miniReceiveConnector.Server.DistinguishedName, out serverInfo2)) { this.AddSmtpServiceToDictionaries(fqdn, serviceLists, serverInfo2, miniReceiveConnector, ClientAccessType.External); this.AddSmtpServiceToDictionaries(fqdn, serviceLists, serverInfo2, miniReceiveConnector, ClientAccessType.Internal); } } } Dictionary <string, Site> dictionary4 = new Dictionary <string, Site>(topology.AllTopologySites.Count, StringComparer.OrdinalIgnoreCase); foreach (TopologySite topologySite in topology.AllTopologySites) { dictionary4[topologySite.DistinguishedName] = Site.Get(topologySite, all); } this.localServerInfo = TopologyServerInfo.Get(topology.LocalServer, all); this.serverToSiteDictionary = dictionary2; this.services = serviceLists; this.cafeServices = serviceLists2; this.serversWithoutSite = list; this.siteToServersDictionary = dictionary3; this.siteDictionary = dictionary4; this.serverFqdnDictionary = dictionary; this.connectionCostCalculator = new ConnectionCostCalculator(topology.AllTopologySites.Count); }
// Token: 0x060003B6 RID: 950 RVA: 0x0001573C File Offset: 0x0001393C internal static ADObject CreateAndInitializeConfigObject <TConfigObject>(ADPropertyBag propertyBag, ADRawEntry dummyObject, IDirectorySession directorySession) where TConfigObject : IConfigurable, new() { ArgumentValidator.ThrowIfNull("propertyBag", propertyBag); MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADObjectSchema.ObjectClass]; ADObject adobject; if (dummyObject is MiniTopologyServer) { adobject = new MiniTopologyServer(); } else if (dummyObject is MiniVirtualDirectory) { adobject = new MiniVirtualDirectory(); } else if (dummyObject is MiniEmailTransport) { adobject = new MiniEmailTransport(); } else if (dummyObject is MiniReceiveConnector) { adobject = new MiniReceiveConnector(); } else if (multiValuedProperty.Contains(ADWebServicesVirtualDirectory.MostDerivedClass)) { adobject = new ADWebServicesVirtualDirectory(); } else if (multiValuedProperty.Contains(ADE12UMVirtualDirectory.MostDerivedClass)) { adobject = new ADE12UMVirtualDirectory(); } else if (multiValuedProperty.Contains("msExchMobileVirtualDirectory")) { adobject = new ADMobileVirtualDirectory(); } else if (multiValuedProperty.Contains(ADOwaVirtualDirectory.MostDerivedClass)) { adobject = new ADOwaVirtualDirectory(); } else if (multiValuedProperty.Contains(ADRpcHttpVirtualDirectory.MostDerivedClass)) { adobject = new ADRpcHttpVirtualDirectory(); } else if (multiValuedProperty.Contains(ADMapiVirtualDirectory.MostDerivedClass)) { adobject = new ADMapiVirtualDirectory(); } else if (multiValuedProperty.Contains(ADAvailabilityForeignConnectorVirtualDirectory.MostDerivedClass)) { adobject = new ADAvailabilityForeignConnectorVirtualDirectory(); } else if (multiValuedProperty.Contains(ADOabVirtualDirectory.MostDerivedClass)) { adobject = new ADOabVirtualDirectory(); } else if (multiValuedProperty.Contains(ADEcpVirtualDirectory.MostDerivedClass)) { adobject = new ADEcpVirtualDirectory(); } else if (multiValuedProperty.Contains(Pop3AdConfiguration.MostDerivedClass)) { adobject = new Pop3AdConfiguration(); } else if (multiValuedProperty.Contains(Imap4AdConfiguration.MostDerivedClass)) { adobject = new Imap4AdConfiguration(); } else if (multiValuedProperty.Contains("mailGateway")) { if (multiValuedProperty.Contains(SmtpSendConnectorConfig.MostDerivedClass)) { adobject = new SmtpSendConnectorConfig(); } else if (multiValuedProperty.Contains(DeliveryAgentConnector.MostDerivedClass)) { adobject = new DeliveryAgentConnector(); } else if (propertyBag.Contains(ForeignConnectorSchema.DropDirectory)) { adobject = new ForeignConnector(); } else { adobject = new LegacyGatewayConnector(); } } else if (multiValuedProperty.Contains("msExchEdgeSyncEhfConnector")) { adobject = new EdgeSyncEhfConnector(); } else { if (!multiValuedProperty.Contains("msExchEdgeSyncMservConnector")) { return(ADObjectFactory.CreateAndInitializeObject <TConfigObject>(propertyBag, directorySession)); } adobject = new EdgeSyncMservConnector(); } adobject.m_Session = directorySession; adobject.propertyBag = propertyBag; adobject.Initialize(); adobject.ResetChangeTracking(true); if (directorySession != null) { adobject.SetIsReadOnly(directorySession.ReadOnly); } return(adobject); }
internal static bool TryCreateEmailTransportService(MiniEmailTransport emailTransport, TopologyServerInfo serverInfo, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod, out Service service) { service = new EmailTransportService(serverInfo, ServiceType.Invalid, clientAccessType, authenticationMethod, emailTransport); return(true); }
internal EmailTransportService(TopologyServerInfo serverInfo, ServiceType serviceType, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod, MiniEmailTransport emailTransport) : base(serverInfo, serviceType, clientAccessType, authenticationMethod) { this.PopImapTransport = (emailTransport.IsPop3 || emailTransport.IsImap4); if (this.PopImapTransport) { this.UnencryptedOrTLSPort = EmailTransportService.GetPort(emailTransport.UnencryptedOrTLSBindings); this.SSLPort = EmailTransportService.GetPort(emailTransport.SSLBindings); this.InternalConnectionSettings = Service.ConvertToReadOnlyCollection <ProtocolConnectionSettings>(emailTransport.InternalConnectionSettings); this.ExternalConnectionSettings = Service.ConvertToReadOnlyCollection <ProtocolConnectionSettings>(emailTransport.ExternalConnectionSettings); this.LoginType = emailTransport.LoginType; } }