private static bool TrySelectProtocolConnectionSettings(ServiceType serviceType, PopImapAdConfiguration popImapConfiguration, bool useExternalPopImapSettings, Dictionary <ServiceType, ProtocolConnectionSettings> e15Protocols) { IList <ProtocolConnectionSettings> list = useExternalPopImapSettings ? popImapConfiguration.ExternalConnectionSettings : popImapConfiguration.InternalConnectionSettings; ProtocolConnectionSettings protocolConnectionSettings = null; foreach (ProtocolConnectionSettings protocolConnectionSettings2 in list) { if (protocolConnectionSettings == null) { protocolConnectionSettings = protocolConnectionSettings2; } else { if (protocolConnectionSettings2.EncryptionType == EncryptionType.SSL) { protocolConnectionSettings = protocolConnectionSettings2; break; } if (protocolConnectionSettings2.EncryptionType == EncryptionType.TLS && protocolConnectionSettings.EncryptionType == null) { protocolConnectionSettings = protocolConnectionSettings2; } } } if (protocolConnectionSettings != null) { e15Protocols[serviceType] = protocolConnectionSettings; ExTraceGlobals.CafeTracer.TraceDebug <string, ProtocolConnectionSettings>(0L, "[GlobalServiceUrls.TrySelectProtocolConnectionSettings] Found {0} settings {1}", typeof(ServiceType).Name, protocolConnectionSettings); return(true); } return(false); }
public static ProtocolConnectionSettings GetInternalProtocolSettingsForLocalServer <ProtocolServiceType>() where ProtocolServiceType : Service { ServiceType key = GlobalServiceUrls.ConvertProtocolServiceType <ProtocolServiceType>(); GlobalServiceUrls.DiscoverProtocolSettingsIfNeeded(); ProtocolConnectionSettings result = null; GlobalServiceUrls.E15ProtocolsInternal.TryGetValue(key, out result); return(result); }
// Token: 0x0600081A RID: 2074 RVA: 0x0003BF24 File Offset: 0x0003A124 private string GetAccessProxyAddress() { string result = string.Empty; CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(OrganizationId.ForestWideOrgId, CachedOrganizationConfiguration.ConfigurationTypes.All); Organization configuration = instance.OrganizationConfiguration.Configuration; ProtocolConnectionSettings sipaccessService = configuration.SIPAccessService; if (sipaccessService != null) { result = sipaccessService.Hostname.ToString(); } return(result); }
private static int GetConnectionPreferenceRanking(ProtocolConnectionSettings settings) { EncryptionType valueOrDefault = settings.EncryptionType.GetValueOrDefault(); EncryptionType?encryptionType; if (encryptionType != null) { switch (valueOrDefault) { case EncryptionType.SSL: return(0); case EncryptionType.TLS: return(1); } } return(2); }
// Token: 0x06001A13 RID: 6675 RVA: 0x00097268 File Offset: 0x00095468 private void AddEndpointSettings(ServiceType type, bool isExternal) { if (type == ServiceType.Pop3) { ProtocolConnectionSettings frontEndPop3SettingsForLocalServer = FrontEndLocator.GetFrontEndPop3SettingsForLocalServer(); this.AddConnectionSettingDetails(type, isExternal, frontEndPop3SettingsForLocalServer); return; } if (type == ServiceType.Imap4) { ProtocolConnectionSettings frontEndImap4SettingsForLocalServer = FrontEndLocator.GetFrontEndImap4SettingsForLocalServer(); this.AddConnectionSettingDetails(type, isExternal, frontEndImap4SettingsForLocalServer); return; } if (type == ServiceType.Smtp) { ProtocolConnectionSettings frontEndSmtpSettingsForLocalServer = FrontEndLocator.GetFrontEndSmtpSettingsForLocalServer(); this.AddConnectionSettingDetails(type, isExternal, frontEndSmtpSettingsForLocalServer); } }
private static ProtocolConnectionSettings GetPreferredConnectionSettingDetail(ICollection <ProtocolConnectionSettings> collection) { ProtocolConnectionSettings protocolConnectionSettings = null; foreach (ProtocolConnectionSettings protocolConnectionSettings2 in collection) { if (protocolConnectionSettings2 != null) { if (GetCASMailbox.GetConnectionPreferenceRanking(protocolConnectionSettings2) == 0) { protocolConnectionSettings = protocolConnectionSettings2; break; } if (protocolConnectionSettings == null || GetCASMailbox.GetConnectionPreferenceRanking(protocolConnectionSettings2) < GetCASMailbox.GetConnectionPreferenceRanking(protocolConnectionSettings)) { protocolConnectionSettings = protocolConnectionSettings2; } } } return(protocolConnectionSettings); }
private static bool TryDiscoverProtocolSettings(bool useLocalSite) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.NonCacheSessionFactory.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 413, "TryDiscoverProtocolSettings", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\GlobalServiceUrls.cs"); ADObjectId id = LocalSiteCache.LocalSite.Id; QueryFilter queryFilter = new ComparisonFilter(useLocalSite ? ComparisonOperator.Equal : ComparisonOperator.NotEqual, ServerSchema.ServerSite, id); QueryFilter additionalFilter = new AndFilter(new QueryFilter[] { queryFilter, GlobalServiceUrls.CafeFilter }); ADPagedReader <MiniServer> adpagedReader = topologyConfigurationSession.FindAllServersWithVersionNumber(Server.E15MinVersion, additionalFilter, null); adpagedReader.PageSize = 20; int num = 0; string text = string.Empty; bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; Dictionary <ServiceType, ProtocolConnectionSettings> dictionary = null; Dictionary <ServiceType, ProtocolConnectionSettings> dictionary2 = null; foreach (MiniServer miniServer in adpagedReader) { text = miniServer.Name; ADEmailTransport[] source = topologyConfigurationSession.Find <ADEmailTransport>(miniServer.Id, QueryScope.SubTree, null, null, 1000, null); IEnumerable <ADEmailTransport> enumerable = from adEmailTransport in source where adEmailTransport is Pop3AdConfiguration select adEmailTransport; IEnumerable <ADEmailTransport> enumerable2 = from adEmailTransport in source where adEmailTransport is Imap4AdConfiguration select adEmailTransport; ReceiveConnector[] array = topologyConfigurationSession.Find <ReceiveConnector>(miniServer.Id, QueryScope.SubTree, GlobalServiceUrls.ReceiveConnectorFilter, null, 1000, null); ExTraceGlobals.CafeTracer.TraceDebug <int, string, int>(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Attempt {0}: Processing {1} and its {2} connectors", num, text, array.Length); dictionary = new Dictionary <ServiceType, ProtocolConnectionSettings>(3); dictionary2 = new Dictionary <ServiceType, ProtocolConnectionSettings>(3); flag = false; flag2 = false; flag3 = false; flag4 = false; flag5 = false; foreach (ADEmailTransport ademailTransport in enumerable) { Pop3AdConfiguration popImapConfiguration = (Pop3AdConfiguration)ademailTransport; if (!flag && GlobalServiceUrls.TrySelectProtocolConnectionSettings(ServiceType.Pop3, popImapConfiguration, true, dictionary)) { flag = true; } if (!flag2 && GlobalServiceUrls.TrySelectProtocolConnectionSettings(ServiceType.Pop3, popImapConfiguration, false, dictionary2)) { flag2 = true; } if (flag && flag2) { break; } } foreach (ADEmailTransport ademailTransport2 in enumerable2) { Imap4AdConfiguration popImapConfiguration2 = (Imap4AdConfiguration)ademailTransport2; if (!flag3 && GlobalServiceUrls.TrySelectProtocolConnectionSettings(ServiceType.Imap4, popImapConfiguration2, true, dictionary)) { flag3 = true; } if (!flag4 && GlobalServiceUrls.TrySelectProtocolConnectionSettings(ServiceType.Imap4, popImapConfiguration2, false, dictionary2)) { flag4 = true; } if (flag3 && flag4) { break; } } ProtocolConnectionSettings protocolConnectionSettings = null; foreach (ReceiveConnector receiveConnector in array) { Hostname hostname; if (!Hostname.TryParse(receiveConnector.ServiceDiscoveryFqdn, out hostname) && !Hostname.TryParse(receiveConnector.Fqdn, out hostname)) { ExTraceGlobals.CafeTracer.TraceWarning <ADObjectId>(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Smtp connector {0} has no valid ServiceDiscoveryFqdn or Fqdn", receiveConnector.Id); } else { int port = receiveConnector.Bindings[0].Port; bool flag6 = (receiveConnector.AuthMechanism & (AuthMechanisms.Tls | AuthMechanisms.BasicAuthRequireTLS)) != AuthMechanisms.None; if (flag6) { protocolConnectionSettings = new ProtocolConnectionSettings(hostname, port, new EncryptionType?(EncryptionType.TLS)); break; } if (protocolConnectionSettings == null) { protocolConnectionSettings = new ProtocolConnectionSettings(hostname, port, null); } } } if (protocolConnectionSettings != null) { dictionary[ServiceType.Smtp] = protocolConnectionSettings; dictionary2[ServiceType.Smtp] = protocolConnectionSettings; flag5 = true; } if (flag2 && flag4 && flag5) { ExTraceGlobals.CafeTracer.TraceDebug(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Successfully found all needed internal protocol settings"); GlobalServiceUrls.E15ProtocolsInternal = dictionary2; } if (flag && flag3 && flag5) { ExTraceGlobals.CafeTracer.TraceDebug(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Successfully found all needed external protocol settings"); GlobalServiceUrls.E15Protocols = dictionary; return(true); } if (++num >= 20) { ExTraceGlobals.CafeTracer.TraceError(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Retry limit reached, Could not find all of the needed Protocol configurations."); break; } } if (!GlobalServiceUrls.IsDatacenter) { if (dictionary != null && dictionary.Count > 0) { ExTraceGlobals.CafeTracer.TraceWarning(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Found only some of the needed external protocol settings. Missing:" + (flag ? string.Empty : "POP3,") + (flag3 ? string.Empty : "IMAP4,") + (flag5 ? string.Empty : "SMTP")); GlobalServiceUrls.E15Protocols = dictionary; } if (dictionary2 != null && dictionary2.Count > 0) { ExTraceGlobals.CafeTracer.TraceWarning(0L, "[GlobalServiceUrls.TryDiscoverProtocolSettings] Found only some of the needed internal protocol settings. Missing:" + (flag2 ? string.Empty : "POP3,") + (flag4 ? string.Empty : "IMAP4,") + (flag5 ? string.Empty : "SMTP")); GlobalServiceUrls.E15ProtocolsInternal = dictionary2; } } if (!useLocalSite && GlobalServiceUrls.E15Protocols == null) { if (GlobalServiceUrls.IsDatacenter) { throw new ProtocolConfigurationMissingException(text, "ExternalSettings"); } GlobalServiceUrls.E15Protocols = new Dictionary <ServiceType, ProtocolConnectionSettings>(0); } if (!useLocalSite && GlobalServiceUrls.E15ProtocolsInternal == null) { if (GlobalServiceUrls.IsDatacenter) { throw new ProtocolConfigurationMissingException(text, "InternalSettings"); } GlobalServiceUrls.E15ProtocolsInternal = new Dictionary <ServiceType, ProtocolConnectionSettings>(0); } return(false); }
// Token: 0x06001A14 RID: 6676 RVA: 0x000972B4 File Offset: 0x000954B4 private void AddConnectionSettingDetails(ServiceType settingType, bool isExternal, ProtocolConnectionSettings settings) { if (this.details == null || settings == null) { return; } switch (settingType) { case ServiceType.Pop3: this.details.Add(new AboutDetails.Detail(isExternal ? 888502160 : -2138999282, null)); break; case ServiceType.Imap4: this.details.Add(new AboutDetails.Detail(isExternal ? 463879924 : -839607014, null)); break; case ServiceType.Smtp: this.details.Add(new AboutDetails.Detail(isExternal ? -969708705 : -487637651, null)); break; } this.details.Add(new AboutDetails.Detail(1167375722, settings.Hostname.ToString(), true)); this.details.Add(new AboutDetails.Detail(-2021978869, settings.Port.ToString(), true)); if (settings.EncryptionType != null) { this.details.Add(new AboutDetails.Detail(-505859442, settings.EncryptionType.ToString(), true)); } }
// Token: 0x0600095A RID: 2394 RVA: 0x0001FACC File Offset: 0x0001DCCC private VdirConfiguration(ITopologyConfigurationSession session, ADOwaVirtualDirectory owaVirtualDirectory) { AttachmentPolicyLevel treatUnknownTypeAs = ConfigurationBase.AttachmentActionToPolicyLevel(owaVirtualDirectory.ActionForUnknownFileAndMIMETypes); AttachmentPolicy attachmentPolicy = new AttachmentPolicy(owaVirtualDirectory.BlockedFileTypes.ToArray(), owaVirtualDirectory.BlockedMimeTypes.ToArray(), owaVirtualDirectory.ForceSaveFileTypes.ToArray(), owaVirtualDirectory.ForceSaveMimeTypes.ToArray(), owaVirtualDirectory.AllowedFileTypes.ToArray(), owaVirtualDirectory.AllowedMimeTypes.ToArray(), treatUnknownTypeAs, owaVirtualDirectory.DirectFileAccessOnPublicComputersEnabled.Value, owaVirtualDirectory.DirectFileAccessOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWacViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWacViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WacViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WacViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.WebReadyFileTypes.ToArray(), owaVirtualDirectory.WebReadyMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedFileTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingForAllSupportedTypes.Value); this.formsAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Fba); this.windowsAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.WindowsIntegrated); this.basicAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Basic); this.digestAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Digest); base.AttachmentPolicy = attachmentPolicy; this.filterWebBeaconsAndHtmlForms = VdirConfiguration.GetWebBeaconFilterLevel(owaVirtualDirectory.FilterWebBeaconsAndHtmlForms); base.DefaultTheme = owaVirtualDirectory.DefaultTheme; int segmentationBits = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet]; int segmentationBits2 = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet2]; base.SegmentationFlags = ConfigurationBase.SetSegmentationFlags(segmentationBits, segmentationBits2); if (owaVirtualDirectory.OutboundCharset != null) { base.OutboundCharset = owaVirtualDirectory.OutboundCharset.Value; } if (owaVirtualDirectory.UseGB18030 != null && owaVirtualDirectory.UseGB18030.Value) { base.UseGB18030 = true; } else { base.UseGB18030 = false; } if (owaVirtualDirectory.UseISO885915 != null && owaVirtualDirectory.UseISO885915.Value) { base.UseISO885915 = true; } else { base.UseISO885915 = false; } base.InstantMessagingEnabled = (owaVirtualDirectory.InstantMessagingEnabled ?? false); base.InstantMessagingType = (owaVirtualDirectory.InstantMessagingType ?? InstantMessagingTypeOptions.None); base.InstantMessagingEnabled &= (base.InstantMessagingType == InstantMessagingTypeOptions.Ocs); if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled) { this.instantMessagingServerName = owaVirtualDirectory.InstantMessagingServerName; this.instantMessagingCertificateThumbprint = owaVirtualDirectory.InstantMessagingCertificateThumbprint; if (string.IsNullOrWhiteSpace(this.instantMessagingServerName)) { Organization orgContainer = session.GetOrgContainer(); ProtocolConnectionSettings sipaccessService = orgContainer.SIPAccessService; if (sipaccessService == null) { this.instantMessagingServerName = string.Empty; } else { this.instantMessagingServerName = sipaccessService.Hostname.ToString(); } } } base.AllowOfflineOn = owaVirtualDirectory.AllowOfflineOn; base.PlacesEnabled = (owaVirtualDirectory.PlacesEnabled != null && owaVirtualDirectory.PlacesEnabled.Value); base.WeatherEnabled = (owaVirtualDirectory.WeatherEnabled != null && owaVirtualDirectory.WeatherEnabled.Value); base.AllowCopyContactsToDeviceAddressBook = (owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook != null && owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook.Value); base.RecoverDeletedItemsEnabled = (owaVirtualDirectory.RecoverDeletedItemsEnabled != null && owaVirtualDirectory.RecoverDeletedItemsEnabled.Value); this.expirationTime = DateTime.UtcNow + VdirConfiguration.expirationPeriod; }
private void AddConnectionSettingDetails(CASMailbox mailbox, ServiceType settingType, bool isExternal, ProtocolConnectionSettings settings) { if (settings == null) { return; } string text; if (settings.EncryptionType != null) { text = Strings.ProtocolSettingsFullDetails(settings.Hostname.ToString(), settings.Port.ToString(), settings.EncryptionType.ToString()); } else { text = Strings.ProtocolSettingsDetails(settings.Hostname.ToString(), settings.Port.ToString()); } switch (settingType) { case ServiceType.Pop3: if (isExternal) { mailbox.ExternalPopSettings = text; return; } mailbox.InternalPopSettings = text; return; case ServiceType.Imap4: if (isExternal) { mailbox.ExternalImapSettings = text; return; } mailbox.InternalImapSettings = text; return; case ServiceType.Smtp: if (isExternal) { mailbox.ExternalSmtpSettings = text; return; } mailbox.InternalSmtpSettings = text; return; default: throw new InvalidOperationException("Invalid settingType: " + settingType); } }