コード例 #1
0
        public void GetAttachmentExtension()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ReadVoiceMessageEventHandler.GetAttachmentExtension");
            OwaStoreObjectId         owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
            Item                     item             = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, new PropertyDefinition[0]);
            Exception                ex = null;
            RightsManagedMessageItem rightsManagedMessageItem = item as RightsManagedMessageItem;

            if (rightsManagedMessageItem != null && rightsManagedMessageItem.IsRestricted && base.UserContext.IsIrmEnabled)
            {
                try
                {
                    rightsManagedMessageItem.Decode(Utilities.CreateOutboundConversionOptions(base.UserContext), true);
                }
                catch (RightsManagementPermanentException ex2)
                {
                    ex = ex2;
                }
                catch (RightsManagementTransientException ex3)
                {
                    ex = ex3;
                }
            }
            if (ex != null)
            {
                throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(756278106), LocalizedStrings.GetNonEncoded(-229902107), ex);
            }
            Attachment latestVoiceMailAttachment = Utilities.GetLatestVoiceMailAttachment(item, base.UserContext);

            if (latestVoiceMailAttachment != null)
            {
                string text = latestVoiceMailAttachment.FileExtension;
                if (text == null)
                {
                    text = string.Empty;
                }
                Utilities.HtmlEncode(text, this.Writer);
                return;
            }
            throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(756278106), LocalizedStrings.GetNonEncoded(-229902107));
        }
コード例 #2
0
        private ItemPartIrmInfo GetItemPartIrmInfo(IItem item)
        {
            RightsManagedMessageItem rightsManagedMessageItem = item as RightsManagedMessageItem;

            if (rightsManagedMessageItem == null || !rightsManagedMessageItem.IsRestricted)
            {
                return(ItemPartIrmInfo.NotRestricted);
            }
            ItemPartIrmInfo result = null;

            if (!this.canOpenIrmMessage || !rightsManagedMessageItem.CanDecode)
            {
                if (!this.canOpenIrmMessage)
                {
                    result = ItemPartIrmInfo.CreateForIrmDisabled();
                }
                else if (!rightsManagedMessageItem.CanDecode)
                {
                    result = ItemPartIrmInfo.CreateForUnsupportedScenario();
                }
            }
            else
            {
                try
                {
                    OutboundConversionOptions options = new OutboundConversionOptions(item.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), string.Empty);
                    rightsManagedMessageItem.Decode(options, true);
                    result = ItemPartIrmInfo.Create(rightsManagedMessageItem.UsageRights, rightsManagedMessageItem.Restriction.Name, rightsManagedMessageItem.Restriction.Description, rightsManagedMessageItem.ConversationOwner.EmailAddress, rightsManagedMessageItem.UserLicenseExpiryTime, rightsManagedMessageItem.Restriction.RequiresRepublishingWhenRecipientsChange, rightsManagedMessageItem.CanRepublish);
                }
                catch (RightsManagementPermanentException exception)
                {
                    result = ItemPartIrmInfo.CreateForDecryptionFailure(exception);
                }
                catch (RightsManagementTransientException exception2)
                {
                    result = ItemPartIrmInfo.CreateForDecryptionFailure(exception2);
                }
            }
            return(result);
        }
コード例 #3
0
        private bool IrmDecryptIfRestricted(Item item, UserContext userContext)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            RightsManagedMessageItem rightsManagedMessageItem = item as RightsManagedMessageItem;

            if (rightsManagedMessageItem != null && rightsManagedMessageItem.IsRestricted)
            {
                if (!rightsManagedMessageItem.IsDecoded)
                {
                    rightsManagedMessageItem.Decode(this.CreateOutboundConversionOptions(userContext), true);
                }
                return(true);
            }
            return(false);
        }
コード例 #4
0
        // Token: 0x06000C4C RID: 3148 RVA: 0x00040FE8 File Offset: 0x0003F1E8
        private void IrmRemoveRestriction(Item item)
        {
            if (!Command.CurrentCommand.Context.User.IrmEnabled || !Command.CurrentCommand.Context.Request.IsSecureConnection)
            {
                AirSyncDiagnostics.TraceError <string, bool, bool>(ExTraceGlobals.RequestsTracer, null, "User {0} is not IrmEnabled or the client access server is not IrmEnabled or request received over non SSL. IrmEnabled: {1}, SSLConnection: {2}.", Command.CurrentCommand.Context.User.DisplayName, Command.CurrentCommand.Context.User.IrmEnabled, Command.CurrentCommand.Context.Request.IsSecureConnection);
                throw new AirSyncPermanentException(StatusCode.IRM_FeatureDisabled, false)
                      {
                          ErrorStringForProtocolLogger = "RemoveRestrictionFeatureDisabled"
                      };
            }
            if (AirSyncUtility.IsProtectedVoicemailItem(item))
            {
                AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestsTracer, null, "User {0} called remove restrictions on protected voice mail - not supported", Command.CurrentCommand.Context.User.DisplayName);
                throw new AirSyncPermanentException(StatusCode.IRM_OperationNotPermitted, false)
                      {
                          ErrorStringForProtocolLogger = "RemoveRestrictionOnProtectedVoicemail"
                      };
            }
            RightsManagedMessageItem rightsManagedMessageItem = item as RightsManagedMessageItem;

            if (rightsManagedMessageItem == null)
            {
                AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestsTracer, null, "User {0} called remove restrictions on non IRM message", Command.CurrentCommand.Context.User.DisplayName);
                throw new AirSyncPermanentException(StatusCode.IRM_OperationNotPermitted, false)
                      {
                          ErrorStringForProtocolLogger = "RemoveRestrictionOnNonIRMMessage"
                      };
            }
            rightsManagedMessageItem.OpenAsReadWrite();
            RightsManagedMessageDecryptionStatus rightsManagedMessageDecryptionStatus = RightsManagedMessageDecryptionStatus.Success;

            try
            {
                rightsManagedMessageItem.Decode(AirSyncUtility.GetOutboundConversionOptions(), true);
            }
            catch (RightsManagementPermanentException exception)
            {
                rightsManagedMessageDecryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception);
            }
            catch (RightsManagementTransientException exception2)
            {
                rightsManagedMessageDecryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception2);
            }
            if (rightsManagedMessageDecryptionStatus.Failed)
            {
                AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestsTracer, null, "Failed to decode item : {0}", rightsManagedMessageDecryptionStatus.FailureCode.ToString());
                throw new AirSyncPermanentException(StatusCode.IRM_PermanentError, rightsManagedMessageDecryptionStatus.Exception, false)
                      {
                          ErrorStringForProtocolLogger = "RemoveRestrictionDecodeFailed"
                      };
            }
            try
            {
                rightsManagedMessageItem.SetRestriction(null);
            }
            catch (RightsManagementPermanentException ex)
            {
                if (ex.FailureCode == RightsManagementFailureCode.UserRightNotGranted)
                {
                    AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestsTracer, null, "Failed to remove restrictions on item : {0}", ex.ToString());
                    throw new AirSyncPermanentException(StatusCode.IRM_OperationNotPermitted, ex, false)
                          {
                              ErrorStringForProtocolLogger = "RemoveRestrictionRightNotGranted"
                          };
                }
                throw;
            }
            ConflictResolutionResult conflictResolutionResult = rightsManagedMessageItem.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "Failed to remove restrictions on item because of conflicts");
                throw new AirSyncPermanentException(StatusCode.IRM_PermanentError, false)
                      {
                          ErrorStringForProtocolLogger = "RemoveRestrictionConflict"
                      };
            }
            item.Load();
        }
コード例 #5
0
        // Token: 0x06001568 RID: 5480 RVA: 0x0007DFC4 File Offset: 0x0007C1C4
        protected SendMailBase.IrmAction GetIrmAction(SendMailBase.GetIrmActionCallback irmActionDelegate, ref Item smartItem, out RmsTemplate rmsTemplate)
        {
            if (irmActionDelegate == null)
            {
                throw new ArgumentNullException("irmActionDelegate");
            }
            if (smartItem == null)
            {
                throw new ArgumentNullException("smartItem");
            }
            SendMailBase.IrmAction irmAction = SendMailBase.IrmAction.None;
            rmsTemplate = null;
            Guid guid;

            if (this.IsIrmOperation(out guid))
            {
                RightsManagedMessageItem rightsManagedMessageItem = smartItem as RightsManagedMessageItem;
                if (rightsManagedMessageItem != null)
                {
                    if (!rightsManagedMessageItem.IsRestricted || !rightsManagedMessageItem.CanDecode)
                    {
                        AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, this, "Either the original IRM message was not properly formatted or it could not be decoded");
                        throw new AirSyncPermanentException(StatusCode.IRM_OperationNotPermitted, false)
                              {
                                  ErrorStringForProtocolLogger = "smbGiaOperationNotPermitted"
                              };
                    }
                    rightsManagedMessageItem.Decode(AirSyncUtility.GetOutboundConversionOptions(), true);
                    irmActionDelegate(rightsManagedMessageItem);
                    irmAction = SendMailBase.GetIrmActionForReplyForward(rightsManagedMessageItem.UsageRights, this.ReplaceMime, rightsManagedMessageItem.Restriction.Id == guid);
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "GetIrmActionForReplyForward: originalMessageRights={0}; originalTemplate={1}; newTemplate={2}; irmAction={3}", new object[]
                    {
                        rightsManagedMessageItem.UsageRights,
                        rightsManagedMessageItem.Restriction.Id,
                        guid,
                        irmAction
                    });
                    if (irmAction == SendMailBase.IrmAction.CreateNewPublishingLicense || irmAction == SendMailBase.IrmAction.CreateNewPublishingLicenseAttachOriginalMessage)
                    {
                        smartItem.Dispose();
                        smartItem = this.GetSmartItem();
                    }
                }
                else
                {
                    irmAction = SendMailBase.IrmAction.CreateNewPublishingLicense;
                }
                if (irmAction == SendMailBase.IrmAction.None)
                {
                    throw new InvalidOperationException("irmAction should not be None here.");
                }
                if (irmAction != SendMailBase.IrmAction.ReusePublishingLicense && irmAction != SendMailBase.IrmAction.ReusePublishingLicenseInlineOriginalBody && guid != Guid.Empty)
                {
                    rmsTemplate = RmsTemplateReaderCache.LookupRmsTemplate(base.User.OrganizationId, guid);
                    if (rmsTemplate == null)
                    {
                        AirSyncDiagnostics.TraceError <Guid>(ExTraceGlobals.RequestsTracer, this, "Template {0} not found in cache", guid);
                        throw new AirSyncPermanentException(StatusCode.IRM_InvalidTemplateID, false)
                              {
                                  ErrorStringForProtocolLogger = "smbGiaInvalidTemplateID"
                              };
                    }
                }
            }
            if ((irmAction == SendMailBase.IrmAction.ReusePublishingLicense && !this.ReplaceMime) || ((irmAction == SendMailBase.IrmAction.CreateNewPublishingLicenseInlineOriginalBody || irmAction == SendMailBase.IrmAction.ReusePublishingLicenseInlineOriginalBody || irmAction == SendMailBase.IrmAction.CreateNewPublishingLicenseAttachOriginalMessage) && this.ReplaceMime))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "irmAction = {0}, ReplaceMime = {1}", new object[]
                {
                    irmAction,
                    this.ReplaceMime
                }));
            }
            return(irmAction);
        }