コード例 #1
0
 // Token: 0x06000011 RID: 17 RVA: 0x00002394 File Offset: 0x00000594
 protected override void OnStartInternal(string[] args)
 {
     if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Transport.ADExceptionHandling.Enabled)
     {
         FrontEndTransportService.ConstructComponentLoadTree();
     }
     else
     {
         ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(new ADOperation(FrontEndTransportService.ConstructComponentLoadTree), 3);
         if (!adoperationResult.Succeeded)
         {
             FrontEndTransportService.eventLog.LogEvent(TransportEventLogConstants.Tuple_FrontendTransportServiceInitializationFailure, null, new object[]
             {
                 adoperationResult.Exception.ToString()
             });
             base.GracefullyAbortStartup();
         }
     }
     this.components.Start(new Components.StopServiceHandler(FrontEndTransportService.OnStopServiceBecauseOfFailure), false, false, true, true);
     this.components.Continue();
 }
コード例 #2
0
 protected override void RenderMenuItems(TextWriter output)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     output.Write("<div class=\"alertPopupShading\"></div>");
     output.Write("<div id=\"divHelpMnuTopBorderLeft\" class=\"alertDialogTopBorder\"></div>");
     output.Write("<div id=\"divHelpMnuTopBorderRight\" class=\"alertDialogTopBorder\"></div>");
     base.RenderMenuItem(output, 1454393937, "openHelp", "mnuItmTxtItm");
     if (PerformanceConsole.IsPerformanceConsoleEnabled(base.UserContext))
     {
         base.RenderMenuItem(output, -824025661, "openPerfConsole", "mnuItmTxtItm");
     }
     base.RenderMenuItem(output, 539783673, "openAbout", "mnuItmTxtItm");
     if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.RenderPrivacyStatement.Enabled)
     {
         base.RenderMenuItem(output, -43540613, "divHelpCMPrcy", "openPrivacyStatement", "mnuItmTxtItm");
         base.RenderMenuItem(output, -2128835577, "divHelpCMCommunity", "openCommunitySite", "mnuItmTxtItm");
     }
 }
コード例 #3
0
 // Token: 0x06000729 RID: 1833 RVA: 0x0001A9EC File Offset: 0x00018BEC
 private void OnPostAuthenticateRequest(object source, EventArgs args)
 {
     ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] Entering");
     if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.RpsClientAccessRulesEnabled.Enabled&& HttpRuntime.AppDomainAppVirtualPath.IndexOf("/PowerShell", StringComparison.OrdinalIgnoreCase) == 0)
     {
         IClientAccessRulesAuthorizer clientAccessRulesAuthorizer = new RemotePowershellClientAccessRulesAuthorizer();
         HttpContext httpContext = HttpContext.Current;
         if (httpContext.Request.IsAuthenticated)
         {
             ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] Request is already authenticated.");
             OrganizationId userOrganization = clientAccessRulesAuthorizer.GetUserOrganization();
             if (userOrganization == null)
             {
                 ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] orgId = null.");
                 return;
             }
             UserToken userToken = HttpContext.Current.CurrentUserToken();
             bool      flag      = ClientAccessRulesUtils.ShouldBlockConnection(userOrganization, ClientAccessRulesUtils.GetUsernameFromContext(httpContext), clientAccessRulesAuthorizer.Protocol, ClientAccessRulesUtils.GetRemoteEndPointFromContext(httpContext), ClientAccessRulesHttpModule.GetAuthenticationTypeFromContext(httpContext), userToken.Recipient, delegate(ClientAccessRulesEvaluationContext context)
             {
                 clientAccessRulesAuthorizer.SafeAppendGenericInfo(httpContext, ClientAccessRulesConstants.ClientAccessRuleName, context.CurrentRule.Name);
             }, delegate(double latency)
             {
                 if (latency > 50.0)
                 {
                     clientAccessRulesAuthorizer.SafeAppendGenericInfo(httpContext, ClientAccessRulesConstants.ClientAccessRulesLatency, latency.ToString());
                     ExTraceGlobals.HttpModuleTracer.TraceDebug <string, string>((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] {0} = {1}.", ClientAccessRulesConstants.ClientAccessRulesLatency, latency.ToString());
                 }
             });
             if (flag)
             {
                 ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] ClientAccessRules' evaluation for the organization blocks the connection");
                 clientAccessRulesAuthorizer.ResponseToError(httpContext);
                 httpContext.ApplicationInstance.CompleteRequest();
             }
         }
         ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] Exit");
         return;
     }
     ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[ClientAccessRulesHttpModule::OnPostAuthenticateRequest] Exit");
 }
コード例 #4
0
 protected override void PrepareRecipientObject(TDataObject recipient)
 {
     TaskLogger.LogEnter();
     base.PrepareRecipientObject(recipient);
     if (base.Fields.Contains(ADRecipientSchema.ModeratedBy))
     {
         MultiValuedProperty <ModeratorIDParameter> multiValuedProperty = (MultiValuedProperty <ModeratorIDParameter>)base.Fields[ADRecipientSchema.ModeratedBy];
         int num = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled ? 10 : 25;
         if (multiValuedProperty != null && multiValuedProperty.Count > num)
         {
             base.WriteError(new RecipientTaskException(Strings.ErrorTooManyModerators(num)), ExchangeErrorCategory.Client, null);
         }
         recipient.ModeratedBy = RecipientTaskHelper.GetModeratedByAdObjectIdFromParameterID(base.TenantGlobalCatalogSession, this.ModeratedBy, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), recipient, new Task.ErrorLoggerDelegate(base.WriteError));
     }
     if (base.Fields.IsModified(ADRecipientSchema.ArbitrationMailbox))
     {
         if (this.ArbitrationMailbox != null)
         {
             ADRecipient adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.ArbitrationMailbox, (IRecipientSession)base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(this.ArbitrationMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(this.ArbitrationMailbox.ToString())), ExchangeErrorCategory.Client);
             if (adrecipient.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox)
             {
                 base.WriteError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxType(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity);
             }
             if (MultiValuedPropertyBase.IsNullOrEmpty((ADMultiValuedProperty <ADObjectId>)adrecipient[ADUserSchema.ApprovalApplications]))
             {
                 base.WriteError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxTypeForModerationAndAutogroup(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity);
             }
             if (!recipient.OrganizationId.Equals(adrecipient.OrganizationId))
             {
                 base.WriteError(new RecipientTaskException(Strings.ErrorArbitrationMbxCrossOrg(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity);
             }
             recipient.ArbitrationMailbox = adrecipient.Id;
         }
         else
         {
             recipient.ArbitrationMailbox = null;
         }
     }
     TaskLogger.LogExit();
 }
コード例 #5
0
            public bool IsFeatureEnabled(IExchangePrincipal mailboxOwner, IRecipientSession recipientSession)
            {
                if (this.disableThumbnailGeneration)
                {
                    return(false);
                }
                if (this.bypassFlightForThumbnailGeneration)
                {
                    return(true);
                }
                if (mailboxOwner == null || recipientSession == null)
                {
                    return(false);
                }
                ADUser aduser = null;

                try
                {
                    aduser = (DirectoryHelper.ReadADRecipient(mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.IsArchive, recipientSession) as ADUser);
                }
                catch (DataValidationException)
                {
                    return(false);
                }
                catch (DataSourceOperationException)
                {
                    return(false);
                }
                catch (DataSourceTransientException)
                {
                    return(false);
                }
                if (aduser == null)
                {
                    return(false);
                }
                VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(aduser.GetContext(null), null, null);

                return(snapshot.DataStorage.StorageAttachmentImageAnalysis.Enabled);
            }
コード例 #6
0
        // Token: 0x060014F0 RID: 5360 RVA: 0x000780C8 File Offset: 0x000762C8
        private bool IsExchangeDatacenter()
        {
            bool result;

            try
            {
                result = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).MailboxAssistants.SharePointSignalStoreInDatacenter.Enabled;
            }
            catch (Exception ex)
            {
                if (this.diagnosticsSession != null)
                {
                    string operation = string.Format(CultureInfo.InvariantCulture, "Failed to determine Exchange DataCenter status: {0}", new object[]
                    {
                        ex
                    });
                    this.diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, operation, new object[0]);
                }
                result = false;
            }
            return(result);
        }
        // Token: 0x06000E05 RID: 3589 RVA: 0x00054BA4 File Offset: 0x00052DA4
        protected override void LoadSettings()
        {
            this.SafeTraceDebug(0L, "Start loading {0} settings.", new object[]
            {
                this.LogTypeName
            });
            ICalendarRepairLoggerSettings calendarRepairAssistantLogging = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).MailboxAssistants.CalendarRepairAssistantLogging;

            base.Enabled          = calendarRepairAssistantLogging.InsightLogEnabled;
            base.DirectoryPath    = Path.Combine(ExchangeSetupContext.LoggingPath, calendarRepairAssistantLogging.InsightLogDirectoryName);
            base.MaxAge           = calendarRepairAssistantLogging.InsightLogFileAgeInDays;
            base.MaxDirectorySize = new ByteQuantifiedSize(calendarRepairAssistantLogging.InsightLogDirectorySizeLimit);
            base.MaxFileSize      = new ByteQuantifiedSize(calendarRepairAssistantLogging.InsightLogFileSize);
            base.CacheSize        = new ByteQuantifiedSize(calendarRepairAssistantLogging.InsightLogCacheSize);
            base.FlushInterval    = calendarRepairAssistantLogging.InsightLogFlushIntervalInSeconds;
            base.FlushToDisk      = true;
            this.LoadCustomSettings();
            this.SafeTraceDebug(0L, "{0} settings are loaded successfully.", new object[]
            {
                this.LogTypeName
            });
        }
コード例 #8
0
        // Token: 0x06000F32 RID: 3890 RVA: 0x0005AC20 File Offset: 0x00058E20
        private bool IsFlightingEnabled(out string reason)
        {
            reason = null;
            ADRecipient adrecipient = DirectoryHelper.ReadADRecipient(this.publicFolderSession.MailboxOwner.MailboxInfo.MailboxGuid, this.publicFolderSession.MailboxOwner.MailboxInfo.IsArchive, this.publicFolderSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));

            if (adrecipient == null)
            {
                reason = string.Format("ReadADRecipient returned null. MailboxOwner: {0} Organization: {1} LegacyExchangeDN: {2}", this.publicFolderSession.MailboxOwner.ToString(), this.publicFolderSession.MailboxOwner.MailboxInfo.OrganizationId.ToString(), this.publicFolderSession.MailboxOwner.LegacyDn);
                return(false);
            }
            ADUser aduser = adrecipient as ADUser;

            if (aduser == null)
            {
                reason = string.Format("Failed to cast ADRecipient to ADUser. MailboxOwner: {0} Organization: {1} LegacyExchangeDN: {2} OU: {3}", new object[]
                {
                    this.publicFolderSession.MailboxOwner.ToString(),
                    this.publicFolderSession.MailboxOwner.MailboxInfo.OrganizationId.ToString(),
                    adrecipient.LegacyExchangeDN,
                    adrecipient.OU
                });
                return(false);
            }
            VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(aduser.GetContext(null), null, null);
            bool enabled = snapshot.MailboxAssistants.PublicFolderSplit.Enabled;

            if (!enabled)
            {
                reason = string.Format("ADUser not flighted, as per the VariantConfigurationSnapshot. MailboxOwner: {0} Organization: {1} LegacyExchangeDN: {2} OU: {3}", new object[]
                {
                    this.publicFolderSession.MailboxOwner.ToString(),
                    this.publicFolderSession.MailboxOwner.MailboxInfo.OrganizationId.ToString(),
                    aduser.LegacyExchangeDN,
                    aduser.OU
                });
            }
            return(enabled);
        }
コード例 #9
0
        private static bool ShouldBlockConnection(HttpContext httpContext, OwaIdentity logonIdentity)
        {
            if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaServer.OwaClientAccessRulesEnabled.Enabled)
            {
                return(false);
            }
            RequestDetailsLogger logger = OwaApplication.GetRequestDetailsLogger;
            Action <ClientAccessRulesEvaluationContext> blockLoggerDelegate = delegate(ClientAccessRulesEvaluationContext context)
            {
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(logger, ClientAccessRulesConstants.ClientAccessRuleName, context.CurrentRule.Name);
            };
            Action <double> latencyLoggerDelegate = delegate(double latency)
            {
                if (latency > 50.0)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(logger, ClientAccessRulesConstants.ClientAccessRulesLatency, latency);
                }
            };
            OWAMiniRecipient owaminiRecipient          = logonIdentity.GetOWAMiniRecipient();
            string           usernameFromIdInformation = ClientAccessRulesUtils.GetUsernameFromIdInformation(owaminiRecipient.WindowsLiveID, owaminiRecipient.MasterAccountSid, owaminiRecipient.Sid, owaminiRecipient.ObjectId);

            return(ClientAccessRulesUtils.ShouldBlockConnection(logonIdentity.UserOrganizationId, usernameFromIdInformation, ClientAccessProtocol.OutlookWebApp, ClientAccessRulesUtils.GetRemoteEndPointFromContext(httpContext), httpContext.Request.IsAuthenticatedByAdfs() ? ClientAccessAuthenticationMethod.AdfsAuthentication : ClientAccessAuthenticationMethod.BasicAuthentication, owaminiRecipient, blockLoggerDelegate, latencyLoggerDelegate));
        }
コード例 #10
0
 protected override IConfigurable PrepareDataObject()
 {
     TaskLogger.LogEnter();
     this.DataObject = (ADUser)base.PrepareDataObject();
     if (this.DataObject.IsChanged(MailboxSchema.WindowsLiveID) && this.DataObject.WindowsLiveID != SmtpAddress.Empty)
     {
         if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.WindowsLiveID.Enabled)
         {
             base.WriteError(new RecipientTaskException(Strings.ErrorEnableWindowsLiveIdForEnterpriseMailbox), ExchangeErrorCategory.Client, this.DataObject.Identity);
         }
         if (this.ShouldCheckAcceptedDomains())
         {
             RecipientTaskHelper.ValidateInAcceptedDomain(this.ConfigurationSession, this.DataObject.OrganizationId, this.DataObject.WindowsLiveID.Domain, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
         }
     }
     if (this.DataObject.WindowsLiveID != SmtpAddress.Empty && !this.DataObject.WindowsLiveID.Equals(this.DataObject.UserPrincipalName))
     {
         this.WriteWarning(Strings.WarningChangingUserPrincipalName(this.DataObject.UserPrincipalName, this.DataObject.WindowsLiveID.ToString()));
         this.DataObject.UserPrincipalName = this.DataObject.WindowsLiveID.ToString();
     }
     TaskLogger.LogExit();
     return(this.DataObject);
 }
コード例 #11
0
        protected override IConfigurable PrepareDataObject()
        {
            AcceptedDomain acceptedDomain = (AcceptedDomain)base.PrepareDataObject();

            acceptedDomain.SetId(this.ConfigurationSession, this.Name);
            if (base.Fields.IsModified(AcceptedDomainSchema.MailFlowPartner))
            {
                acceptedDomain.MailFlowPartner = this.mailFlowPartnerId;
            }
            else
            {
                IConfigurable[] array = base.DataSession.Find <PerimeterConfig>(null, null, true, null);
                if (array != null && array.Length == 1 && ((PerimeterConfig)array[0]).MailFlowPartner != null)
                {
                    acceptedDomain.MailFlowPartner = ((PerimeterConfig)array[0]).MailFlowPartner;
                }
            }
            if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled&& !this.DataObject.InitialDomain)
            {
                acceptedDomain.PendingCompletion = true;
            }
            return(acceptedDomain);
        }
コード例 #12
0
        // Token: 0x060003D9 RID: 985 RVA: 0x00012084 File Offset: 0x00010284
        public bool IsVariantConfigurationChanged()
        {
            VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(new DatabaseSettingsContext(this.databaseInfo.Guid, null), null, null);
            bool enabled = snapshot.MailboxAssistants.GetObject <IMailboxAssistantSettings>(this.assistantType.Identifier, new object[0]).Enabled;

            ExTraceGlobals.TimeBasedDriverManagerTracer.TraceDebug((long)this.GetHashCode(), "{0}: Assistant {1} is enabled: {2}, on database {3}.", new object[]
            {
                this.ToString(),
                this.assistantType.Identifier,
                enabled,
                this.databaseInfo.Guid
            });
            bool flag = false;

            lock (this.instanceLock)
            {
                if (enabled)
                {
                    if (this.assistantWorkloadState != TimeBasedDatabaseDriver.AssistantWorkloadStateOnDatabase.EnabledAndRunning)
                    {
                        flag = true;
                    }
                }
                else if (this.assistantWorkloadState != TimeBasedDatabaseDriver.AssistantWorkloadStateOnDatabase.DisabledAndNotRunning)
                {
                    flag = true;
                }
            }
            ExTraceGlobals.TimeBasedDriverManagerTracer.TraceDebug((long)this.GetHashCode(), "{0}: Assistant {1} needs Variant Configuration update: {2}, on database {3}.", new object[]
            {
                this.ToString(),
                this.assistantType.Identifier,
                flag,
                this.databaseInfo.Guid
            });
            return(flag);
        }
コード例 #13
0
        // Token: 0x0600084A RID: 2122 RVA: 0x0003A7E0 File Offset: 0x000389E0
        private HttpWebRequest CreateWebRequest(PublishingSubscriptionData subscriptionData, TimeSpan timeout, MailboxSession session, CalendarSyncFolderOperationLogEntry folderOpLogEntry)
        {
            Uri uri = subscriptionData.PublishingUrl;

            if (subscriptionData.UrlNeedsExpansion)
            {
                VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(session.MailboxOwner.GetContext(null), null, null);
                if (snapshot.OwaClientServer.XOWAHolidayCalendars.Enabled)
                {
                    uri = this.ExpandSubscriptionUrl(uri, snapshot, session.PreferedCulture, folderOpLogEntry);
                }
            }
            if (uri == null)
            {
                return(null);
            }
            HttpWebRequest httpWebRequest = WebRequest.Create(uri) as HttpWebRequest;

            if (httpWebRequest == null)
            {
                throw new UriFormatException(string.Format("The following URI isn't supported: {0}", uri));
            }
            httpWebRequest.Timeout           = (int)timeout.TotalMilliseconds;
            httpWebRequest.Method            = "GET";
            httpWebRequest.Accept            = "*/*";
            httpWebRequest.Credentials       = null;
            httpWebRequest.AllowAutoRedirect = true;
            httpWebRequest.UserAgent         = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)";
            Server localServer = LocalServerCache.LocalServer;

            if (localServer != null && localServer.InternetWebProxy != null)
            {
                httpWebRequest.Proxy = new WebProxy(localServer.InternetWebProxy, true);
            }
            return(httpWebRequest);
        }
コード例 #14
0
 // Token: 0x06001246 RID: 4678 RVA: 0x00039C60 File Offset: 0x00037E60
 private bool ConnectionBlockedByClientAccessRules(PswsAuthZUserToken userToken, out string blockingRuleName)
 {
     blockingRuleName = null;
     if (userToken.OrgId != null && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.PswsClientAccessRulesEnabled.Enabled)
     {
         string blockRuleName = null;
         bool   result        = ClientAccessRulesUtils.ShouldBlockConnection(userToken.OrgId, ClientAccessRulesUtils.GetUsernameFromADRawEntry(userToken.UserEntry), ClientAccessProtocol.PowerShellWebServices, ClientAccessRulesUtils.GetRemoteEndPointFromContext(HttpContext.Current), ClientAccessAuthenticationMethod.BasicAuthentication, userToken.UserEntry, delegate(ClientAccessRulesEvaluationContext context)
         {
             blockRuleName = context.CurrentRule.Name;
             AuthZLogger.SafeAppendGenericError(ClientAccessRulesConstants.ClientAccessRuleName, context.CurrentRule.Name, false);
             ExTraceGlobals.PublicPluginAPITracer.TraceDebug <string, string>((long)this.GetHashCode(), "[PswsAuthorization.AuthorizeUser] Blocked by Client Access Rules ({0}={1})", ClientAccessRulesConstants.ClientAccessRuleName, context.CurrentRule.Name);
         }, delegate(double latency)
         {
             if (latency > 50.0)
             {
                 AuthZLogger.SafeAppendGenericInfo(ClientAccessRulesConstants.ClientAccessRulesLatency, latency.ToString());
                 ExTraceGlobals.PublicPluginAPITracer.TraceDebug <string, string>((long)this.GetHashCode(), "[PswsAuthorization.AuthorizeUser] Client Access Rules latency logger ({0}={1})", ClientAccessRulesConstants.ClientAccessRulesLatency, latency.ToString());
             }
         });
         blockingRuleName = blockRuleName;
         return(result);
     }
     return(false);
 }
コード例 #15
0
        public bool HasTask()
        {
            VariantConfigurationSnapshot snapshot = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null);
            bool spreadLoad = snapshot.MailboxAssistants.GetObject <IMailboxAssistantSettings>(this.Driver.AssistantType.Identifier, new object[0]).SpreadLoad;

            lock (this.instanceLock)
            {
                switch (this.Driver.Governor.GetHierarchyStatus())
                {
                case GovernorStatus.Retry:
                    if (!this.retry)
                    {
                        return(false);
                    }
                    this.retry = false;
                    break;

                case GovernorStatus.Failure:
                    return(false);
                }
                if (this.pendingQueue == null || this.pendingQueue.Count == 0)
                {
                    return(false);
                }
                if (spreadLoad)
                {
                    float num  = (float)(this.InterestingMailboxCount - this.pendingQueue.Count - 1) / (float)this.InterestingMailboxCount;
                    float num2 = (float)this.Duration.Ticks / (float)this.Driver.AssistantType.WorkCycleCheckpoint.Ticks;
                    if (num > num2)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #16
0
        protected void Initialize(object notificationLock)
        {
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), this.organizationId, null, false), 132, "Initialize", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\OrganizationConfiguration\\PerTenantConfigurationLoader.cs");

            if (this.data == null || this.notificationCookie == null)
            {
                this.InternalRead(tenantOrTopologyConfigurationSession, false);
                this.startTime = ExDateTime.Now;
            }
            if (this.organizationId != OrganizationId.ForestWideOrgId || VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
            {
                return;
            }
            if (this.notificationCookie == null)
            {
                lock (notificationLock)
                {
                    if (this.notificationCookie == null)
                    {
                        this.RegisterChangeNotification(tenantOrTopologyConfigurationSession);
                    }
                }
            }
        }
コード例 #17
0
        // Token: 0x06000005 RID: 5 RVA: 0x00002158 File Offset: 0x00000358
        internal static void Main(string[] args)
        {
            List <string> list = new List <string>();

            list.Add("SeAuditPrivilege");
            list.Add("SeChangeNotifyPrivilege");
            list.Add("SeCreateGlobalPrivilege");
            list.Add("SeImpersonatePrivilege");
            bool isSystem;

            using (WindowsIdentity current = WindowsIdentity.GetCurrent())
            {
                isSystem = current.IsSystem;
            }
            if (isSystem)
            {
                list.Add("SeIncreaseQuotaPrivilege");
                list.Add("SeAssignPrimaryTokenPrivilege");
            }
            int num = Privileges.RemoveAllExcept(list.ToArray());

            if (num != 0)
            {
                Environment.Exit(num);
            }
            Globals.InitializeSinglePerfCounterInstance();
            ExWatson.Register();
            bool flag  = !Environment.UserInteractive;
            bool flag2 = false;
            bool flag3 = false;

            foreach (string text in args)
            {
                if (text.StartsWith("-?", StringComparison.OrdinalIgnoreCase))
                {
                    TransportService.Usage();
                    Environment.Exit(0);
                }
                else if (text.StartsWith("-console", StringComparison.OrdinalIgnoreCase))
                {
                    flag2 = true;
                }
                else if (text.StartsWith("-wait", StringComparison.OrdinalIgnoreCase))
                {
                    flag3 = true;
                }
            }
            if (!flag)
            {
                if (!flag2)
                {
                    TransportService.Usage();
                    Environment.Exit(0);
                }
                Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name);
                if (flag3)
                {
                    Console.WriteLine("Press ENTER to continue.");
                    Console.ReadLine();
                }
            }
            SettingOverrideSync.Instance.Start(true);
            if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Transport.ADExceptionHandling.Enabled)
            {
                TransportService.adConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 324, "Main", "f:\\15.00.1497\\sources\\dev\\Transport\\src\\TransportService\\TransportService.cs");
            }
            else
            {
                ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                {
                    TransportService.adConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 334, "Main", "f:\\15.00.1497\\sources\\dev\\Transport\\src\\TransportService\\TransportService.cs");
                }, 0);
                if (!adoperationResult.Succeeded)
                {
                    ExTraceGlobals.ServiceTracer.TraceError <Exception>(0L, "Error when getting AD configuration session: {0}", adoperationResult.Exception);
                    TransportService.logger.LogEvent(TransportEventLogConstants.Tuple_MSExchangeTransportInitializationFailure, null, new object[]
                    {
                        adoperationResult.Exception.ToString()
                    });
                    Environment.Exit(1);
                }
            }
            TransportService.transportService = new TransportService(flag);
            if (!TransportService.transportService.Initialize())
            {
                ExTraceGlobals.ServiceTracer.TraceError(0L, "Failed to initialize the service. Exiting.");
                ProcessManagerService.StopService();
            }
            if (!flag)
            {
                TransportService.transportService.OnStartInternal(args);
                bool flag4 = false;
                while (!flag4)
                {
                    Console.WriteLine("Enter 'q' to shutdown.");
                    string text2 = Console.ReadLine();
                    if (string.IsNullOrEmpty(text2))
                    {
                        break;
                    }
                    switch (text2[0])
                    {
                    case 'q':
                        flag4 = true;
                        break;

                    case 'r':
                        TransportService.transportService.OnCustomCommandInternal(200);
                        break;

                    case 'u':
                        TransportService.transportService.OnCustomCommandInternal(201);
                        break;
                    }
                }
                Console.WriteLine("Shutting down ...");
                TransportService.transportService.OnStopInternal();
                Console.WriteLine("Done.");
                return;
            }
            ServiceBase.Run(TransportService.transportService);
        }
コード例 #18
0
        public override BackEndServer TryDirectBackEndCalculation()
        {
            if (this.ServerVersion.Major == 15 && !this.ExactVersionMatch)
            {
                BackEndServer backEndServer = LocalSiteMailboxServerCache.Instance.TryGetRandomE15Server(base.RequestContext);
                if (backEndServer != null)
                {
                    ServerVersion serverVersion = new ServerVersion(backEndServer.Version);
                    if (serverVersion.Minor >= this.ServerVersion.Minor)
                    {
                        return(backEndServer);
                    }
                }
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled)
            {
                try
                {
                    MiniServer miniServer;
                    if (this.ExactVersionMatch)
                    {
                        miniServer = ServersCache.GetAnyBackEndServerWithExactVersion(this.ServerVersion.ToInt());
                    }
                    else
                    {
                        miniServer = ServersCache.GetAnyBackEndServerWithMinVersion(this.ServerVersion.ToInt());
                    }
                    return(new BackEndServer(miniServer.Fqdn, miniServer.VersionNumber));
                }
                catch (ServerHasNotBeenFoundException)
                {
                    return(base.CheckForNullAndThrowIfApplicable <BackEndServer>(null));
                }
            }
            BackEndServer result;

            try
            {
                BackEndServer anyBackEndServerForVersion = HttpProxyBackEndHelper.GetAnyBackEndServerForVersion <ServiceType>(this.ServerVersion, this.ExactVersionMatch, this.ClientAccessType, false);
                result = anyBackEndServerForVersion;
            }
            catch (ServerNotFoundException)
            {
                result = base.CheckForNullAndThrowIfApplicable <BackEndServer>(null);
            }
            return(result);
        }
コード例 #19
0
 internal static bool SeriesMessageOrderingEnabled(MiniRecipient mailboxOwner)
 {
     return(mailboxOwner != null && VariantConfiguration.GetSnapshot(mailboxOwner.GetContext(null), null, null).MailboxTransport.OrderSeriesMeetingMessages.Enabled);
 }
コード例 #20
0
        protected virtual FeaturesManager CreateFeaturesManager()
        {
            IList <string> flightsFromQueryString = this.GetFlightsFromQueryString(this.currentFlightsOverride);
            VariantConfigurationSnapshot configurationSnapshot = string.IsNullOrWhiteSpace(this.rampId) ? VariantConfiguration.GetSnapshot(this.recipient.GetContext(null), null, flightsFromQueryString) : VariantConfiguration.GetSnapshot(this.recipient.GetContext(this.rampId, this.isFirstRelease), null, flightsFromQueryString);

            return(FeaturesManager.Create(configurationSnapshot, this.configurationContext, this.featureStateOverrideFactory));
        }
コード例 #21
0
        // Token: 0x060014B4 RID: 5300 RVA: 0x0007E0D4 File Offset: 0x0007C2D4
        private static void LoadThemeFiles()
        {
            ExTraceGlobals.ThemesCallTracer.TraceDebug(0L, "LoadThemeFiles");
            string text = Path.Combine(HttpRuntime.AppDomainAppPath, Globals.ApplicationVersion);

            text = Path.Combine(text, ThemeManager.themesFolderName);
            if (!Directory.Exists(text))
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_NoThemesFolder, string.Empty, new object[]
                {
                    text
                });
                throw new OwaThemeManagerInitializationException("Themes folder not found ('" + text + "')");
            }
            string[] directories = Directory.GetDirectories(text);
            SortedDictionary <int, SortedList <string, Theme> > sortedDictionary = new SortedDictionary <int, SortedList <string, Theme> >();
            int i = 0;

            while (i < directories.Length)
            {
                string text2 = directories[i];
                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text2);
                if (string.IsNullOrEmpty(fileNameWithoutExtension))
                {
                    goto IL_151;
                }
                if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseThemeStorageFolder.Enabled || !string.Equals(fileNameWithoutExtension, ThemeManager.DataCenterThemeStorageId, StringComparison.OrdinalIgnoreCase))
                {
                    if (string.Equals(fileNameWithoutExtension, ThemeManager.ResourcesFolderName, StringComparison.OrdinalIgnoreCase))
                    {
                        ThemeManager.resourcesFolderPath = string.Format("{0}{1}/", ThemeManager.themesFolderPath, ThemeManager.ResourcesFolderName);
                        ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Located Theme resources folder: '{0}'", ThemeManager.resourcesFolderPath);
                    }
                    else
                    {
                        if (!string.Equals(fileNameWithoutExtension, ThemeManager.BasicFilesFolderName, StringComparison.OrdinalIgnoreCase))
                        {
                            goto IL_151;
                        }
                        ThemeManager.basicFolderPath = string.Format("{0}{1}/", ThemeManager.themesFolderPath, ThemeManager.BasicFilesFolderName);
                        ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Located Basic folder: '{0}'", ThemeManager.basicFolderPath);
                    }
                }
IL_232:
                i++;
                continue;
IL_151:
                ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Inspecting theme folder '{0}'", text2);
                Theme theme = Theme.Create(text2);
                if (theme == null)
                {
                    goto IL_232;
                }
                if (!sortedDictionary.ContainsKey(theme.SortOrder))
                {
                    sortedDictionary.Add(theme.SortOrder, new SortedList <string, Theme>());
                }
                sortedDictionary[theme.SortOrder].Add(theme.StorageId, theme);
                if (theme.IsBase)
                {
                    ThemeManager.baseTheme           = theme;
                    ThemeManager.baseThemeFolderPath = string.Format("{0}{1}/", ThemeManager.themesFolderPath, ThemeManager.baseTheme.FolderName);
                }
                if (ThemeManager.storageIdToIdMap.ContainsKey(theme.StorageId))
                {
                    throw new OwaThemeManagerInitializationException(string.Format("Duplicated theme found (folder name={0})", theme.FolderName));
                }
                ThemeManager.storageIdToIdMap.Add(theme.StorageId, uint.MaxValue);
                ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Succesfully added theme. Name={0}", theme.DisplayName);
                goto IL_232;
            }
            List <Theme> list = new List <Theme>();

            foreach (KeyValuePair <int, SortedList <string, Theme> > keyValuePair in sortedDictionary)
            {
                foreach (KeyValuePair <string, Theme> keyValuePair2 in keyValuePair.Value)
                {
                    list.Add(keyValuePair2.Value);
                }
            }
            ThemeManager.themes = list.ToArray();
            for (int j = 0; j < ThemeManager.themes.Length; j++)
            {
                ThemeManager.storageIdToIdMap[ThemeManager.themes[j].StorageId] = (uint)j;
            }
            if (ThemeManager.baseTheme == null)
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_NoBaseTheme, string.Empty, new object[]
                {
                    ThemeManager.BaseThemeFolderName
                });
                throw new OwaThemeManagerInitializationException(string.Format("Couldn't find a base theme (folder name={0})", ThemeManager.BaseThemeFolderName));
            }
            if (string.IsNullOrEmpty(ThemeManager.resourcesFolderPath))
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_NoThemeResources, string.Empty, new object[]
                {
                    ThemeManager.BaseThemeFolderName
                });
                throw new OwaThemeManagerInitializationException(string.Format("Couldn't find theme resources (folder name={0})", ThemeManager.ResourcesFolderName));
            }
        }
コード例 #22
0
 public AttachmentDataProviderManager()
 {
     this.isOneDriveProProviderAvailable = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.OneDriveProProviderAvailable.Enabled;
     this.lockObject = new object();
     this.useMockAttachmentDataProvider = AttachmentDataProviderManager.IsMockDataProviderEnabled();
 }
コード例 #23
0
 internal static BackEndServer GetDeterministicBackEndServer <ServiceType>(BackEndServer mailboxServer, string identifier, ClientAccessType clientAccessType) where ServiceType : HttpService
 {
     if (mailboxServer == null)
     {
         throw new ArgumentNullException("mailboxServer");
     }
     if (string.IsNullOrEmpty(identifier))
     {
         throw new ArgumentNullException("identifier");
     }
     if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled)
     {
         MiniServer deterministicBackEndServerFromSameSite = ServersCache.GetDeterministicBackEndServerFromSameSite(mailboxServer.Fqdn, Server.E15MinVersion, identifier, false);
         return(new BackEndServer(deterministicBackEndServerFromSameSite.Fqdn, deterministicBackEndServerFromSameSite.VersionNumber));
     }
     HttpProxyBackEndHelper.TopologyWithSites completeServiceTopologyWithSites = HttpProxyBackEndHelper.GetCompleteServiceTopologyWithSites(mailboxServer.Fqdn);
     HttpService[] array = (HttpService[])HttpProxyBackEndHelper.FindAcceptableBackEndService <ServiceType>(completeServiceTopologyWithSites, clientAccessType, (int x) => x >= Server.E15MinVersion);
     if (array.Length > 0)
     {
         int num = HttpProxyBackEndHelper.ComputeIndex(identifier, array.Length);
         ExTraceGlobals.CafeTracer.TraceDebug <int, string, int>(0L, "[HttpProxyBackEndHelper.GetDeterministicBackEndServer] Buckets: {0} Identifier: {1} Index: {2}", array.Length, identifier, num);
         return(new BackEndServer(array[num].ServerFullyQualifiedDomainName, array[num].ServerVersionNumber));
     }
     throw new ServerNotFoundException("Unable to find proper HTTP service.");
 }
コード例 #24
0
 internal static BackEndServer GetAnyBackEndServer()
 {
     return(HttpProxyBackEndHelper.GetAnyBackEndServer(VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled));
 }
コード例 #25
0
 internal static bool IsBranded()
 {
     return(VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.IsBranded.Enabled&& BrandingUtilities.HasMHCookie());
 }
コード例 #26
0
 // Token: 0x060005F1 RID: 1521 RVA: 0x0001678C File Offset: 0x0001498C
 public IActiveManagerSettings GetSettings()
 {
     return(VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).HighAvailability.ActiveManager);
 }
コード例 #27
0
        public override BackEndServer TryDirectBackEndCalculation()
        {
            BackEndServer backEndServer = LocalSiteMailboxServerCache.Instance.TryGetRandomE15Server(base.RequestContext);

            if (backEndServer != null)
            {
                return(backEndServer);
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled)
            {
                try
                {
                    MiniServer anyBackEndServerFromLocalSite = ServersCache.GetAnyBackEndServerFromLocalSite(Server.E15MinVersion, false);
                    return(new BackEndServer(anyBackEndServerFromLocalSite.Fqdn, anyBackEndServerFromLocalSite.VersionNumber));
                }
                catch (ServerHasNotBeenFoundException)
                {
                    return(base.CheckForNullAndThrowIfApplicable <BackEndServer>(null));
                }
            }
            return(HttpProxyBackEndHelper.GetAnyBackEndServerForVersion <WebServicesService>(new ServerVersion(Server.E15MinVersion), false, ClientAccessType.InternalNLBBypass, true));
        }
コード例 #28
0
        private void ExecuteFreeBusyQuery(AvailabilityQueryResult availabilityQueryResult)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            AvailabilityQuery.CalendarViewTracer.TraceDebug((long)this.GetHashCode(), "{0}: Entering AvailabilityQuery.ExecuteFreeBusyQuery()", new object[]
            {
                TraceContext.Get()
            });
            base.RequestLogger.AppendToLog <int>("AddressCount", this.MailboxArray.Length);
            base.RequestLogger.AppendToLog <string>("MessageId", base.ClientContext.MessageId);
            base.RequestLogger.AppendToLog <string>("Requester", base.ClientContext.IdentityForFilteredTracing);
            try
            {
                Guid           serverRequestId = Microsoft.Exchange.Diagnostics.Trace.TraceCasStart(this.casTraceEventType);
                QueryType      queryType       = ((this.desiredFreeBusyView != null) ? QueryType.FreeBusy : ((QueryType)0)) | ((this.desiredSuggestionsView != null) ? QueryType.MeetingSuggestions : ((QueryType)0));
                ADObjectId     adobjectId      = null;
                OrganizationId organizationId  = OrganizationId.ForestWideOrgId;
                if (base.ClientContext is InternalClientContext && !this.IsCrossForestRequest)
                {
                    adobjectId     = base.ClientContext.QueryBaseDN;
                    organizationId = base.ClientContext.OrganizationId;
                }
                if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled&& (organizationId == null || organizationId == OrganizationId.ForestWideOrgId))
                {
                    AvailabilityQuery.CalendarViewTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: Looking up the OrgId for address {1}", TraceContext.Get(), this.mailboxArray[0].Email);
                    organizationId = this.GetTargetOrganizationIdFromCache(this.mailboxArray[0].Email);
                }
                if (organizationId != null && organizationId.OrganizationalUnit != null)
                {
                    base.RequestLogger.AppendToLog <string>("ORG", organizationId.OrganizationalUnit.Name);
                }
                AvailabilityQuery.CalendarViewTracer.TraceDebug((long)this.GetHashCode(), "{0}: Ad scoping for the requester {1}: QueryBaseDN: {2}, OrganizationId: {3}", new object[]
                {
                    TraceContext.Get(),
                    base.ClientContext.ToString(),
                    (adobjectId == null) ? "<NULL>" : adobjectId.ToString(),
                    organizationId
                });
                FreeBusyApplication freeBusyApplication = new FreeBusyApplication(base.ClientContext, this.internalFreeBusyView, this.defaultFreeBusyOnly, queryType);
                try
                {
                    this.queryPrepareDeadline      = this.queryPrepareDeadline.AddMilliseconds(-this.PreExecutionTimeTaken);
                    this.requestProcessingDeadline = this.requestProcessingDeadline.AddMilliseconds(-this.PreExecutionTimeTaken);
                    using (RequestDispatcher requestDispatcher = new RequestDispatcher(base.RequestLogger))
                    {
                        FreeBusyRecipientQuery freeBusyRecipientQuery = new FreeBusyRecipientQuery(base.ClientContext, adobjectId, organizationId, this.queryPrepareDeadline);
                        RecipientQueryResults  recipientQueryResults  = freeBusyRecipientQuery.Query(this.mailboxArray);
                        QueryGenerator         queryGenerator         = new QueryGenerator(freeBusyApplication, base.ClientContext, base.RequestLogger, requestDispatcher, this.queryPrepareDeadline, this.requestProcessingDeadline, recipientQueryResults);
                        bool flag = false;
                        try
                        {
                            BaseQuery[] queries = queryGenerator.GetQueries();
                            this.freeBusyQueryArray = FreeBusyApplication.ConvertBaseToFreeBusyQuery(queries);
                            if (base.ClientContext.Budget != null)
                            {
                                base.ClientContext.Budget.EndLocal();
                                flag = true;
                            }
                            requestDispatcher.Execute(this.requestProcessingDeadline, base.HttpResponse);
                            this.individualMailboxesProcessed = queryGenerator.UniqueQueriesCount;
                        }
                        finally
                        {
                            if (flag)
                            {
                                base.ClientContext.Budget.StartLocal("AvailabilityQuery.ExecuteFreeBusyQuery", default(TimeSpan));
                            }
                            requestDispatcher.LogStatistics(base.RequestLogger);
                        }
                    }
                }
                finally
                {
                    freeBusyApplication.LogThreadsUsage(base.RequestLogger);
                }
                foreach (FreeBusyQuery freeBusyQuery in this.freeBusyQueryArray)
                {
                    if (freeBusyQuery.AttendeeKind == AttendeeKind.Group)
                    {
                        FreeBusyQueryResult resultOnFirstCall;
                        if (freeBusyQuery.GroupMembersForFreeBusy != null)
                        {
                            resultOnFirstCall = MergedFreeBusy.MergeGroupMemberResults(base.ClientContext.TimeZone, this.internalFreeBusyView.MergedFreeBusyIntervalInMinutes, new ExDateTime(base.ClientContext.TimeZone, this.internalFreeBusyView.TimeWindow.StartTime), new ExDateTime(base.ClientContext.TimeZone, this.internalFreeBusyView.TimeWindow.EndTime), freeBusyQuery.GroupMembersForFreeBusy, base.ClientContext.RequestSchemaVersion);
                        }
                        else
                        {
                            resultOnFirstCall = new FreeBusyQueryResult(FreeBusyViewType.None, null, null, null);
                        }
                        freeBusyQuery.SetResultOnFirstCall(resultOnFirstCall);
                    }
                }
                availabilityQueryResult.FreeBusyResults = new FreeBusyQueryResult[this.freeBusyQueryArray.Length];
                for (int j = 0; j < this.freeBusyQueryArray.Length; j++)
                {
                    availabilityQueryResult.FreeBusyResults[j] = this.freeBusyQueryArray[j].Result;
                }
                this.TraceExecuteFreeBusyQueryStop(serverRequestId);
                AvailabilityQuery.CalendarViewTracer.TraceDebug((long)this.GetHashCode(), "{0}: Leaving AvailabilityQuery.ExecuteFreeBusyQuery()", new object[]
                {
                    TraceContext.Get()
                });
            }
            finally
            {
                base.RequestLogger.CalculateQueryStatistics(this.freeBusyQueryArray);
                base.LogFailures(availabilityQueryResult, base.RequestLogger.ExceptionData);
                stopwatch.Stop();
                base.RequestLogger.AppendToLog <long>("TAQ", stopwatch.ElapsedMilliseconds);
            }
        }
コード例 #29
0
        protected override List <MailboxData> GetMailboxesForCurrentWindow(out int totalMailboxOnDatabaseCount, out int notInterestingMailboxCount, out int filteredMailboxCount, out int failedFilteringCount)
        {
            Guid activityId = Guid.NewGuid();

            PropTag[]     mailboxProperties = this.GetMailboxProperties();
            PropValue[][] mailboxes         = MailboxTableQuery.GetMailboxes("Client=TBA", base.DatabaseInfo, mailboxProperties);
            totalMailboxOnDatabaseCount = ((mailboxes == null) ? 0 : mailboxes.Length);
            notInterestingMailboxCount  = 0;
            filteredMailboxCount        = 0;
            failedFilteringCount        = 0;
            AssistantsLog.LogGetMailboxesQueryEvent(activityId, base.Assistant.NonLocalizedName, totalMailboxOnDatabaseCount, base.Assistant as AssistantBase);
            if (mailboxes == null)
            {
                return(new List <MailboxData>());
            }
            List <MailboxInformation> list3 = new List <MailboxInformation>(mailboxes.Length);
            Guid mailboxGuid = Guid.Empty;
            VariantConfigurationSnapshot snapshot    = VariantConfiguration.GetSnapshot(DatabaseSettingsContext.Get(base.DatabaseInfo.Guid), null, null);
            TimeSpan notInterestingLogInterval       = snapshot.MailboxAssistants.GetObject <IMailboxAssistantSettings>(base.AssistantType.Identifier, new object[0]).MailboxNotInterestingLogInterval;
            int      filteredMailboxCountLocal       = 0;
            int      notInterestingMailboxCountLocal = 0;
            string   traceMessage;

            foreach (PropValue[] propertiesForDelegateClosure2 in mailboxes)
            {
                try
                {
                    PropValue[] propertiesForDelegateClosure = propertiesForDelegateClosure2;
                    List <MailboxInformation> list           = list3;
                    base.CatchMeIfYouCan(delegate
                    {
                        PropValue mailboxProperty  = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.UserGuid);
                        PropValue mailboxProperty2 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.DisplayName);
                        string mailboxDisplayNameTracingOnlyUsage = (mailboxProperty2.IsNull() || mailboxProperty2.Value == null) ? string.Empty : mailboxProperty2.Value.ToString();
                        if (mailboxProperty.PropTag != PropTag.UserGuid || mailboxProperty2.PropTag != PropTag.DisplayName)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNoGuidFilter, MailboxSlaFilterReasonType.NoGuid, new object[]
                            {
                                mailboxProperty.Value
                            });
                            filteredMailboxCountLocal++;
                            return;
                        }
                        byte[] bytes = mailboxProperty.GetBytes();
                        if (bytes != null && bytes.Length == 16)
                        {
                            mailboxGuid = new Guid(bytes);
                        }
                        if (MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.DateDiscoveredAbsentInDS).PropTag == PropTag.DateDiscoveredAbsentInDS)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNotInDirectoryFilter, MailboxSlaFilterReasonType.NotInDirectory, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        PropValue mailboxProperty3 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.MailboxMiscFlags);
                        MailboxMiscFlags @int      = (MailboxMiscFlags)mailboxProperty3.GetInt(0);
                        if ((@int & MailboxMiscFlags.CreatedByMove) == MailboxMiscFlags.CreatedByMove)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxMoveDestinationFilter, MailboxSlaFilterReasonType.MoveDestination, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        MailboxMiscFlags mailboxMiscFlags = @int & (MailboxMiscFlags.DisabledMailbox | MailboxMiscFlags.SoftDeletedMailbox | MailboxMiscFlags.MRSSoftDeletedMailbox);
                        if (mailboxMiscFlags != MailboxMiscFlags.None)
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxInaccessibleFilter, MailboxSlaFilterReasonType.Inaccessible, new object[]
                            {
                                mailboxMiscFlags
                            });
                            filteredMailboxCountLocal++;
                            return;
                        }
                        IMailboxFilter mailboxFilter = this.AssistantType as IMailboxFilter;
                        if (mailboxFilter != null && mailboxProperty3.PropTag == PropTag.MailboxMiscFlags)
                        {
                            MailboxMiscFlags int2 = (MailboxMiscFlags)mailboxProperty3.GetInt();
                            bool flag             = (int2 & MailboxMiscFlags.ArchiveMailbox) == MailboxMiscFlags.ArchiveMailbox;
                            if (flag && !mailboxFilter.MailboxType.Contains(MailboxType.Archive))
                            {
                                this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxArchiveFilter, MailboxSlaFilterReasonType.Archive, new object[0]);
                                filteredMailboxCountLocal++;
                                return;
                            }
                        }
                        ControlData controlData = ControlData.Empty;
                        if (this.AssistantType.ControlDataPropertyDefinition != null)
                        {
                            PropValue mailboxProperty4 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, (PropTag)this.AssistantType.ControlDataPropertyDefinition.PropertyTag);
                            if (mailboxProperty4.PropTag == (PropTag)this.AssistantType.ControlDataPropertyDefinition.PropertyTag)
                            {
                                controlData = ControlData.CreateFromByteArray(mailboxProperty4.GetBytes());
                            }
                        }
                        TenantPartitionHint tenantPartitionHint = null;
                        PropValue mailboxProperty5 = MailboxTableQuery.GetMailboxProperty(propertiesForDelegateClosure, PropTag.PersistableTenantPartitionHint);
                        if (mailboxProperty5.PropTag == PropTag.PersistableTenantPartitionHint)
                        {
                            byte[] bytes2 = mailboxProperty5.GetBytes();
                            if (bytes2 != null && bytes2.Length != 0)
                            {
                                tenantPartitionHint = TenantPartitionHint.FromPersistablePartitionHint(bytes2);
                            }
                        }
                        MailboxInformation mailboxInformation2 = MailboxInformation.Create(mailboxProperty.GetBytes(), this.DatabaseInfo.Guid, mailboxProperty2.GetString(), controlData, propertiesForDelegateClosure, MailboxInformation.GetLastLogonTime(propertiesForDelegateClosure), tenantPartitionHint);
                        if (!this.DatabaseInfo.IsUserMailbox(mailboxInformation2.MailboxGuid))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxNotUserFilter, MailboxSlaFilterReasonType.NotUser, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (mailboxInformation2.MailboxData.IsPublicFolderMailbox && (mailboxFilter == null || !mailboxFilter.MailboxType.Contains(MailboxType.PublicFolder)))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxPublicFolderFilter, MailboxSlaFilterReasonType.PublicFolder, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (this.IsMailboxInDemandJob(mailboxInformation2.MailboxData))
                        {
                            this.LogStoreDriverMailboxFilterEvent(notInterestingLogInterval, activityId, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, Strings.MailboxInDemandJobFilter, MailboxSlaFilterReasonType.InDemandJob, new object[0]);
                            filteredMailboxCountLocal++;
                            return;
                        }
                        if (this.AssistantType.MailboxExtendedProperties != null)
                        {
                            if (!this.AssistantType.IsMailboxInteresting(mailboxInformation2))
                            {
                                traceMessage = string.Format("{0}: {1} is not interesting for the assistant {2}.", this, mailboxGuid, this.Assistant.NonLocalizedName);
                                ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                                DateTime utcNow = DateTime.UtcNow;
                                if (!this.notInterestingEventsLastLogDateTimes.ContainsKey(this.Assistant.NonLocalizedName) || utcNow - this.notInterestingEventsLastLogDateTimes[this.Assistant.NonLocalizedName] >= notInterestingLogInterval)
                                {
                                    AssistantsLog.LogMailboxNotInterestingEvent(activityId, this.Assistant.NonLocalizedName, this.Assistant as AssistantBase, mailboxGuid, mailboxDisplayNameTracingOnlyUsage);
                                    this.notInterestingEventsLastLogDateTimes[this.Assistant.NonLocalizedName] = utcNow;
                                }
                                notInterestingMailboxCountLocal++;
                                return;
                            }
                        }
                        else
                        {
                            traceMessage = string.Format("{0}: {1} mailbox properties are null, IsMailboxInteresting was not called.", this, mailboxGuid);
                            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                        }
                        traceMessage = string.Format("{0}: {1} is interesting for the assistant {2}.", this, mailboxGuid, this.Assistant.NonLocalizedName);
                        ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
                        AssistantsLog.LogMailboxInterestingEvent(activityId, this.Assistant.NonLocalizedName, this.Assistant as AssistantBase, null, mailboxGuid, mailboxDisplayNameTracingOnlyUsage);
                        list.Add(mailboxInformation2);
                    }, base.AssistantType.NonLocalizedName);
                }
                catch (AIException exception)
                {
                    failedFilteringCount++;
                    AssistantsLog.LogErrorEnumeratingMailboxes(base.Assistant, mailboxGuid, exception, true);
                }
                catch (Exception exception2)
                {
                    AssistantsLog.LogErrorEnumeratingMailboxes(base.Assistant, mailboxGuid, exception2, false);
                    throw;
                }
            }
            traceMessage = string.Format("{0}: {1} mailboxes after filtering", this, list3.Count);
            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), traceMessage);
            if (this.firstIteration || base.AssistantType.WorkCycleCheckpoint < base.AssistantType.WorkCycle)
            {
                int count = list3.Count;
                list3 = list3.FindAll((MailboxInformation mailbox) => DateTime.UtcNow - mailbox.LastProcessedDate > base.AssistantType.WorkCycle - base.AssistantType.WorkCycleCheckpoint);
                this.firstIteration        = false;
                filteredMailboxCountLocal += count - list3.Count;
            }
            list3.Sort((MailboxInformation m1, MailboxInformation m2) => m1.LastProcessedDate.CompareTo(m2.LastProcessedDate));
            List <MailboxData> list2 = new List <MailboxData>();

            foreach (MailboxInformation mailboxInformation in list3)
            {
                list2.Add(mailboxInformation.MailboxData);
            }
            AssistantsLog.LogEndGetMailboxesEvent(activityId, base.Assistant.NonLocalizedName, list2.Count, base.Assistant as AssistantBase);
            filteredMailboxCount       = filteredMailboxCountLocal;
            notInterestingMailboxCount = notInterestingMailboxCountLocal;
            return(list2);
        }
コード例 #30
0
        // Token: 0x06000FDA RID: 4058 RVA: 0x00062BB0 File Offset: 0x00060DB0
        private void OnAuthenticateRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaModule.OnAuthenticateRequest");
            HttpApplication httpApplication = (HttpApplication)sender;

            if (this.ShouldInterceptRequest(httpApplication.Context, false))
            {
                HttpContext context = httpApplication.Context;
                if (UrlUtilities.IsWacRequest(httpApplication.Context.Request))
                {
                    context.User = new WindowsPrincipal(WindowsIdentity.GetAnonymous());
                    context.SkipAuthorization = true;
                }
                this.WriteOutlookSessionCookieIfNeeded(context);
                OwaContext owaContext = OwaContext.Create(context);
                OwaContext.Set(context, owaContext);
                bool flag = false;
                this.requestInspector.OnBeginRequest(sender, e, out flag);
                if (flag)
                {
                    return;
                }
                if (Globals.FilterETag && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.FilterETag.Enabled)
                {
                    context.Request.Headers.Remove("ETag");
                }
                ExTraceGlobals.RequestTracer.TraceDebug <string, string>((long)owaContext.GetHashCode(), "Request: {0} {1}", context.Request.HttpMethod, context.Request.Url.LocalPath);
                owaContext.TraceRequestId = Trace.TraceCasStart(CasTraceEventType.Owa);
                string arg;
                if (!Utilities.ValidateRequest(context, out arg))
                {
                    ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Request is invalid, will not continue processing. Reason = {0}", arg);
                    Utilities.EndResponse(context, HttpStatusCode.BadRequest);
                }
                if (!Globals.IsInitialized)
                {
                    ExTraceGlobals.CoreTracer.TraceError(0L, "Can't process this request because the application wasn't succesfully initialized");
                    lock (this.firstFailedInitRequestLock)
                    {
                        if (this.firstFailedInitRequest != null)
                        {
                            if (ExDateTime.UtcNow.Subtract(this.firstFailedInitRequest.Value).TotalMilliseconds > 30000.0)
                            {
                                OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaRestartingAfterFailedLoad, string.Empty, new object[0]);
                                AppDomain.Unload(Thread.GetDomain());
                            }
                        }
                        else
                        {
                            this.firstFailedInitRequest = new ExDateTime?(ExDateTime.UtcNow);
                        }
                    }
                    Utilities.RewritePathToError(owaContext, LocalizedStrings.GetNonEncoded(-1556449487), Globals.InitializationError.Message);
                    return;
                }
            }
            else if (this.IsBasicRequest(httpApplication.Context.Request))
            {
                Utilities.EndResponse(httpApplication.Context, HttpStatusCode.BadRequest);
            }
        }