private static void AcquireServerLicensingMexCallback(ICancelableAsyncResult asyncResult) { RmsServerInfoManager.Tracer.TraceDebug(0L, "AcquireServerLicensingMexCallback invoked"); ArgumentValidator.ThrowIfNull("asyncResult", asyncResult); ArgumentValidator.ThrowIfNull("asyncResult.AsyncState", asyncResult.AsyncState); AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = asyncResult.AsyncState as AcquireServerInfoAsyncResult; if (acquireServerInfoAsyncResult == null) { throw new InvalidOperationException("asyncResult.AsyncState has to be type of AcquireServerInfoAsyncResult."); } acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.AcquireServerLicensingMexCallback); Exception ex = null; try { DownloadResult downloadResult = acquireServerInfoAsyncResult.HttpClient.EndDownload(asyncResult); acquireServerInfoAsyncResult.LatencyTracker.EndTrackRmsLatency(RmsOperationType.AcquireServerLicensingMexData); if (downloadResult.IsSucceeded) { Uri targetUriFromResponse = RmsClientManagerUtils.GetTargetUriFromResponse(downloadResult.ResponseStream); if (targetUriFromResponse == null) { ex = new RightsManagementException(RightsManagementFailureCode.FailedToExtractTargetUriFromMex, ServerStrings.FailedToFindTargetUriFromMExData(acquireServerInfoAsyncResult.ServerLicensingMExUri), acquireServerInfoAsyncResult.LicenseUri.ToString()); } else { acquireServerInfoAsyncResult.ServerInfo.ServerLicensingWSTargetUri = TokenTarget.Fix(targetUriFromResponse); RmsServerInfoManager.serverInfoMap.Add(acquireServerInfoAsyncResult.ServerInfo); } } else { RmsClientManager.TraceFail(null, acquireServerInfoAsyncResult.Context.SystemProbeId, "Failed to download data from server licensing MEx {0}. Exception is {1}", new object[] { acquireServerInfoAsyncResult.ServerLicensingMExUri, downloadResult.Exception }); ex = new RightsManagementException(RightsManagementFailureCode.FailedToDownloadMexData, ServerStrings.FailedToDownloadServerLicensingMExData(downloadResult.ResponseUri), downloadResult.Exception, acquireServerInfoAsyncResult.LicenseUri.ToString()); ((RightsManagementException)ex).IsPermanent = !downloadResult.IsRetryable; } } finally { acquireServerInfoAsyncResult.Release(); } RmsServerInfoManager.Tracer.TraceDebug(0L, "AcquireServiceLocationCallback: Invoking find service location callbacks"); RmsServerInfoManager.outstandingFindServiceLocationCalls.InvokeCallbacks(acquireServerInfoAsyncResult.LicenseUri, ex); }
public static ExternalRMSServerInfo EndAcquireServerInfo(IAsyncResult asyncResult) { RmsServerInfoManager.ThrowIfNotInitialized(); ArgumentValidator.ThrowIfNull("asyncResult", asyncResult); AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = asyncResult as AcquireServerInfoAsyncResult; if (acquireServerInfoAsyncResult == null) { throw new InvalidOperationException("asyncResult cannot be null and has to be type of AcquireServerInfoAsyncResult"); } acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.EndAcquireServerInfo); if (!acquireServerInfoAsyncResult.IsCompleted) { acquireServerInfoAsyncResult.InternalWaitForCompletion(); } Exception ex = acquireServerInfoAsyncResult.Result as Exception; if (ex != null) { RmsServerInfoManager.Tracer.TraceError <Uri, Exception>(0L, "EndAcquireServerInfo hit an exception; and as a result of it, '{0}' will be marked as negative entry in cache. Exception - {1}", acquireServerInfoAsyncResult.LicenseUri, ex); RightsManagementException ex2 = ex as RightsManagementException; if (ex2 == null || ex2.IsPermanent) { RmsServerInfoManager.AddNegativeServerInfo(acquireServerInfoAsyncResult.LicenseUri); } RmsClientManagerLog.LogException(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, acquireServerInfoAsyncResult.Context, ex); throw ex; } ExternalRMSServerInfo externalRMSServerInfo; if (!RmsServerInfoManager.serverInfoMap.TryGet(acquireServerInfoAsyncResult.LicenseUri, out externalRMSServerInfo)) { RmsClientManagerLog.LogAcquireServerInfoResult(acquireServerInfoAsyncResult.Context, null); RmsServerInfoManager.Tracer.TraceError(0L, "Could not find the server info in the cache"); return(null); } RmsClientManagerLog.LogAcquireServerInfoResult(acquireServerInfoAsyncResult.Context, externalRMSServerInfo); if (externalRMSServerInfo.IsNegativeEntry) { RmsServerInfoManager.Tracer.TraceError(0L, "RmsServerInfoManager found requested server info in cache; but it is a negative entry!"); return(null); } return(externalRMSServerInfo); }
private void ProcessException(Exception exception) { using (this.user.Context.Tracker.Start(TimeId.RMSProcessException)) { Command.CurrentCommand.PartialFailure = true; if (this.mailboxLogger != null) { RightsManagementException ex = exception as RightsManagementException; if (ex == null) { ex = (exception.InnerException as RightsManagementException); } if (ex != null) { this.mailboxLogger.SetData(MailboxLogDataName.IRM_FailureCode, ex.FailureCode); } this.mailboxLogger.SetData(MailboxLogDataName.IRM_Exception, new AirSyncUtility.ExceptionToStringHelper(exception)); } } }
private static RightsManagementFailureCode GetRightsManagementFailureCode(Exception exception) { if (exception is InvalidRpmsgFormatException) { return(RightsManagementFailureCode.CorruptData); } RightsManagementException ex = exception as RightsManagementException; if (exception is AttachmentProtectionException) { ex = (exception.InnerException as RightsManagementException); if (ex == null) { return(RightsManagementFailureCode.CorruptData); } } if (ex != null) { return(ex.FailureCode); } return(RightsManagementFailureCode.UnknownFailure); }
/// <summary> /// Gets the error message corresponding to a Rights Management /// exception and detects whether it is fatal and whether the user /// should be offered a mitigation. This is a specialized version of /// the ParseException function. /// </summary> /// <param name="operation">The current operation</param> /// <param name="exception">The exception to parse</param> /// <param name="askUser">Whether or not the user should be given a /// choice to take action to prevent the failure</param> /// <param name="fatal">Whether or not the failure represented is fatal /// </param> /// <returns>A user-friendly message corresponding to the exception /// </returns> private static string ParseRightsManagementException( RightsManagementOperation operation, RightsManagementException rmException, out bool askUser, out bool fatal) { askUser = false; fatal = true; RightsManagementFailureCode failureCode = rmException.FailureCode; string result = null; switch (failureCode) { case RightsManagementFailureCode.InvalidLicense: if (operation == RightsManagementOperation.TemplateAccess) { result = SRID.RightsManagementWarnErrorInvalidTemplate; } else { result = SRID.RightsManagementWarnErrorConfigurationError; } break; case RightsManagementFailureCode.InvalidLicenseSignature: if (operation == RightsManagementOperation.Initialize) { result = SRID.RightsManagementWarnErrorConfigurationError; } else { result = SRID.RightsManagementWarnErrorInvalidContent; } break; case RightsManagementFailureCode.RightNotGranted: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.InvalidVersion: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.ClockRollbackDetected: result = SRID.RightsManagementWarnErrorClockModified; break; case RightsManagementFailureCode.BindValidityTimeViolated: result = SRID.RightsManagementWarnErrorExpiredPermission; break; case RightsManagementFailureCode.BrokenCertChain: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.BindPolicyViolation: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.ManifestPolicyViolation: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.BindRevokedLicense: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindRevokedIssuer: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindRevokedPrincipal: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindRevokedResource: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindRevokedModule: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.BindAccessUnsatisfied: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindMachineNotFoundInGroupIdentity: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.BindRevocationListStale: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.BindNoApplicableRevocationList: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.LicenseAcquisitionFailed: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.NoDistributionPointUrlFound: result = SRID.RightsManagementWarnErrorInvalidContent; break; case RightsManagementFailureCode.NoConnect: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.ActivationFailed: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.Aborted: fatal = (operation != RightsManagementOperation.PassportActivation); break; case RightsManagementFailureCode.OutOfQuota: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.AuthenticationFailed: fatal = false; break; case RightsManagementFailureCode.ServerError: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.HidCorrupted: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.InvalidServerResponse: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.ServiceNotFound: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.UseDefault: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.ServerNotFound: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.InvalidEmail: fatal = false; break; case RightsManagementFailureCode.ValidityTimeViolation: result = SRID.RightsManagementWarnErrorExpiredPermission; break; case RightsManagementFailureCode.OutdatedModule: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.ServiceMoved: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.ServiceGone: result = SRID.RightsManagementWarnErrorServerError; break; case RightsManagementFailureCode.AdEntryNotFound: fatal = false; break; case RightsManagementFailureCode.NotAChain: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.RequestDenied: result = SRID.RightsManagementWarnErrorTemporaryActivationNotSupported; fatal = false; break; case RightsManagementFailureCode.LicenseBindingToWindowsIdentityFailed: result = SRID.RightsManagementWarnErrorNoPermission; askUser = true; break; case RightsManagementFailureCode.InvalidIssuanceLicenseTemplate: result = SRID.RightsManagementWarnErrorInvalidTemplate; fatal = false; break; case RightsManagementFailureCode.ExpiredOfficialIssuanceLicenseTemplate: result = SRID.RightsManagementWarnErrorInvalidTemplate; fatal = false; break; case RightsManagementFailureCode.InvalidClientLicensorCertificate: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.HidInvalid: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.EmailNotVerified: fatal = false; break; case RightsManagementFailureCode.DebuggerDetected: result = SRID.RightsManagementWarnErrorDebuggerDetected; break; case RightsManagementFailureCode.InvalidLockboxType: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.InvalidLockboxPath: result = SRID.RightsManagementWarnErrorConfigurationError; break; case RightsManagementFailureCode.NoAesCryptoProvider: result = SRID.RightsManagementWarnErrorConfigurationError; break; default: return(null); } if (result == null) { return(null); } else { return(SR.Get(result)); } }
private static void AcquireCertificationMexCallback(ICancelableAsyncResult asyncResult) { RmsServerInfoManager.Tracer.TraceDebug(0L, "AcquireCertificationMexCallback invoked"); ArgumentValidator.ThrowIfNull("asyncResult", asyncResult); ArgumentValidator.ThrowIfNull("asyncResult.AsyncState", asyncResult.AsyncState); AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = asyncResult.AsyncState as AcquireServerInfoAsyncResult; if (acquireServerInfoAsyncResult == null) { throw new InvalidOperationException("asyncResult.AsyncState has to be type of AcquireServerInfoAsyncResult."); } acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.AcquireCertificationMexCallback); Exception ex = null; try { DownloadResult downloadResult = acquireServerInfoAsyncResult.HttpClient.EndDownload(asyncResult); acquireServerInfoAsyncResult.LatencyTracker.EndTrackRmsLatency(RmsOperationType.AcquireCertificationMexData); if (downloadResult.IsSucceeded) { Uri targetUriFromResponse = RmsClientManagerUtils.GetTargetUriFromResponse(downloadResult.ResponseStream); if (targetUriFromResponse == null) { ex = new RightsManagementException(RightsManagementFailureCode.FailedToExtractTargetUriFromMex, ServerStrings.FailedToFindTargetUriFromMExData(acquireServerInfoAsyncResult.CertificationMExUri), acquireServerInfoAsyncResult.LicenseUri.ToString()); } else { acquireServerInfoAsyncResult.ServerInfo.CertificationWSTargetUri = TokenTarget.Fix(targetUriFromResponse); acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginDownloadServerLicensingMexData); WebProxy localServerProxy; try { localServerProxy = RmsClientManagerUtils.GetLocalServerProxy(true); } catch (ExchangeConfigurationException ex2) { ex = ex2; return; } HttpSessionConfig httpSessionConfig = new HttpSessionConfig(); if (localServerProxy != null) { httpSessionConfig.Proxy = localServerProxy; } acquireServerInfoAsyncResult.LatencyTracker.BeginTrackRmsLatency(RmsOperationType.AcquireServerLicensingMexData); acquireServerInfoAsyncResult.HttpClient.BeginDownload(acquireServerInfoAsyncResult.ServerLicensingMExUri, httpSessionConfig, RmsClientManagerUtils.WrapCancellableCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(new CancelableAsyncCallback(RmsServerInfoManager.AcquireServerLicensingMexCallback)), acquireServerInfoAsyncResult); } } else { RmsClientManager.TraceFail(null, acquireServerInfoAsyncResult.Context.SystemProbeId, "Failed to download data from certification MEx {0}. Exception is {1}", new object[] { acquireServerInfoAsyncResult.CertificationMExUri, downloadResult.Exception }); ex = new RightsManagementException(RightsManagementFailureCode.FailedToDownloadMexData, ServerStrings.FailedToDownloadCertificationMExData(downloadResult.ResponseUri), downloadResult.Exception, acquireServerInfoAsyncResult.LicenseUri.ToString()); ((RightsManagementException)ex).IsPermanent = !downloadResult.IsRetryable; } } finally { if (ex != null) { acquireServerInfoAsyncResult.Release(); RmsServerInfoManager.Tracer.TraceDebug(0L, "AcquireServiceLocationCallback: Invoking find service location callbacks"); RmsServerInfoManager.outstandingFindServiceLocationCalls.InvokeCallbacks(acquireServerInfoAsyncResult.LicenseUri, ex); } } }
private static void AcquireServiceLocationCallback(IAsyncResult asyncResult) { RmsServerInfoManager.Tracer.TraceDebug(0L, "AcquireServiceLocationCallback invoked"); ArgumentValidator.ThrowIfNull("asyncResult", asyncResult); ArgumentValidator.ThrowIfNull("asyncResult.AsyncState", asyncResult.AsyncState); AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = asyncResult.AsyncState as AcquireServerInfoAsyncResult; if (acquireServerInfoAsyncResult == null) { throw new InvalidOperationException("asyncResult.AsyncState has to be type of AcquireServerInfoAsyncResult."); } acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.AcquireServiceLocationCallback); Exception ex = null; try { acquireServerInfoAsyncResult.ServiceLocationResponses = acquireServerInfoAsyncResult.ServerWSManager.EndFindServiceLocations(asyncResult); LocalizedString value; if (!RmsServerInfoManager.ValidateResponsesAndUpdateServerInfo(acquireServerInfoAsyncResult, out value)) { ex = new RightsManagementException(RightsManagementFailureCode.FindServiceLocationFailed, ServerStrings.ValidationForServiceLocationResponseFailed(acquireServerInfoAsyncResult.LicenseUri, value)); } else { HttpSessionConfig httpSessionConfig = new HttpSessionConfig(); WebProxy localServerProxy = RmsClientManagerUtils.GetLocalServerProxy(true); if (localServerProxy != null) { httpSessionConfig.Proxy = localServerProxy; } acquireServerInfoAsyncResult.HttpClient = new HttpClient(); acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginDownloadCertificationMexData); acquireServerInfoAsyncResult.LatencyTracker.BeginTrackRmsLatency(RmsOperationType.AcquireCertificationMexData); acquireServerInfoAsyncResult.HttpClient.BeginDownload(acquireServerInfoAsyncResult.CertificationMExUri, httpSessionConfig, RmsClientManagerUtils.WrapCancellableCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(new CancelableAsyncCallback(RmsServerInfoManager.AcquireCertificationMexCallback)), acquireServerInfoAsyncResult); } } catch (RightsManagementException ex2) { RmsClientManager.TraceFail(null, acquireServerInfoAsyncResult.Context.SystemProbeId, "Hit an exception during AcquireServiceLocationCallback {0}", new object[] { ex2 }); ex = ex2; } catch (ExchangeConfigurationException ex3) { RmsClientManager.TraceFail(null, acquireServerInfoAsyncResult.Context.SystemProbeId, "Hit an exception during AcquireServiceLocationCallback {0}", new object[] { ex3 }); ex = ex3; } finally { if (ex != null) { acquireServerInfoAsyncResult.Release(); RmsServerInfoManager.Tracer.TraceError(0L, "AcquireServiceLocationCallback: Invoking find service location callbacks"); RmsServerInfoManager.outstandingFindServiceLocationCalls.InvokeCallbacks(acquireServerInfoAsyncResult.LicenseUri, ex); } } }
private static SanitizedHtmlString GetIrmErrorDetails(UserContext userContext, RightsManagedMessageDecryptionStatus decryptionStatus) { if (userContext == null) { throw new ArgumentNullException("userContext"); } SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(); RightsManagementFailureCode failureCode = decryptionStatus.FailureCode; if (failureCode > RightsManagementFailureCode.PreLicenseAcquisitionFailed) { switch (failureCode) { case RightsManagementFailureCode.FailedToExtractTargetUriFromMex: case RightsManagementFailureCode.FailedToDownloadMexData: sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-843834599)); goto IL_308; case RightsManagementFailureCode.GetServerInfoFailed: goto IL_19E; case RightsManagementFailureCode.InternalLicensingDisabled: break; case RightsManagementFailureCode.ExternalLicensingDisabled: sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-641698444), new object[] { WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture) }); goto IL_308; default: switch (failureCode) { case RightsManagementFailureCode.ServerRightNotGranted: sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-271360565)); goto IL_308; case RightsManagementFailureCode.InvalidLicensee: goto IL_189; case RightsManagementFailureCode.FeatureDisabled: break; case RightsManagementFailureCode.NotSupported: sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[] { WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture) }); goto IL_308; case RightsManagementFailureCode.CorruptData: sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-987520932)); goto IL_308; default: if (failureCode != RightsManagementFailureCode.Success) { goto IL_19E; } goto IL_308; } break; } sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[] { WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture) }); goto IL_308; } if (failureCode == RightsManagementFailureCode.UserRightNotGranted) { sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(149546568), new object[] { WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture) }); goto IL_308; } if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed) { goto IL_19E; } IL_189: sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-492186842)); goto IL_308; IL_19E: sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-624237727)); Exception exception = decryptionStatus.Exception; if (Globals.ShowDebugInformation && exception != null && exception.InnerException != null) { StringBuilder stringBuilder = new StringBuilder(); userContext.RenderThemeImage(stringBuilder, ThemeFileId.Expand, string.Empty, new object[0]); sanitizingStringBuilder.AppendFormat("<div onclick=\"document.getElementById('divDtls').style.display='';this.style.display='none';adjHght();\" style=\"cursor: pointer; color: #3165cd;\">" + stringBuilder.ToString() + " {0}</div><div id=\"divDtls\" style='display:none'>", new object[] { LocalizedStrings.GetNonEncoded(-610047827) }); string text = string.Empty; RightsManagementFailureCode failureCode2 = decryptionStatus.FailureCode; Exception innerException = exception.InnerException; if (innerException is RightsManagementException) { RightsManagementException ex = (RightsManagementException)innerException; text = ex.RmsUrl; } int num = 0; while (num < 10 && innerException.InnerException != null) { innerException = innerException.InnerException; num++; } sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253), new object[] { innerException.Message }); if (!string.IsNullOrEmpty(text)) { sanitizingStringBuilder.Append("<br>"); sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(2115316283), new object[] { text }); } if (failureCode2 != RightsManagementFailureCode.Success) { sanitizingStringBuilder.Append("<br>"); sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(970140031), new object[] { failureCode2 }); } sanitizingStringBuilder.Append("</div>"); } IL_308: return(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>()); }
private void HandleRightsManagementException(RightsManagementException e, OwaStoreObjectId messageId, string correlator) { RightsManagementFailureCode failureCode = e.FailureCode; if (failureCode <= RightsManagementFailureCode.PreLicenseAcquisitionFailed) { if (failureCode == RightsManagementFailureCode.UserRightNotGranted) { this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1796455575, this.userCulture), new object[] { string.Empty }), correlator); return; } if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed) { goto IL_15E; } } else { switch (failureCode) { case RightsManagementFailureCode.FailedToExtractTargetUriFromMex: case RightsManagementFailureCode.FailedToDownloadMexData: this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(1314141112, this.userCulture), correlator); return; case RightsManagementFailureCode.GetServerInfoFailed: goto IL_15E; case RightsManagementFailureCode.InternalLicensingDisabled: this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714, this.userCulture), new object[] { Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture) }), correlator); return; case RightsManagementFailureCode.ExternalLicensingDisabled: this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1397740097, this.userCulture), new object[] { Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture) }), correlator); return; default: switch (failureCode) { case RightsManagementFailureCode.ServerRightNotGranted: this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(784482022, this.userCulture), new object[] { string.Empty }), correlator); return; case RightsManagementFailureCode.InvalidLicensee: break; default: goto IL_15E; } break; } } this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(-1489754529, this.userCulture), correlator); return; IL_15E: SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(LocalizedStrings.GetNonEncoded(360598592)); sanitizingStringBuilder.Append("<br>"); sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253, this.userCulture), new object[] { e.Message }); this.EnqueueLicensingError(messageId, sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(), correlator); }