private void Application_Start(object sender, EventArgs e) { EcpEventLogConstants.Tuple_EcpStarted.LogEvent(new object[] { AppDomain.CurrentDomain.FriendlyName }); if (!Util.IsDataCenter) { ServiceDiscovery.ADNotificationScope = ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology; } Globals.InitializeMultiPerfCounterInstance("ECP"); foreach (ExPerformanceCounter exPerformanceCounter in EcpPerfCounters.AllCounters) { exPerformanceCounter.RawValue = 0L; } using (Process currentProcess = Process.GetCurrentProcess()) { EcpPerfCounters.PID.RawValue = (long)currentProcess.Id; } ADSession.DisableAdminTopologyMode(); BaseSprite.IsDataCenter = Util.IsMicrosoftHostedOnly; BaseSprite.GetSpriteImageSrc = new GetSpriteImageSrcDelegate(Util.GetSpriteImageSrc); VirtualDirectoryConfiguration.EcpVirtualDirectoryAnonymousAuthenticationEnabled = VirtualDirectoryConfiguration.GetEcpAnonymousAuthenticationStatus(); string identification = ConfigurationManager.AppSettings["ProvisioningCacheIdentification"]; ProvisioningCache.InitializeAppRegistrySettings(identification); this.InvokeExtendedApplicationStart(sender, e); ScriptManager.ScriptResourceMapping.AddDefinition("MicrosoftAjax.js", new ScriptResourceDefinition { Path = ThemeResource.ScriptPath + "microsoftajax.js", DebugPath = ThemeResource.ScriptPath + "microsoftajax.debug.js" }); }
// Token: 0x0600115D RID: 4445 RVA: 0x00042A40 File Offset: 0x00040C40 private static void InitializeApplicationCaches() { HttpContext httpContext = HttpContext.Current; HttpApplication applicationInstance = httpContext.ApplicationInstance; ADIdentityInformationCache.Initialize(4000); applicationInstance.Application["WS_APPWideMailboxCacheKey"] = new AppWideStoreSessionCache(); applicationInstance.Application["WS_AcceptedDomainCacheKey"] = new AcceptedDomainCache(); int maxThreadCount = 10 * Environment.ProcessorCount; Global.BudgetType = BudgetType.Owa; Global.BulkOperationBudgetType = BudgetType.OwaBulkOperation; Global.NonInteractiveOperationBudgetType = BudgetType.OwaNonInteractiveOperation; Global.NonInteractiveThrottlingEnabled = true; Global.NonInteractiveOperationMethods = OwaApplication.owaNonInteractiveMethodNames; UserWorkloadManager.Initialize(maxThreadCount, 500, 500, TimeSpan.FromMinutes(5.0), null); applicationInstance.Application["WS_WorkloadManagerKey"] = UserWorkloadManager.Singleton; OwaEventRegistry owaEventRegistry = new OwaEventRegistry(); owaEventRegistry.RegisterHandler(typeof(PendingRequestEventHandler)); applicationInstance.Application["OwaEventRegistry"] = owaEventRegistry; string identification = ConfigurationManager.AppSettings["ProvisioningCacheIdentification"]; ProvisioningCache.InitializeAppRegistrySettings(identification); }
protected Activity(ProvisioningCache cache) { if (cache == null) { throw new ArgumentNullException("cache"); } this.ProvisioningCache = cache; this.GotStopSignalFromTestCode = false; }
// Token: 0x0600612C RID: 24876 RVA: 0x0014A847 File Offset: 0x00148A47 public DiagnosticActivity(ProvisioningCache cache, string pipeName) : base(cache) { if (string.IsNullOrWhiteSpace(pipeName)) { throw new ArgumentException("pipeName is null or empty."); } this.pipeName = pipeName; this.serverStream = new NamedPipeServerStream(pipeName, PipeDirection.InOut, 4); }
public static void SetProvisioningCache(Task task, ProvisioningCache cache) { using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, "ProvisioningLayerLatency", "SetProvisioningCache", LoggerHelper.CmdletPerfMonitors)) { if (!ProvisioningLayer.Disabled && task.IsProvisioningLayerAvailable) { for (int i = 0; i < task.ProvisioningHandlers.Length; i++) { task.ProvisioningHandlers[i].ProvisioningCache = cache; } } } }
// Token: 0x06006157 RID: 24919 RVA: 0x0014B5F0 File Offset: 0x001497F0 public InvalidationRecvActivity(ProvisioningCache cache, uint recvPort) : base(cache) { if (!CacheBroadcaster.IsIPv6Only()) { this.msgReceiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); this.msgReceiveEndPoint = new IPEndPoint(IPAddress.Any, (int)recvPort); } else { this.msgReceiveSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp); this.msgReceiveEndPoint = new IPEndPoint(IPAddress.IPv6Any, (int)recvPort); this.msgReceiveSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.AddMembership, new IPv6MulticastOption(IPAddress.Parse("ff02::1"))); } this.msgReceiveSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); this.msgReceiveSocket.Bind(this.msgReceiveEndPoint); this.recvBuffer = new byte[5000]; }
protected virtual void EnableProvisioningCache() { if (this.anchorContext.Settings.UseHeatMapProvisioning) { this.logger.Log(MigrationEventType.Verbose, "Initializing local forest heat map cache.", new object[0]); this.anchorContext.InitializeForestHeatMap(); } else { this.logger.Log(MigrationEventType.Verbose, "Enabling provisioning cache.", new object[0]); ProvisioningCache.InitializeAppRegistrySettings("Powershell"); } if (this.anchorContext.Settings.BuildLocalCacheOnStartup) { this.anchorContext.InitializeLocalServerHeatMap(); } }
// Token: 0x060012F6 RID: 4854 RVA: 0x0003E1EC File Offset: 0x0003C3EC internal static IEnumerable <SmtpDomainWithSubdomains> GetAcceptedDomains(OrganizationId organizationId, OrganizationId executingOrganizationId) { ProvisioningCache provisioningCache = ProvisioningCache.Instance; return(provisioningCache.TryAddAndGetOrganizationData <IEnumerable <SmtpDomainWithSubdomains> >(CannedProvisioningCacheKeys.OrganizationAcceptedDomains, organizationId, delegate() { ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), organizationId, executingOrganizationId, false); IConfigurationSession cfgSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 245, "GetAcceptedDomains", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\AuthZPluginHelper.cs"); ADObjectId rootId = organizationId.ConfigurationUnit ?? provisioningCache.TryAddAndGetGlobalData <ADObjectId>(CannedProvisioningCacheKeys.FirstOrgContainerId, () => cfgSession.GetOrgContainerId()); QueryFilter filter = new NotFilter(new BitMaskAndFilter(AcceptedDomainSchema.AcceptedDomainFlags, 1UL)); ADPagedReader <AcceptedDomain> adpagedReader = cfgSession.FindPaged <AcceptedDomain>(rootId, QueryScope.SubTree, filter, null, 0); AcceptedDomain[] array = adpagedReader.ReadAllPages(); SmtpDomainWithSubdomains[] array2 = new SmtpDomainWithSubdomains[array.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = array[i].DomainName; } return array2; })); }
private static void InitializeAuthZPluginForRemotePS(string connectionUri) { if (AppSettings.RpsAuthZAppSettingsInitialized) { return; } AppSettings.InitializeManualLoadAppSettings(connectionUri, delegate { IAppSettings appSettings = AppSettings.Current; if (appSettings.SupportedEMCVersions == null) { ((ManualLoadAppSettings)appSettings).SupportedEMCVersions = SupportedVersionList.DefaultVersionString; } AppDomain.CurrentDomain.SetupInformation.ConfigurationFile = appSettings.ConfigurationFilePath; ConfigFiles.SetConfigSource(appSettings.VDirName, appSettings.WebSiteName); FailFastUserCache.FailFastEnabled = appSettings.FailFastEnabled; Uri uri = new Uri(connectionUri, UriKind.Absolute); ExchangeAuthorizationPlugin.InitializeExchangeAuthZPluginPerfCounter(appSettings.VDirName, uri.Port); ProvisioningCache.InitializeAppRegistrySettings(appSettings.ProvisioningCacheIdentification); ThreadPool.SetMaxThreads(appSettings.ThreadPoolMaxThreads, appSettings.ThreadPoolMaxCompletionPorts); ThrottlingPerfCounterWrapper.Initialize(BudgetType.PowerShell); ADSession.DisableAdminTopologyMode(); }); }
public static void ValidateExternalEmailAddress(ADContact contact, IConfigurationSession configurationSession, Task.ErrorLoggerDelegate writeError, ProvisioningCache provisioningCache) { if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.ValidateExternalEmailAddressInAcceptedDomain.Enabled) { SmtpProxyAddress smtpProxyAddress = contact.ExternalEmailAddress as SmtpProxyAddress; if (smtpProxyAddress == null) { writeError(new RecipientTaskException(Strings.ErrorExternalEmailAddressNotSmtpAddress((contact.ExternalEmailAddress == null) ? "$null" : contact.ExternalEmailAddress.ToString())), ExchangeErrorCategory.Client, contact.Identity); return; } if (RecipientTaskHelper.SMTPAddressCheckWithAcceptedDomain(configurationSession, contact.OrganizationId, writeError, provisioningCache)) { string domain = new SmtpAddress(smtpProxyAddress.SmtpAddress).Domain; if (RecipientTaskHelper.IsAcceptedDomain(configurationSession, contact.OrganizationId, domain, provisioningCache)) { writeError(new RecipientTaskException(Strings.ErrorIsAcceptedDomain(domain)), ExchangeErrorCategory.Client, null); } } contact.EmailAddressPolicyEnabled = false; if (contact.PrimarySmtpAddress == SmtpAddress.Empty) { contact.PrimarySmtpAddress = new SmtpAddress(smtpProxyAddress.SmtpAddress); } } }
// Token: 0x0600615A RID: 24922 RVA: 0x0014B6B8 File Offset: 0x001498B8 protected override void InternalExecute() { EndPoint endPoint = this.msgReceiveEndPoint; Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCStartingToReceiveInvalidationMessage, this.msgReceiveEndPoint.Address.ToString(), new object[] { this.msgReceiveEndPoint.Port }); while (!base.GotStopSignalFromTestCode) { try { Array.Clear(this.recvBuffer, 0, this.recvBuffer.Length); int bufLen = this.msgReceiveSocket.ReceiveFrom(this.recvBuffer, ref endPoint); Exception ex = null; InvalidationMessage invalidationMessage = InvalidationMessage.TryFromReceivedData(this.recvBuffer, bufLen, out ex); if (ex != null) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCInvalidInvalidationMessageReceived, this.msgReceiveEndPoint.Address.ToString(), new object[] { this.msgReceiveEndPoint.Port, ex.Message }); } else { if (invalidationMessage.IsCacheClearMessage) { base.ProvisioningCache.Reset(); } else if (invalidationMessage.IsGlobal) { base.ProvisioningCache.RemoveGlobalDatas(invalidationMessage.CacheKeys); } else { base.ProvisioningCache.RemoveOrganizationDatas(invalidationMessage.OrganizationId, invalidationMessage.CacheKeys); } ProvisioningCache.IncrementReceivedInvalidationMsgNum(); } } catch (SocketException ex2) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveInvalidationMessage, this.msgReceiveEndPoint.Address.ToString(), new object[] { this.msgReceiveEndPoint.Port, ex2.Message }); } catch (ObjectDisposedException ex3) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveInvalidationMessage, this.msgReceiveEndPoint.Address.ToString(), new object[] { this.msgReceiveEndPoint.Port, ex3.Message }); throw ex3; } catch (SecurityException ex4) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_PCFailedToReceiveInvalidationMessage, this.msgReceiveEndPoint.Address.ToString(), new object[] { this.msgReceiveEndPoint.Port, ex4.Message }); throw ex4; } } }
public static SiteMailboxAddressesTemplate GetSiteMailboxAddressesTemplate(IConfigurationSession cfgSession, ProvisioningCache provisioningCache) { if (cfgSession == null) { throw new ArgumentNullException("cfgSession"); } if (provisioningCache == null) { throw new ArgumentNullException("provisioningCache"); } OrganizationId orgId = cfgSession.GetOrgContainer().OrganizationId; return(provisioningCache.TryAddAndGetOrganizationData <SiteMailboxAddressesTemplate>(CannedProvisioningCacheKeys.OrganizationSiteMailboxAddressesTemplate, orgId, delegate() { ADObjectId rootId = orgId.ConfigurationUnit ?? provisioningCache.TryAddAndGetGlobalData <ADObjectId>(CannedProvisioningCacheKeys.FirstOrgContainerId, () => cfgSession.GetOrgContainerId()); MultiValuedProperty <SmtpDomain> multiValuedProperty = null; ADPagedReader <OnPremisesOrganization> adpagedReader = cfgSession.FindPaged <OnPremisesOrganization>(rootId, QueryScope.SubTree, null, null, 0); using (IEnumerator <OnPremisesOrganization> enumerator = adpagedReader.GetEnumerator()) { if (enumerator.MoveNext()) { OnPremisesOrganization onPremisesOrganization = enumerator.Current; multiValuedProperty = onPremisesOrganization.HybridDomains; } } QueryFilter filter = new NotFilter(new BitMaskAndFilter(AcceptedDomainSchema.AcceptedDomainFlags, 1UL)); ADPagedReader <AcceptedDomain> adpagedReader2 = cfgSession.FindPaged <AcceptedDomain>(rootId, QueryScope.SubTree, filter, new SortBy(ADObjectSchema.Name, SortOrder.Ascending), 0); bool flag = false; string text = string.Empty; string text2 = string.Empty; string text3 = string.Empty; foreach (AcceptedDomain acceptedDomain in adpagedReader2) { if (acceptedDomain.AuthenticationType != AuthenticationType.Federated && (string.IsNullOrEmpty(text) || acceptedDomain.Default)) { text = acceptedDomain.DomainName.Domain; } if ((multiValuedProperty == null || multiValuedProperty.Count == 0 || multiValuedProperty.Contains(acceptedDomain.DomainName.SmtpDomain)) && (string.IsNullOrEmpty(text2) || acceptedDomain.Default)) { text2 = acceptedDomain.DomainName.Domain; } if (acceptedDomain.IsCoexistenceDomain && string.IsNullOrEmpty(text3)) { text3 = acceptedDomain.DomainName.Domain; } flag = (flag || acceptedDomain.Default); if (flag && !string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text3)) { break; } } SiteMailboxAddressesTemplate siteMailboxAddressesTemplate = new SiteMailboxAddressesTemplate(); siteMailboxAddressesTemplate.UserPrincipalNameDomain = text; if (!string.IsNullOrEmpty(text2)) { siteMailboxAddressesTemplate.AddressTemplates.Add(new SmtpProxyAddressTemplate(string.Format("@{0}", text2), true)); if (!string.IsNullOrEmpty(text3) && !string.Equals(text2, text3, StringComparison.OrdinalIgnoreCase)) { siteMailboxAddressesTemplate.AddressTemplates.Add(new SmtpProxyAddressTemplate(string.Format("@{0}", text3), false)); } } if (!siteMailboxAddressesTemplate.IsValid) { throw new ErrorSiteMailboxCannotLoadAddressTemplateException(); } return siteMailboxAddressesTemplate; })); }
internal static void ValidateUserParameters(ADUser userObject, IConfigurationSession configSession, IRecipientSession globalCatalogSession, Task.TaskVerboseLoggingDelegate verboseLogger, Task.ErrorLoggerDelegate errorLogger, ExchangeErrorCategory errorLoggerCategory, bool shouldCheckAcceptedDomains, ProvisioningCache provisioningCache) { if (userObject.IsModified(UserSchema.ResetPasswordOnNextLogon) && userObject.ResetPasswordOnNextLogon && (userObject.UserAccountControl & UserAccountControlFlags.DoNotExpirePassword) != UserAccountControlFlags.None) { errorLogger(new TaskInvalidOperationException(Strings.ErrorUserCannotChangePasswordAtNextLogon(userObject.Identity.ToString())), errorLoggerCategory, userObject.Identity); } if (userObject.IsModified(UserSchema.UserPrincipalName)) { if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.ValidateExternalEmailAddressInAcceptedDomain.Enabled&& shouldCheckAcceptedDomains) { RecipientTaskHelper.ValidateInAcceptedDomain(configSession, userObject.OrganizationId, RecipientTaskHelper.GetDomainPartOfUserPrincalName(userObject.UserPrincipalName), errorLogger, provisioningCache); } RecipientTaskHelper.IsUserPrincipalNameUnique(globalCatalogSession, userObject, userObject.UserPrincipalName, verboseLogger, errorLogger, errorLoggerCategory); } if (userObject.IsModified(UserSchema.SamAccountName)) { RecipientTaskHelper.IsSamAccountNameUnique(globalCatalogSession, userObject, userObject.SamAccountName, verboseLogger, errorLogger, errorLoggerCategory); } }
// Token: 0x0600615C RID: 24924 RVA: 0x0014B941 File Offset: 0x00149B41 public ObsoluteOrgCleanerActivity(ProvisioningCache cache) : base(cache) { }
private void Application_Start(object sender, EventArgs e) { this.InitializePerformanceCounter(); this.InitDirectoryTopologyMode(); ProvisioningCache.InitializeAppRegistrySettings(((IAppSettings)PswsAppSettings.Instance).ProvisioningCacheIdentification); }