private bool CanIgnoreExceptionForWatsonReport(Exception exception) { if (OwaDiagnostics.CanIgnoreExceptionForWatsonReport(exception)) { return(true); } TargetInvocationException ex = exception as TargetInvocationException; return(ex != null && ex.InnerException != null && OwaDiagnostics.CanIgnoreExceptionForWatsonReport(ex.InnerException)); }
private void LoadThemeFiles(string resourcesDiskRelativeFolderPath) { ExTraceGlobals.ThemesCallTracer.TraceDebug(0L, "LoadThemeFiles"); string text = Path.Combine(FolderConfiguration.Instance.RootPath, resourcesDiskRelativeFolderPath, ThemeManager.themesFolderSubPath); 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); List <Theme> list = new List <Theme>(); foreach (string text2 in directories) { Path.GetFileNameWithoutExtension(text2); ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Inspecting theme folder '{0}'", text2); Theme theme = Theme.Create(text2); if (theme == null) { ExTraceGlobals.ThemesTracer.TraceWarning <string>(0L, "Theme folder '{0}' is invalid", text2); } else { list.Add(theme); if (theme.IsBase) { this.baseTheme = theme; } if (this.storageIdToIdMap.ContainsKey(theme.StorageId)) { throw new OwaThemeManagerInitializationException(string.Format("Duplicated theme found (folder name={0})", theme.FolderName)); } this.storageIdToIdMap.Add(theme.StorageId, uint.MaxValue); ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Successfully added theme. Name={0}", theme.DisplayName); } } list.Sort(); this.themes = list.ToArray(); for (int j = 0; j < this.themes.Length; j++) { this.storageIdToIdMap[this.themes[j].StorageId] = (uint)j; } if (this.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)); } }
private static void ThrowParserException(XmlTextReader reader, string folderName, string description, ExEventLog.EventTuple tuple, params object[] eventMessageArgs) { OwaDiagnostics.LogEvent(tuple, string.Empty, eventMessageArgs); throw new OwaThemeManagerInitializationException(string.Format(CultureInfo.InvariantCulture, "Invalid theme info file in folder '{0}'. Line {1} Position {2}.{3}", new object[] { folderName, reader.LineNumber.ToString(CultureInfo.InvariantCulture), reader.LinePosition.ToString(CultureInfo.InvariantCulture), (description != null) ? (" " + description) : string.Empty }), null, null); }
public static void SendWatsonReportsForGrayExceptions(GrayException.UserCodeDelegate tryCode) { GrayException.MapAndReportGrayExceptions(tryCode, delegate(Exception exception) { if (OwaDiagnostics.CanIgnoreExceptionForWatsonReport(exception)) { ExWatson.SetWatsonReportAlreadySent(exception); return(true); } return(GrayException.IsGrayException(exception)); }); }
// Token: 0x0600036F RID: 879 RVA: 0x0000DA10 File Offset: 0x0000BC10 private void LogExceptionFromBposShellService(Exception e, string guid) { Exception baseException = e.GetBaseException(); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_BposHeaderConfigurationError, string.Empty, new object[] { baseException.ToString(), this.userPrincipalName, this.userPuid + " GUID: " + guid, this.boxServiceUrl }); }
// Token: 0x06000A44 RID: 2628 RVA: 0x000238E8 File Offset: 0x00021AE8 private static bool HasPrivateKey(X509Certificate2 cert) { bool result = true; if (!cert.HasPrivateKey) { ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate does not have a private key."); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNoPrivateKey, string.Empty, new object[0]); OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), "IM Certificate does not have a private key.", ResultSeverityLevel.Error); result = false; } return(result); }
internal static void DownloadAndAttachFile(Guid operationId, AttachmentDataProvider attachmentDataProvider, UserContext userContext, string location, string dataProviderItemId, string parentItemId, string subscriptionId, IdConverter idConverter, string channelId, string dataProviderParentItemId, string providerEndpointUrl, CancellationToken cancellationToken, string cancellationId) { AttachmentResultCode errorCode = AttachmentResultCode.GenericFailure; Exception exception = null; AttachmentIdType attachmentId = null; try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(async delegate() { try { DownloadItemAsyncResult downloadItemResult = await attachmentDataProvider.DownloadItemAsync(location, dataProviderItemId, dataProviderParentItemId, providerEndpointUrl, cancellationToken).ConfigureAwait(false); CreateAttachmentNotificationPayload result = new CreateAttachmentNotificationPayload { SubscriptionId = subscriptionId, Id = operationId.ToString(), Bytes = downloadItemResult.Bytes, Item = downloadItemResult.Item, ResultCode = downloadItemResult.ResultCode }; attachmentId = CreateAttachmentHelper.CreateAttachmentAndSendPendingGetNotification(userContext, parentItemId, result.Bytes, result.Item.Name, result, idConverter, channelId); } catch (OperationCanceledException exception) { errorCode = AttachmentResultCode.Cancelled; exception = exception; if (cancellationId != null) { userContext.CancelAttachmentManager.CreateAttachmentCancelled(cancellationId); } } }); } catch (GrayException ex) { ExTraceGlobals.AttachmentHandlingTracer.TraceError <string>(0L, "CreateAttachmentFromAttachmentDataProvider.DownloadAndAttachFile Exception while trying to download and attach file async : {0}", ex.StackTrace); exception = ex; } finally { if (cancellationId != null) { userContext.CancelAttachmentManager.CreateAttachmentCompleted(cancellationId, attachmentId); } if (exception != null) { CreateAttachmentHelper.SendFailureNotification(userContext, subscriptionId, operationId.ToString(), errorCode, channelId, exception); } } }
// Token: 0x06000A46 RID: 2630 RVA: 0x0002397C File Offset: 0x00021B7C private static void DoesCertificateExpireSoon(X509Certificate2 cert) { ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotAfter); TimeSpan threshold = new TimeSpan(30, 0, 0, 0); if (ExDateTime.Compare(exDateTime, ExDateTime.Now) >= 0 && ExDateTime.Compare(exDateTime, ExDateTime.Now, threshold) == 0) { ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate will expire soon."); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateWillExpireSoon, string.Empty, new object[] { exDateTime }); } }
// Token: 0x06000A41 RID: 2625 RVA: 0x00023644 File Offset: 0x00021844 private static X509Certificate2 FindCertByThumbprint(string thumbprint) { X509Certificate2 x509Certificate = null; X509Store x509Store = new X509Store(StoreName.My, StoreLocation.LocalMachine); try { x509Store.Open(OpenFlags.ReadOnly); X509Certificate2Collection x509Certificate2Collection = x509Store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false); x509Certificate = ((x509Certificate2Collection.Count > 0) ? x509Certificate2Collection[0] : null); if (x509Certificate == null) { ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate with thumbprint {0} could not be found.", new object[] { thumbprint }); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNotFound, string.Empty, new object[] { thumbprint }); OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("IM Certificate with thumbprint {0} could not be found.", thumbprint), ResultSeverityLevel.Error); } } catch (CryptographicException ex) { ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Cryptographic exception is thrown: {0}", new object[] { ex }); } catch (SecurityException ex2) { ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Security exception is thrown: {0}", new object[] { ex2 }); } catch (ArgumentException ex3) { ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Argument exception is thrown: {0}", new object[] { ex3 }); } finally { x509Store.Close(); } return(x509Certificate); }
// Token: 0x06000964 RID: 2404 RVA: 0x0002007C File Offset: 0x0001E27C private static VdirConfiguration CreateInstance(Guid vDirADObjectGuid) { ITopologyConfigurationSession topologyConfigurationSession = VdirConfiguration.CreateADSystemConfigurationSessionScopedToFirstOrg(); string text = null; ADObjectId adobjectId; if (vDirADObjectGuid == Guid.Empty) { Server server = topologyConfigurationSession.FindLocalServer(); string text2 = HttpRuntime.AppDomainAppVirtualPath.Replace("'", "''"); if (text2[0] == '/') { text2 = text2.Substring(1); } text = HttpRuntime.AppDomainAppId; if (text[0] == '/') { text = text.Substring(1); } int num = text.IndexOf('/'); text = text.Substring(num); text = string.Format("IIS://{0}{1}", server.Fqdn, text); num = text.LastIndexOf('/'); text = VdirConfiguration.GetWebSiteName(text.Substring(0, num)); adobjectId = new ADObjectId(server.DistinguishedName).GetDescendantId("Protocols", "HTTP", new string[] { string.Format("{0} ({1})", text2, text) }); } else { adobjectId = new ADObjectId(vDirADObjectGuid); } ADOwaVirtualDirectory adowaVirtualDirectory = topologyConfigurationSession.Read <ADOwaVirtualDirectory>(adobjectId); if (adowaVirtualDirectory == null) { ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <ADObjectId, string>(0L, "Unable to retrieve the vdir configuration for {0}, website name {1}", adobjectId, text); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_OwaConfigurationNotFound, adobjectId.ToDNString(), new object[] { adobjectId.ToString() }); throw new ADConfigurationException(); } return(new VdirConfiguration(topologyConfigurationSession, adowaVirtualDirectory)); }
public bool CheckConfiguration() { bool result = true; string arg = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled ? "OWA Virtual Directory object" : "web.config"; if (string.IsNullOrWhiteSpace(this.ServerName)) { result = false; OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("Instant Messaging Server name is null or empty on {0}.", arg), ResultSeverityLevel.Error); } if (string.IsNullOrWhiteSpace(this.CertificateThumbprint)) { result = false; OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("Instant Messaging Certificate Thumbprint is null or empty on {0}.", arg), ResultSeverityLevel.Error); } return(result); }
// Token: 0x06000A42 RID: 2626 RVA: 0x000237D0 File Offset: 0x000219D0 private static bool IsExpired(X509Certificate2 cert) { bool result = false; ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotAfter); if (ExDateTime.Compare(exDateTime, ExDateTime.Now) <= 0) { ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate has expired."); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateExpired, string.Empty, new object[] { exDateTime }); OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), "IM Certificate has expired.", ResultSeverityLevel.Error); result = true; } return(result); }
internal static void Execute(IMailboxContext userContext, string eventId, Action <RequestDetailsLogger> action) { if (userContext == null) { throw new ArgumentNullException("userContext"); } if (action == null) { throw new ArgumentNullException("action"); } if (string.IsNullOrEmpty(eventId)) { throw new ArgumentException("String should not be null or empty.", "eventId"); } string primarySmtpAddress = SimulatedWebRequestContext.GetPrimarySmtpAddress(userContext); if (primarySmtpAddress == null) { return; } ExchangeVersion value = ExchangeVersion.Current; bool flag; RequestDetailsLogger logger = SimulatedWebRequestContext.GetRequestDetailsLogger(eventId, userContext, primarySmtpAddress, out flag); try { ExchangeVersion.Current = ExchangeVersion.Latest; OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { action(logger); }); } catch (GrayException ex) { SimulatedWebRequestContext.ProcessException(logger, eventId, ex.InnerException); } finally { if (flag) { logger.Commit(); } ExchangeVersion.Current = value; } }
// Token: 0x06000966 RID: 2406 RVA: 0x000201FC File Offset: 0x0001E3FC private static string GetWebSiteName(string webSiteRootPath) { string result; try { using (DirectoryEntry directoryEntry = new DirectoryEntry(webSiteRootPath)) { using (DirectoryEntry parent = directoryEntry.Parent) { if (parent != null) { result = (((string)parent.Properties["ServerComment"].Value) ?? string.Empty); } else { result = string.Empty; } } } } catch (DirectoryServicesCOMException ex) { ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <string, DirectoryServicesCOMException>(0L, "Unable to retrieve the web site name for {0}. DirectoryServicesCOMException {1}", webSiteRootPath, ex); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_OwaConfigurationWebSiteUnavailable, webSiteRootPath, new object[] { webSiteRootPath, ex }); throw new ADConfigurationException(ex); } catch (DirectoryNotFoundException ex2) { ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <string, DirectoryNotFoundException>(0L, "Unable to retrieve the web site name for {0}. DirectoryNotFoundException {1}", webSiteRootPath, ex2); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_OwaConfigurationWebSiteUnavailable, webSiteRootPath, new object[] { webSiteRootPath, ex2 }); throw new ADConfigurationException(ex2); } return(result); }
private static DispatchStepResult DispatchIfLanguagePost(RequestContext requestContext) { ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[RequestDispatcher::DispatchIfLanguagePost] entry."); Canary15Cookie.CanaryValidationResult canaryValidationResult; if (requestContext.RequestType == OwaRequestType.LanguagePost && HttpUtilities.IsPostRequest(requestContext.HttpContext.Request) && Canary15Cookie.ValidateCanaryInHeaders(requestContext.HttpContext, OwaRequestHandler.GetOriginalIdentitySid(requestContext.HttpContext), Canary15Profile.Owa, out canaryValidationResult)) { OwaDiagnostics.TracePfd(25865, "The request is a post from the language selection page, processing this request...", new object[0]); ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[RequestDispatcher::DispatchIfLanguagePost] Dispatching."); HttpRequest request = requestContext.HttpContext.Request; CultureInfo culture; string timeZoneKeyName; bool isOptimized; string destination; RequestDispatcherUtilities.GetLanguagePostFormParameters(requestContext, request, out culture, out timeZoneKeyName, out isOptimized, out destination); ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[RequestDispatcher::DispatchIfLanguagePost] Dispatching language post request locally..."); return(RequestDispatcher.HandleLanguagePost(requestContext, culture, timeZoneKeyName, isOptimized, destination)); } return(DispatchStepResult.Continue); }
internal static HashSet <string> GetExpandedGroups(MailboxSession session) { string[] groupIds = null; try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { using (Folder folder = InstantMessageUtilities.SafeFolderBind(session, DefaultFolderType.Root, new PropertyDefinition[] { ViewStateProperties.ExpandedGroups })) { if (folder != null) { string[] defaultValue = null; groupIds = InstantMessageUtilities.GetFolderProperty <string[]>(folder, ViewStateProperties.ExpandedGroups, defaultValue); if (groupIds != null) { if (groupIds.Length == 1 && groupIds[0] == string.Empty) { groupIds = new string[0]; } } } } }); } catch (GrayException ex) { Microsoft.Exchange.Clients.Owa.Server.LyncIMLogging.ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "InstantMessageUtilities.GetExpandedGroups failed. Exception {0}.", new object[] { ex }); } if (groupIds == null) { return(null); } return(new HashSet <string>(groupIds)); }
internal void HandleNotification(Notification notification, object context) { MapiNotificationsLogEvent logEvent = new MapiNotificationsLogEvent(this.UserContext.ExchangePrincipal, this.UserContext.Key.ToString(), this, this.EventPrefix + "HandleNotification"); try { if (base.IsDisposed) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "MapiNotificationHandlerBase.HandleNotification for {0}: Ignoring notification because we're disposed.", base.GetType().Name); } else if (this.MissedNotifications) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "MapiNotificationHandlerBase.HandleNotification for {0}: Ignoring notification because we've missed notifications.", base.GetType().Name); } else if (this.NeedToReinitSubscriptions) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "MapiNotificationHandlerBase.HandleNotification for {0}: Ignoring notification because we need to re-init subscription.", base.GetType().Name); } else { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { this.HandleNotificationInternal(notification, logEvent, context); }); } } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string, string>((long)this.GetHashCode(), "MapiNotificationHandlerBase.HandleNotification for {0} encountered an exception: {1}", base.GetType().Name, ex.ToString()); logEvent.HandledException = ex; this.MissedNotifications = true; } finally { if (this.ShouldLog(logEvent)) { OwaServerTraceLogger.AppendToLog(logEvent); } } }
private IAsyncResult InternalInvokeBeginMethod(ServiceMethodInfo methodInfo, object service, HttpRequest httpRequest, AsyncCallback asyncCallback, object[] arguments) { int num = (arguments != null) ? arguments.Length : 0; object request = (num > 0) ? arguments[0] : null; this.inspector.AfterReceiveRequest(httpRequest, methodInfo.Name, request); if (methodInfo.ShouldAutoDisposeRequest && arguments != null) { this.delayedDisposalRequestObjects = arguments; } IAsyncResult result = null; using (CpuTracker.StartCpuTracking("BEGIN")) { object[] invokeArgs = this.ConstructAsyncInvokeArguments(arguments, asyncCallback); OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { result = (IAsyncResult)OwaServiceMethodDispatcher.InvokeMethod(httpRequest, methodInfo.BeginMethod, service, invokeArgs); }, new Func <Exception, bool>(this.CanIgnoreExceptionForWatsonReport)); } return(result); }
public static SearchNotificationPayload CreatePayLoad(IMailboxContext userContext, OwaSearchContext searchContext) { SearchNotificationPayload payload = new SearchNotificationPayload(); payload.ClientId = searchContext.ClientSearchFolderIdentity; payload.IsComplete = true; payload.Source = MailboxLocation.FromMailboxContext(userContext); SearchNotificationHandler.SearchPayloadCreator.SetHighlightTerms(payload, searchContext.HighlightTerms); try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { SearchNotificationHandler.SearchPayloadCreator.FillItemDataInPayload(userContext, searchContext, payload); }); } catch (GrayException arg) { payload.ServerSearchResultsRowCount = -1; ExTraceGlobals.NotificationsCallTracer.TraceError <GrayException>(0L, "MapiNotificationHandlerBase.CreatePayLoad Unable to create payload with data for search results. exception {0}", arg); } return(payload); }
protected override void InternalDispose(bool isDisposing) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <bool, SmtpAddress, Type>((long)this.GetHashCode(), "MapiNotificationHandlerBase.Dispose. IsDisposing: {0}, User: {1}, Type: {2}", isDisposing, this.UserContext.PrimarySmtpAddress, base.GetType()); try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { lock (this.syncRoot) { if (this.OnBeforeDisposed != null) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "MapiNotificationHandlerBase.InternalDispose Call OnBeforeDisposed."); this.OnBeforeDisposed(new ConnectionDroppedNotificationHandler.ConnectionDroppedEventHandler(this.HandleConnectionDroppedNotification)); } if ((this.remoteSubscription || this is ConnectionDroppedNotificationHandler) && this.userContext.NotificationManager != null) { this.userContext.NotificationManager.RemoteKeepAliveEvent -= this.RemoteKeepAlive; } if (!this.remoteSubscription && this.userContext.PendingRequestManager != null) { this.userContext.PendingRequestManager.KeepAlive -= this.KeepAlive; } if ((!Globals.Owa2ServerUnitTestsHook && !this.IsDisposed_Reentrant) || this.Subscription != null || this.QueryResult != null) { if (isDisposing) { this.IsDisposed_Reentrant = true; this.CleanupSubscriptions(); } } } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "MapiNotificationHandlerBase.Dispose Unable to dispose object. exception {0}", ex.Message); } }
internal static void ExecuteWithoutUserContext(string eventId, Action <RequestDetailsLogger> action) { RequestDetailsLogger logger = OwaApplication.GetRequestDetailsLogger; ActivityContext.ClearThreadScope(); logger = RequestDetailsLoggerBase <RequestDetailsLogger> .InitializeRequestLogger(); try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { action(logger); }); } catch (GrayException ex) { SimulatedWebRequestContext.ProcessException(logger, eventId, ex.InnerException); } finally { logger.Commit(); } }
private static DispatchStepResult DispatchIfLogoffRequest(RequestContext requestContext) { if (requestContext.RequestType != OwaRequestType.Logoff) { return(DispatchStepResult.Continue); } ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[RequestDispatcher::DispatchIfLogoffRequest] entry."); OwaDiagnostics.TracePfd(21769, "Dispatching logoff request.", new object[0]); requestContext.UserContext = UserContextManager.GetUserContext(requestContext.HttpContext, false); if (requestContext.UserContext != null) { RequestDispatcher.DoLogoffCleanup(requestContext); } if (RequestDispatcherUtilities.IsChangePasswordLogoff(requestContext.HttpContext.Request)) { requestContext.DestinationUrl = OwaUrl.LogoffChangePasswordPage.GetExplicitUrl(requestContext.HttpContext.Request); } else { requestContext.DestinationUrl = RequestDispatcher.GetLogoffURL(requestContext); } return(DispatchStepResult.RedirectToUrl); }
// Token: 0x06000CBB RID: 3259 RVA: 0x0002F270 File Offset: 0x0002D470 protected override void InternalDispose(bool isDisposing) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <bool>((long)this.GetHashCode(), "BrokerNotificationManager.Dispose. IsDisposing: {0}", isDisposing); if (isDisposing) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { lock (this.syncRoot) { this.isDisposed = true; if (this.userContext != null && this.userContext.PendingRequestManager != null) { this.userContext.PendingRequestManager.KeepAlive -= this.KeepHandlersAlive; } foreach (BrokerHandlerReferenceCounter brokerHandlerReferenceCounter in this.activeHandlers.Values) { brokerHandlerReferenceCounter.Dispose(); } this.activeHandlers.Clear(); this.activeHandlers = null; if (this.mapiNotificationManager != null) { this.mapiNotificationManager.Dispose(); this.mapiNotificationManager = null; } } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "[BrokerNotificationManager.Dispose]. Unable to dispose object. exception {0}", ex.Message); } } }
// Token: 0x06001159 RID: 4441 RVA: 0x000428F8 File Offset: 0x00040AF8 internal override void ExecuteApplicationBeginRequest(object sender, EventArgs e) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { RequestDetailsLoggerBase <RequestDetailsLogger> .InitializeRequestLogger(); RequestDetailsLogger getRequestDetailsLogger = OwaApplication.GetRequestDetailsLogger; getRequestDetailsLogger.ActivityScope.UpdateFromMessage(HttpContext.Current.Request); getRequestDetailsLogger.ActivityScope.SerializeTo(HttpContext.Current.Response); getRequestDetailsLogger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.IsRequest, "1"); string requestCorrelationId = HttpUtilities.GetRequestCorrelationId(HttpContext.Current); getRequestDetailsLogger.Set(OwaServerLogger.LoggerData.CorrelationId, requestCorrelationId); getRequestDetailsLogger.Set(OwaServerLogger.LoggerData.RequestStartTime, DateTime.UtcNow); HttpContext.Current.Response.AppendToLog("&ActID=" + getRequestDetailsLogger.ActivityId); HttpContext.Current.Response.AppendToLog("&CorrelationID=" + requestCorrelationId); }); } catch (GrayException arg) { ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <GrayException>(0L, "OwaApplication.ExecuteApplicationBeginRequest: GrayException: {0}", arg); throw; } }
// Token: 0x06000806 RID: 2054 RVA: 0x0001A83C File Offset: 0x00018A3C private static WacConfigData GetWacConfigData(UserContext userContext) { WacConfigData wacConfigData = new WacConfigData(); if (userContext == null) { throw new NullReferenceException("Retail assert: UserContext is null."); } if (userContext.FeaturesManager == null) { throw new NullReferenceException("Retail assert: UserContext.FeaturesManager is null."); } if (WacConfiguration.Instance == null) { throw new NullReferenceException("Retail assert: WacConfiguration.Instance is null."); } if (WacDiscoveryManager.Instance == null) { throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance is null."); } if (WacDiscoveryManager.Instance.WacDiscoveryResult == null) { throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance.WacDiscoveryResult is null."); } if (!WacConfiguration.Instance.BlockWacViewingThroughUI) { if (userContext.FeaturesManager.ClientServerSettings.DocCollab.Enabled || userContext.FeaturesManager.ClientServerSettings.ModernAttachments.Enabled) { wacConfigData.IsWacEditingEnabled = WacConfiguration.Instance.EditingEnabled; } else { wacConfigData.IsWacEditingEnabled = false; } try { wacConfigData.WacViewableFileTypes = WacDiscoveryManager.Instance.WacDiscoveryResult.WacViewableFileTypes; wacConfigData.WacEditableFileTypes = WacDiscoveryManager.Instance.WacDiscoveryResult.WacEditableFileTypes; wacConfigData.WacDiscoverySucceeded = true; } catch (WacDiscoveryFailureException ex) { OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, "DocCollab", ex.Message, ResultSeverityLevel.Error); wacConfigData.WacViewableFileTypes = new string[0]; wacConfigData.WacEditableFileTypes = new string[0]; wacConfigData.WacDiscoverySucceeded = false; wacConfigData.IsWacEditingEnabled = false; } } if (userContext.IsBposUser) { string text; string text2; wacConfigData.OneDriveDiscoverySucceeded = OneDriveProAttachmentDataProvider.TryGetBposDocumentsInfoFromBox(userContext, CallContext.Current, out text, out text2); wacConfigData.OneDriveDocumentsUrl = (text ?? string.Empty); wacConfigData.OneDriveDocumentsDisplayName = (text2 ?? string.Empty); } else { wacConfigData.OneDriveDiscoverySucceeded = true; wacConfigData.OneDriveDocumentsUrl = string.Empty; wacConfigData.OneDriveDocumentsDisplayName = string.Empty; } return(wacConfigData); }
internal static void UploadAndAttachReferenceAttachment(Guid operationId, UserContext userContext, CallContext callContext, ItemId itemId, string fileName, byte[] fileContent, IdConverter idConverter, string subscriptionId, string channelId, CancellationToken cancellationToken, string cancellationId) { AttachmentResultCode errorCode = AttachmentResultCode.GenericFailure; AttachmentIdType attachmentId = null; Exception exception = null; try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(async delegate() { try { AttachmentDataProvider attachmentDataProvider = userContext.AttachmentDataProviderManager.GetDefaultUploadDataProvider(callContext); if (attachmentDataProvider == null) { throw new InvalidOperationException("The user has no default data provider"); } UploadItemAsyncResult uploadResult = await attachmentDataProvider.UploadItemAsync(fileContent, fileName, cancellationToken, callContext).ConfigureAwait(false); CreateAttachmentNotificationPayload notificationPayload = new CreateAttachmentNotificationPayload { SubscriptionId = subscriptionId, Id = operationId.ToString(), Item = uploadResult.Item, ResultCode = uploadResult.ResultCode }; if (uploadResult.ResultCode == AttachmentResultCode.Success) { notificationPayload.Response = CreateReferenceAttachmentFromAttachmentDataProvider.AttachReferenceAttachment(attachmentDataProvider, userContext, uploadResult.Item.Location, string.Empty, itemId.Id, idConverter, null, uploadResult.Item.ProviderEndpointUrl); attachmentId = CreateAttachmentHelper.GetAttachmentIdFromCreateAttachmentResponse(notificationPayload.Response); } if (!userContext.IsDisposed) { try { userContext.LockAndReconnectMailboxSession(); CreateAttachmentHelper.SendPendingGetNotification(userContext, notificationPayload, channelId); } finally { userContext.UnlockAndDisconnectMailboxSession(); } } } catch (OperationCanceledException exception) { errorCode = AttachmentResultCode.Cancelled; exception = exception; if (cancellationId != null) { userContext.CancelAttachmentManager.CreateAttachmentCancelled(cancellationId); } } }); } catch (GrayException ex) { ExTraceGlobals.AttachmentHandlingTracer.TraceError <string>(0L, "CreateReferenceAttachmentFromLocalFile.UploadAndAttachReferenceAttachment Exception while trying to upload and attach file async : {0}", ex.StackTrace); exception = ex; } finally { if (cancellationId != null) { userContext.CancelAttachmentManager.CreateAttachmentCompleted(cancellationId, attachmentId); } if (exception != null) { CreateAttachmentHelper.SendFailureNotification(userContext, subscriptionId, operationId.ToString(), errorCode, channelId, exception); } } }
// Token: 0x06000E92 RID: 3730 RVA: 0x000379F8 File Offset: 0x00035BF8 protected override void InternalDispose(bool isDisposing) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <bool>((long)this.GetHashCode(), "OwaMapiNotificationManager.Dispose. IsDisposing: {0}", isDisposing); if (isDisposing) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { lock (this.syncRoot) { if (this.hierarchyHandlerLoggedUser != null) { this.hierarchyHandlerLoggedUser.Dispose(); this.hierarchyHandlerLoggedUser = null; } if (this.reminderHandlerLoggedUser != null) { this.reminderHandlerLoggedUser.Dispose(); this.reminderHandlerLoggedUser = null; } if (this.newMailHandlerLoggedUser != null) { this.newMailHandlerLoggedUser.Dispose(); this.newMailHandlerLoggedUser = null; } if (this.unseenItemHandler != null) { this.unseenItemHandler.Dispose(); this.unseenItemHandler = null; } if (this.groupAssociationHandlerLoggedUser != null) { this.groupAssociationHandlerLoggedUser.Dispose(); this.groupAssociationHandlerLoggedUser = null; } if (this.searchHandlerLoggedUser != null) { this.searchHandlerLoggedUser.Dispose(); this.searchHandlerLoggedUser = null; } if (this.rowNotificationHandlerCache != null) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "[OwaMapiNotificationManager.Dispose]. Calling this.rowNotificationHandlerCache.Clear()"); this.rowNotificationHandlerCache.Clear(); this.rowNotificationHandlerCache = null; } if (this.connectionDroppedNotificationHandler != null) { this.connectionDroppedNotificationHandler.Dispose(); this.connectionDroppedNotificationHandler = null; } if (this.notificationHandlers != null) { this.notificationHandlers.Clear(); this.notificationHandlers = null; } if (this.remoteKeepAliveTimer != null) { this.remoteKeepAliveTimer.Dispose(); this.remoteKeepAliveTimer = null; } this.isDisposed = true; } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "[OwaMapiNotificationManager.Dispose]. Unable to dispose object. exception {0}", ex.Message); } } }
protected override void InternalDispose(bool isDisposing) { if (!this.disposed && isDisposing) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { try { bool flag = false; try { flag = this.notifiersStateLock.LockWriterElastic(5000); } catch (OwaLockTimeoutException) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Dispose was called but the writer lock is not available:"); return; } if (!flag) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Dispose was called but the writer lock is not available:"); return; } foreach (KeyValuePair <IPendingRequestNotifier, PendingRequestManager.PendingNotifierState> keyValuePair in this.notifierDataAvailableState) { keyValuePair.Value.Dispose(); } this.notifierDataAvailableState = null; } finally { if (this.notifiersStateLock.IsWriterLockHeld) { this.notifiersStateLock.ReleaseWriterLock(); } } lock (this.pendingRequestChannels) { if (this.pendingRequestChannels != null) { foreach (string channelId in this.pendingRequestChannels.Keys) { PendingRequestChannel pendingGetChannel = this.GetPendingGetChannel(channelId); if (pendingGetChannel != null) { pendingGetChannel.Dispose(); } this.listenerChannelsManager.RemovePendingGetChannel(channelId); } } this.pendingRequestChannels.Clear(); this.pendingRequestChannels = null; } if (this.budget != null) { this.budget.Dispose(); this.budget = null; } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "MapiNotificationHandlerBase.DisposeXSOObjects Unable to dispose object. exception {0}", ex.Message); } this.disposed = true; } }
// Token: 0x06000280 RID: 640 RVA: 0x00009514 File Offset: 0x00007714 public WacDiscoveryResultBase FetchDiscoveryResults() { OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent(string.Format(CultureInfo.InvariantCulture, "Fetching wac discovery data from endPoint {0}", new object[] { this.wacDiscoveryEndPoint }))); string text = null; WacDiscoveryResultBase wacDiscoveryResultBase = null; ExEventLog.EventTuple tuple = ClientsEventLogConstants.Tuple_WacDiscoveryDataRetrievalFailure; for (int i = 0; i < 3; i++) { WebRequest webRequest = WebRequest.Create(this.wacDiscoveryEndPoint); webRequest.Method = "GET"; try { WebResponse response = webRequest.GetResponse(); using (Stream responseStream = response.GetResponseStream()) { using (XmlReader xmlReader = XmlReader.Create(responseStream)) { if (this.ParseUntilExternalHttpsNetZoneNode(xmlReader)) { wacDiscoveryResultBase = new WacDiscoveryResultSuccess(); this.ParseNetZoneData(xmlReader, wacDiscoveryResultBase); wacDiscoveryResultBase.MarkInitializationComplete(); if (wacDiscoveryResultBase.WacViewableFileTypes.Length != 0) { text = string.Format(CultureInfo.InvariantCulture, "Successfully retrieved configuration data from {0}. Supported File types: {1}", new object[] { this.wacDiscoveryEndPoint, wacDiscoveryResultBase.GetWacViewableFileTypesDisplayText() }); OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent(text)); tuple = ClientsEventLogConstants.Tuple_WacDiscoveryDataRetrievedSuccessfully; } else { text = string.Format(CultureInfo.InvariantCulture, "Successfully retrieved configuration data from {0}, but no file types defined", new object[] { this.wacDiscoveryEndPoint }); OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent(text)); wacDiscoveryResultBase = new WacDiscoveryResultFailure(new WacDiscoveryFailureException(text)); } } else { text = string.Format(CultureInfo.InvariantCulture, "Successfully retrieved configuration data from {0}, but retrieved discovery xml does not contain an external https net zone node", new object[] { this.wacDiscoveryEndPoint }); OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent(text)); wacDiscoveryResultBase = new WacDiscoveryResultFailure(new WacDiscoveryFailureException(text)); } } } break; } catch (WebException ex) { text = string.Format(CultureInfo.InvariantCulture, "Error retrieving wac discovery data from endpoint {0}. Exception was {1}", new object[] { this.wacDiscoveryEndPoint, ex }); OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent(text)); wacDiscoveryResultBase = new WacDiscoveryResultFailure(new WacDiscoveryFailureException(text)); } Thread.Sleep(100); } OwaDiagnostics.LogEvent(tuple, string.Empty, new object[] { text }); return(wacDiscoveryResultBase); }
private void WriteNotification(bool asyncOperation, double throttleInterval, IPendingRequestNotifier notifier, PendingRequestManager.PendingNotifierState notifierState) { bool flag = false; if (notifier.ShouldThrottle) { int num = notifierState.IncrementOnDataAvailableThrottleCount(); if (num > 100) { flag = true; } else if (num == 100 && throttleInterval <= 10.0) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "Start throttling mechanism - timer was started and from now on notifier {0} / {1} will be on throttling mode ", notifier.GetType().Name, notifier.GetHashCode()); flag = true; if (notifierState.ThrottleTimer == null) { notifierState.ThrottleTimer = new Timer(new TimerCallback(this.ThrottleTimeout), notifier, 20000, -1); } else { notifierState.ThrottleTimer.Change(20000, -1); } } if (num <= 100 && throttleInterval > 10.0 && num != 1) { notifierState.ExchangeOnDataAvailableThrottleCount(1); } } if (flag) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "PendingRequestManager.WriteNotification throttled notifier: {0} / {1}", notifier.GetType().Name, notifier.GetHashCode()); return; } ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "PendingRequestManager.WriteNotification is reading data from the notifier. Notifier: {0} / {1}", notifier.GetType().Name, notifier.GetHashCode()); try { List <NotificationPayloadBase> payloadList = (List <NotificationPayloadBase>)notifier.ReadDataAndResetState(); if (notifier.SubscriptionId != null) { Pusher.Instance.Distribute(payloadList, notifier.ContextKey, notifier.SubscriptionId); } if (this.pendingRequestChannels != null) { lock (this.pendingRequestChannels) { if (this.pendingRequestChannels != null) { if (this.budget == null) { this.budget = StandardBudget.Acquire(this.userContext.ExchangePrincipal.Sid, BudgetType.Owa, this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings()); } this.budget.CheckOverBudget(); this.budget.StartLocal("PendingRequestManager.WriteNotification", default(TimeSpan)); try { using (Dictionary <string, PendingRequestChannel> .Enumerator enumerator = this.pendingRequestChannels.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, PendingRequestChannel> channel = enumerator.Current; try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { KeyValuePair <string, PendingRequestChannel> channel = channel; channel.Value.WritePayload(asyncOperation, payloadList); Dictionary <string, long> dictionary = this.channelNotificationMarks; KeyValuePair <string, PendingRequestChannel> channel2 = channel; if (dictionary.ContainsKey(channel2.Key)) { Dictionary <string, long> dictionary3; Dictionary <string, long> dictionary2 = dictionary3 = this.channelNotificationMarks; KeyValuePair <string, PendingRequestChannel> channel3 = channel; string key; dictionary2[key = channel3.Key] = dictionary3[key] + (long)payloadList.Count; return; } Dictionary <string, long> dictionary4 = this.channelNotificationMarks; KeyValuePair <string, PendingRequestChannel> channel4 = channel; dictionary4.Add(channel4.Key, (long)payloadList.Count); }); } catch (GrayException ex) { Exception ex2 = (ex.InnerException != null) ? ex.InnerException : ex; ExTraceGlobals.NotificationsCallTracer.TraceError((long)this.GetHashCode(), "Exception when writing the notifications to the client. Notifier {0} / {1}, exception message: {2}, stack: {3};", new object[] { notifier.GetType().Name, notifier.GetHashCode(), ex2.Message, ex2.StackTrace }); } } } } finally { this.budget.EndLocal(); } } } } } catch (Exception ex3) { ExTraceGlobals.NotificationsCallTracer.TraceError <string, int, string>((long)this.GetHashCode(), "Exception when writing the notifications to the client. Notifier {0} / {1}, exception message: {2};", notifier.GetType().Name, notifier.GetHashCode(), (ex3.InnerException != null) ? ex3.InnerException.Message : ex3.Message); throw; } }