// Token: 0x06000807 RID: 2055 RVA: 0x0001A9F0 File Offset: 0x00018BF0
        private static SortedDictionary <string, AttachmentPolicyLevel> LoadDictionary(string[] block, string[] forceSave, string[] allow)
        {
            string[][] array = new string[3][];
            AttachmentPolicyLevel[] array2 = new AttachmentPolicyLevel[3];
            array[1]  = block;
            array[2]  = forceSave;
            array[0]  = allow;
            array2[1] = AttachmentPolicyLevel.Block;
            array2[2] = AttachmentPolicyLevel.ForceSave;
            array2[0] = AttachmentPolicyLevel.Allow;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] == null)
                {
                    array[i] = new string[0];
                }
            }
            SortedDictionary <string, AttachmentPolicyLevel> sortedDictionary = new SortedDictionary <string, AttachmentPolicyLevel>(StringComparer.OrdinalIgnoreCase);

            for (int j = 0; j <= 2; j++)
            {
                for (int k = 0; k < array[j].Length; k++)
                {
                    string key = array[j][k];
                    if (!sortedDictionary.ContainsKey(key))
                    {
                        sortedDictionary.Add(key, array2[j]);
                    }
                }
            }
            return(sortedDictionary);
        }
        internal static PolicyConfiguration CreatePolicyConfigurationFromOwaMailboxPolicy(OwaMailboxPolicy owaMailboxPolicy)
        {
            if (owaMailboxPolicy == null)
            {
                return(null);
            }
            PolicyConfiguration   policyConfiguration = new PolicyConfiguration();
            AttachmentPolicyLevel treatUnknownTypeAs  = ConfigurationBase.AttachmentActionToPolicyLevel(new AttachmentBlockingActions?(owaMailboxPolicy.ActionForUnknownFileAndMIMETypes));
            AttachmentPolicy      attachmentPolicy    = new AttachmentPolicy(owaMailboxPolicy.BlockedFileTypes.ToArray(), owaMailboxPolicy.BlockedMimeTypes.ToArray(), owaMailboxPolicy.ForceSaveFileTypes.ToArray(), owaMailboxPolicy.ForceSaveMimeTypes.ToArray(), owaMailboxPolicy.AllowedFileTypes.ToArray(), owaMailboxPolicy.AllowedMimeTypes.ToArray(), treatUnknownTypeAs, owaMailboxPolicy.DirectFileAccessOnPublicComputersEnabled, owaMailboxPolicy.DirectFileAccessOnPrivateComputersEnabled, owaMailboxPolicy.ForceWacViewingFirstOnPublicComputers, owaMailboxPolicy.ForceWacViewingFirstOnPrivateComputers, owaMailboxPolicy.WacViewingOnPublicComputersEnabled, owaMailboxPolicy.WacViewingOnPrivateComputersEnabled, owaMailboxPolicy.ForceWebReadyDocumentViewingFirstOnPublicComputers, owaMailboxPolicy.ForceWebReadyDocumentViewingFirstOnPrivateComputers, owaMailboxPolicy.WebReadyDocumentViewingOnPublicComputersEnabled, owaMailboxPolicy.WebReadyDocumentViewingOnPrivateComputersEnabled, owaMailboxPolicy.WebReadyFileTypes.ToArray(), owaMailboxPolicy.WebReadyMimeTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingSupportedFileTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingSupportedMimeTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingForAllSupportedTypes);

            policyConfiguration.AttachmentPolicy = attachmentPolicy;
            int segmentationBits  = (int)owaMailboxPolicy[OwaMailboxPolicySchema.ADMailboxFolderSet];
            int segmentationBits2 = (int)owaMailboxPolicy[OwaMailboxPolicySchema.ADMailboxFolderSet2];

            policyConfiguration.SegmentationFlags    = ConfigurationBase.SetSegmentationFlags(segmentationBits, segmentationBits2);
            policyConfiguration.OutboundCharset      = owaMailboxPolicy.OutboundCharset;
            policyConfiguration.UseGB18030           = owaMailboxPolicy.UseGB18030;
            policyConfiguration.UseISO885915         = owaMailboxPolicy.UseISO885915;
            policyConfiguration.InstantMessagingType = ((owaMailboxPolicy.InstantMessagingType != null) ? owaMailboxPolicy.InstantMessagingType.Value : InstantMessagingTypeOptions.None);
            policyConfiguration.DefaultTheme         = owaMailboxPolicy.DefaultTheme;
            policyConfiguration.PlacesEnabled        = owaMailboxPolicy.PlacesEnabled;
            policyConfiguration.WeatherEnabled       = owaMailboxPolicy.WeatherEnabled;
            policyConfiguration.AllowCopyContactsToDeviceAddressBook = owaMailboxPolicy.AllowCopyContactsToDeviceAddressBook;
            policyConfiguration.AllowOfflineOn             = owaMailboxPolicy.AllowOfflineOn;
            policyConfiguration.RecoverDeletedItemsEnabled = owaMailboxPolicy.RecoverDeletedItemsEnabled;
            policyConfiguration.GroupCreationEnabled       = owaMailboxPolicy.GroupCreationEnabled;
            return(policyConfiguration);
        }
Example #3
0
        public AttachmentPolicyLevel GetPolicy(IAttachment attachment, bool isPublicLogin)
        {
            AttachmentPolicyLevel attachmentPolicyLevel  = AttachmentPolicyLevel.Unknown;
            AttachmentPolicyLevel attachmentPolicyLevel2 = AttachmentPolicyLevel.Unknown;
            string fileExtension           = attachment.FileExtension;
            string text                    = attachment.ContentType ?? attachment.CalculatedContentType;
            bool   directFileAccessEnabled = this.policy.GetDirectFileAccessEnabled(isPublicLogin);

            if (text == null || !directFileAccessEnabled)
            {
                return(AttachmentPolicyLevel.Block);
            }
            if (!string.IsNullOrEmpty(fileExtension))
            {
                attachmentPolicyLevel2 = this.policy.GetLevel(fileExtension, AttachmentPolicy.TypeSignifier.File);
            }
            if (!string.IsNullOrEmpty(text))
            {
                attachmentPolicyLevel = this.policy.GetLevel(text, AttachmentPolicy.TypeSignifier.Mime);
            }
            if (attachmentPolicyLevel2 == AttachmentPolicyLevel.Allow || attachmentPolicyLevel == AttachmentPolicyLevel.Allow)
            {
                return(AttachmentPolicyLevel.Allow);
            }
            if (attachmentPolicyLevel2 == AttachmentPolicyLevel.Block || attachmentPolicyLevel == AttachmentPolicyLevel.Block)
            {
                return(AttachmentPolicyLevel.Block);
            }
            if (attachmentPolicyLevel2 == AttachmentPolicyLevel.ForceSave || attachmentPolicyLevel == AttachmentPolicyLevel.ForceSave)
            {
                return(AttachmentPolicyLevel.ForceSave);
            }
            return(this.policy.TreatUnknownTypeAs);
        }
Example #4
0
        // Token: 0x06000332 RID: 818 RVA: 0x0000CA34 File Offset: 0x0000AC34
        public void AddAttachmentToZip(Attachment attachment, AttachmentPolicyLevel policyLevel, ConfigurationContextBase configurationContextBase)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }
            if (configurationContextBase == null)
            {
                throw new ArgumentNullException("configurationContextBase");
            }
            if (attachment.AttachmentType == AttachmentType.EmbeddedMessage)
            {
                this.hasEmbeddedItem = true;
            }
            string contentType        = AttachmentUtilities.GetContentType(attachment);
            string fileExtension      = attachment.FileExtension;
            bool   doNeedToFilterHtml = AttachmentUtilities.NeedToFilterHtml(contentType, fileExtension, policyLevel, configurationContextBase);
            bool   isNotHtmlandNotXml = !AttachmentUtilities.GetIsHtmlOrXml(contentType, fileExtension);
            bool   doNotSniff         = AttachmentUtilities.GetDoNotSniff(policyLevel, configurationContextBase);
            string text = string.IsNullOrEmpty(attachment.FileName) ? attachment.DisplayName : attachment.FileName;

            if (attachment.AttachmentType == AttachmentType.EmbeddedMessage)
            {
                text += fileExtension;
            }
            string text2 = this.ConditionZipEntryFileName(text);

            attachment.FileName = text2;
            ZipEntryAttachment value = new ZipEntryAttachment(text2, attachment, doNeedToFilterHtml, doNotSniff, isNotHtmlandNotXml);

            this.files.Add(text2, value);
        }
 // Token: 0x0600012B RID: 299 RVA: 0x000050B5 File Offset: 0x000032B5
 internal static bool GetDoNotSniff(AttachmentPolicyLevel level, ConfigurationContextBase configurationContext)
 {
     if (configurationContext == null)
     {
         throw new ArgumentNullException("configurationContext");
     }
     return(AttachmentPolicyLevel.ForceSave == level && !configurationContext.IsFeatureEnabled(Feature.ForceSaveAttachmentFiltering));
 }
 // Token: 0x0600010C RID: 268 RVA: 0x000047C5 File Offset: 0x000029C5
 private bool IsBlocked(AttachmentPolicyLevel policyLevel)
 {
     if (policyLevel == AttachmentPolicyLevel.Block)
     {
         ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Attachment is blocked because of policy level: id={0}", this.id);
         return(true);
     }
     return(false);
 }
        // Token: 0x06000802 RID: 2050 RVA: 0x0001A598 File Offset: 0x00018798
        internal AttachmentPolicyLevel GetLevel(string attachmentType, AttachmentPolicy.TypeSignifier typeSignifier)
        {
            AttachmentPolicyLevel result = AttachmentPolicyLevel.Unknown;

            switch (typeSignifier)
            {
            case AttachmentPolicy.TypeSignifier.File:
                result = AttachmentPolicy.FindLevel(this.fileTypeLevels, attachmentType);
                break;

            case AttachmentPolicy.TypeSignifier.Mime:
                result = AttachmentPolicy.FindLevel(this.mimeTypeLevels, attachmentType);
                break;
            }
            return(result);
        }
        // Token: 0x0600010A RID: 266 RVA: 0x00004630 File Offset: 0x00002830
        private void WriteResponseHeaders(string contentType, AttachmentPolicyLevel policyLevel, Attachment attachment)
        {
            if (policyLevel == AttachmentPolicyLevel.ForceSave)
            {
                this.webOperationContext.Headers["X-Download-Options"] = "noopen";
            }
            if (string.Compare(contentType, "text/html", StringComparison.OrdinalIgnoreCase) == 0)
            {
                attachment.IsInline = false;
            }
            this.webOperationContext.ContentType = contentType + "; authoritative=true;";
            this.WriteContentDispositionResponseHeader(attachment.FileName, attachment.IsInline);
            if (attachment.IsInline || this.IsImagePreview)
            {
                this.webOperationContext.SetNoCacheNoStore();
                return;
            }
            DateHeader dateHeader = new DateHeader("Date", DateTime.UtcNow.AddDays(-1.0));

            this.webOperationContext.Headers["Expires"] = dateHeader.Value;
        }
        // Token: 0x06000107 RID: 263 RVA: 0x000041B0 File Offset: 0x000023B0
        public Stream GetAttachmentStream(AttachmentHandler.IAttachmentRetriever attachmentRetriever, AttachmentHandler.IAttachmentPolicyChecker policyChecker, bool asDataUri)
        {
            ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "AttachmentHandler.GetAttachmentStream: Getting attachment stream for id={0}", this.id);
            if (string.IsNullOrEmpty(this.id))
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug((long)this.GetHashCode(), "Attachment id is empty or null. returning null stream.");
                throw new FaultException("Id cannot be null or empty.");
            }
            Stream      stream      = null;
            ByteEncoder byteEncoder = null;
            Stream      stream2     = null;
            Stream      result;

            try
            {
                Attachment            attachment = attachmentRetriever.Attachment;
                AttachmentPolicyLevel policy     = policyChecker.GetPolicy(attachment, this.webOperationContext.IsPublicLogon);
                if (AudioFile.IsProtectedVoiceAttachment(attachment.FileName))
                {
                    attachment.ContentType = Utils.GetUnProtectedVoiceAttachmentContentType(attachment.FileName);
                    stream = DRMUtils.OpenProtectedAttachment(attachment, this.callContext.AccessingADUser.OrganizationId);
                    string fileName;
                    if (AudioFile.TryGetNonDRMFileNameFromDRM(attachment.FileName, out fileName))
                    {
                        attachment.FileName = fileName;
                    }
                }
                string        text          = AttachmentUtilities.GetContentType(attachment);
                string        fileExtension = attachment.FileExtension;
                OleAttachment oleAttachment = attachment as OleAttachment;
                if (oleAttachment != null)
                {
                    stream = oleAttachment.ConvertToImage(ImageFormat.Jpeg);
                    if (stream != null)
                    {
                        text = "image/jpeg";
                    }
                }
                if (this.IsBlocked(policy) && !attachment.IsInline && !this.IsImagePreview)
                {
                    ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Attachment is blocked. Returning null stream. id is {0}", this.id);
                    result = null;
                }
                else
                {
                    this.WriteResponseHeaders(text, policy, attachment);
                    if (stream == null)
                    {
                        StreamAttachment streamAttachment = attachment as StreamAttachment;
                        if (streamAttachment != null)
                        {
                            if (string.Equals(text, "audio/mpeg", StringComparison.OrdinalIgnoreCase))
                            {
                                stream = streamAttachment.GetContentStream(PropertyOpenMode.Modify);
                            }
                            else
                            {
                                stream = streamAttachment.GetContentStream(PropertyOpenMode.ReadOnly);
                            }
                        }
                        else
                        {
                            ItemAttachment itemAttachment = attachment as ItemAttachment;
                            if (itemAttachment != null)
                            {
                                using (Item item = itemAttachment.GetItem(StoreObjectSchema.ContentConversionProperties))
                                {
                                    IRecipientSession         adrecipientSession        = item.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
                                    OutboundConversionOptions outboundConversionOptions = new OutboundConversionOptions(this.callContext.DefaultDomain.DomainName.Domain);
                                    outboundConversionOptions.ClearCategories = false;
                                    outboundConversionOptions.UserADSession   = adrecipientSession;
                                    outboundConversionOptions.LoadPerOrganizationCharsetDetectionOptions(adrecipientSession.SessionSettings.CurrentOrganizationId);
                                    stream = new MemoryStream();
                                    ItemConversion.ConvertItemToMime(item, stream, outboundConversionOptions);
                                    stream.Seek(0L, SeekOrigin.Begin);
                                }
                            }
                        }
                    }
                    long num  = 0L;
                    long num2 = 0L;
                    if (AttachmentUtilities.NeedToFilterHtml(text, fileExtension, policy, this.configurationContext))
                    {
                        stream = AttachmentUtilities.GetFilteredStream(this.configurationContext, stream, attachment.TextCharset, attachmentRetriever.BlockStatus);
                    }
                    else if (this.NeedToSendPartialContent(stream, out num, out num2))
                    {
                        string value = string.Format(CultureInfo.InvariantCulture, "bytes {0}-{1}/{2}", new object[]
                        {
                            num,
                            num2,
                            stream.Length
                        });
                        this.webOperationContext.Headers["Accept-Ranges"] = "bytes";
                        this.webOperationContext.Headers["Content-Range"] = value;
                        this.webOperationContext.ETag       = this.id;
                        this.webOperationContext.StatusCode = HttpStatusCode.PartialContent;
                        long num3 = num2 - num + 1L;
                        if (num3 < stream.Length)
                        {
                            ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <long, long, long>((long)this.GetHashCode(), "RangeBytes:{0} - Seek:{1} - SetLength:{2}", num3, num, num2 + 1L);
                            stream.Seek(num, SeekOrigin.Begin);
                            return(new BoundedStream(stream, true, num, num2));
                        }
                    }
                    if (asDataUri)
                    {
                        byteEncoder = new Base64Encoder();
                        stream2     = new EncoderStream(stream, byteEncoder, EncoderStreamAccess.Read);
                        stream      = new DataUriStream(stream2, text);
                    }
                    result = stream;
                }
            }
            catch (Exception ex)
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
                if (stream2 != null)
                {
                    stream2.Dispose();
                }
                if (byteEncoder != null)
                {
                    byteEncoder.Dispose();
                }
                string formatString = string.Empty;
                if (ex is ExchangeDataException)
                {
                    formatString = "Fail to sanitize HTML getting attachment. id is {0}, Exception: {1}";
                }
                else if (ex is StoragePermanentException)
                {
                    formatString = "StoragePermanentException when getting attachment. id is {0}, Exception: {1}";
                }
                else
                {
                    if (!(ex is StorageTransientException))
                    {
                        throw;
                    }
                    formatString = "StorageTransientException when getting attachment. id is {0}, Exception: {1}";
                }
                ExTraceGlobals.AttachmentHandlingTracer.TraceError <string, Exception>((long)this.GetHashCode(), formatString, this.id, ex);
                throw new CannotOpenFileAttachmentException(ex);
            }
            return(result);
        }
        // Token: 0x0600010E RID: 270 RVA: 0x00004984 File Offset: 0x00002B84
        public Stream GetAllAttachmentsAsZipStream(AttachmentHandler.IAttachmentRetriever attachmentRetriever)
        {
            ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "AttachmentHandler.GetAttachmentStream: Getting attachment stream for id={0}", this.id);
            if (string.IsNullOrEmpty(this.id))
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug((long)this.GetHashCode(), "Item id is empty or null. returning null stream.");
                throw new FaultException("Id cannot be null or empty.");
            }
            Item rootItem = attachmentRetriever.RootItem;

            if (rootItem is ReportMessage || ObjectClass.IsSmsMessage(rootItem.ClassName))
            {
                return(null);
            }
            Stream stream = null;
            Stream result;

            try
            {
                AttachmentHandler.IAttachmentPolicyChecker attachmentPolicyChecker = AttachmentPolicyChecker.CreateInstance(this.configurationContext.AttachmentPolicy);
                AttachmentCollection attachmentCollection = IrmUtils.GetAttachmentCollection(rootItem);
                BlockStatus          itemBlockStatus      = AttachmentHandler.GetItemBlockStatus(rootItem);
                string             subject            = AttachmentHandler.GetSubject(rootItem);
                ZipFileAttachments zipFileAttachments = new ZipFileAttachments(itemBlockStatus, subject);
                foreach (AttachmentHandle handle in attachmentCollection)
                {
                    using (Attachment attachment = attachmentCollection.Open(handle))
                    {
                        if (attachment is OleAttachment || attachment.IsInline || attachment is ReferenceAttachment)
                        {
                            ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Attachment is inline, an ole image, or a reference attachment. Do not add to zip file.  id is {0}", attachment.Id.ToString());
                        }
                        else
                        {
                            AttachmentPolicyLevel policy = attachmentPolicyChecker.GetPolicy(attachment, this.webOperationContext.IsPublicLogon);
                            if (this.IsBlocked(policy))
                            {
                                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Attachment is blocked. Do not add to zip file.  id is {0}", attachment.Id.ToString());
                            }
                            else
                            {
                                zipFileAttachments.AddAttachmentToZip(attachment, policy, this.configurationContext);
                            }
                        }
                    }
                }
                if (zipFileAttachments.Count == 0)
                {
                    ExTraceGlobals.AttachmentHandlingTracer.TraceDebug((long)this.GetHashCode(), "AttachmentHandler.GetAllAttachmentsAsZipStream: No attachments returned for item");
                    result = null;
                }
                else
                {
                    IRecipientSession         adrecipientSession        = rootItem.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
                    OutboundConversionOptions outboundConversionOptions = new OutboundConversionOptions(this.callContext.DefaultDomain.DomainName.Domain);
                    outboundConversionOptions.ClearCategories = false;
                    outboundConversionOptions.UserADSession   = adrecipientSession;
                    outboundConversionOptions.LoadPerOrganizationCharsetDetectionOptions(adrecipientSession.SessionSettings.CurrentOrganizationId);
                    stream = zipFileAttachments.WriteArchive(this.configurationContext, this.webOperationContext, outboundConversionOptions, attachmentCollection);
                    stream.Seek(0L, SeekOrigin.Begin);
                    result = stream;
                }
            }
            catch (Exception ex)
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
                string formatString = string.Empty;
                if (ex is ExchangeDataException)
                {
                    formatString = "Fail to sanitize HTML getting attachment. id is {0}, Exception: {1}";
                }
                else if (ex is StoragePermanentException)
                {
                    formatString = "StoragePermanentException when getting attachment. id is {0}, Exception: {1}";
                }
                else
                {
                    if (!(ex is StorageTransientException))
                    {
                        throw;
                    }
                    formatString = "StorageTransientException when getting attachment. id is {0}, Exception: {1}";
                }
                ExTraceGlobals.AttachmentHandlingTracer.TraceError <string, Exception>((long)this.GetHashCode(), formatString, this.id, ex);
                throw new CannotOpenFileAttachmentException(ex);
            }
            return(result);
        }
        // Token: 0x0600012A RID: 298 RVA: 0x00005080 File Offset: 0x00003280
        internal static bool NeedToFilterHtml(string contentType, string fileExtension, AttachmentPolicyLevel level, ConfigurationContextBase configurationContext)
        {
            bool flag  = AttachmentUtilities.IsHtmlAttachment(contentType, fileExtension);
            bool flag2 = AttachmentPolicyLevel.ForceSave == level;
            bool flag3 = configurationContext.IsFeatureEnabled(Feature.ForceSaveAttachmentFiltering);

            return(flag && (!flag2 || flag3));
        }
 // Token: 0x060007FC RID: 2044 RVA: 0x0001A370 File Offset: 0x00018570
 internal AttachmentPolicy(string[] blockFileTypes, string[] blockMimeTypes, string[] forceSaveFileTypes, string[] forceSaveMimeTypes, string[] allowFileTypes, string[] allowMimeTypes, AttachmentPolicyLevel treatUnknownTypeAs, bool directFileAccessOnPublicComputersEnabled, bool directFileAccessOnPrivateComputersEnabled, bool forceWacViewingFirstOnPublicComputers, bool forceWacViewingFirstOnPrivateComputers, bool wacViewingOnPublicComputersEnabled, bool wacViewingOnPrivateComputersEnabled, bool forceWebReadyDocumentViewingFirstOnPublicComputers, bool forceWebReadyDocumentViewingFirstOnPrivateComputers, bool webReadyDocumentViewingOnPublicComputersEnabled, bool webReadyDocumentViewingOnPrivateComputersEnabled, string[] webReadyFileTypes, string[] webReadyMimeTypes, string[] webReadyDocumentViewingSupportedFileTypes, string[] webReadyDocumentViewingSupportedMimeTypes, bool webReadyDocumentViewingForAllSupportedTypes)
 {
     this.treatUnknownTypeAs = treatUnknownTypeAs;
     this.directFileAccessOnPublicComputersEnabled            = directFileAccessOnPublicComputersEnabled;
     this.directFileAccessOnPrivateComputersEnabled           = directFileAccessOnPrivateComputersEnabled;
     this.forceWacViewingFirstOnPublicComputers               = forceWacViewingFirstOnPublicComputers;
     this.forceWacViewingFirstOnPrivateComputers              = forceWacViewingFirstOnPrivateComputers;
     this.wacViewingOnPublicComputersEnabled                  = wacViewingOnPublicComputersEnabled;
     this.wacViewingOnPrivateComputersEnabled                 = wacViewingOnPrivateComputersEnabled;
     this.forceWebReadyDocumentViewingFirstOnPublicComputers  = forceWebReadyDocumentViewingFirstOnPublicComputers;
     this.forceWebReadyDocumentViewingFirstOnPrivateComputers = forceWebReadyDocumentViewingFirstOnPrivateComputers;
     this.webReadyDocumentViewingOnPublicComputersEnabled     = webReadyDocumentViewingOnPublicComputersEnabled;
     this.webReadyDocumentViewingOnPrivateComputersEnabled    = webReadyDocumentViewingOnPrivateComputersEnabled;
     this.webReadyDocumentViewingForAllSupportedTypes         = webReadyDocumentViewingForAllSupportedTypes;
     this.webReadyFileTypes = webReadyFileTypes;
     Array.Sort <string>(this.webReadyFileTypes);
     this.webReadyMimeTypes = webReadyMimeTypes;
     Array.Sort <string>(this.webReadyMimeTypes);
     this.webReadyDocumentViewingSupportedFileTypes = webReadyDocumentViewingSupportedFileTypes;
     Array.Sort <string>(this.webReadyDocumentViewingSupportedFileTypes);
     this.webReadyDocumentViewingSupportedMimeTypes = webReadyDocumentViewingSupportedMimeTypes;
     Array.Sort <string>(this.webReadyDocumentViewingSupportedMimeTypes);
     this.fileTypeLevels     = AttachmentPolicy.LoadDictionary(blockFileTypes, forceSaveFileTypes, allowFileTypes);
     this.mimeTypeLevels     = AttachmentPolicy.LoadDictionary(blockMimeTypes, forceSaveMimeTypes, allowMimeTypes);
     this.blockedFileTypes   = blockFileTypes;
     this.blockedMimeTypes   = blockMimeTypes;
     this.forceSaveFileTypes = forceSaveFileTypes;
     this.forceSaveMimeTypes = forceSaveMimeTypes;
     this.allowedFileTypes   = allowFileTypes;
     this.allowedMimeTypes   = allowMimeTypes;
     this.policyData         = new OwaAttachmentPolicyData
     {
         AllowFileTypes = this.allowedFileTypes,
         AllowMimeTypes = this.allowedMimeTypes,
         BlockFileTypes = this.blockedFileTypes,
         BlockMimeTypes = this.blockedMimeTypes,
         DirectFileAccessOnPrivateComputersEnabled = directFileAccessOnPrivateComputersEnabled,
         DirectFileAccessOnPublicComputersEnabled  = directFileAccessOnPublicComputersEnabled,
         ForceSaveFileTypes = forceSaveFileTypes,
         ForceSaveMimeTypes = forceSaveMimeTypes,
         ForceWacViewingFirstOnPrivateComputers = forceWacViewingFirstOnPrivateComputers,
         ForceWacViewingFirstOnPublicComputers  = forceWacViewingFirstOnPublicComputers,
         ForceWebReadyDocumentViewingFirstOnPrivateComputers = forceWebReadyDocumentViewingFirstOnPrivateComputers,
         ForceWebReadyDocumentViewingFirstOnPublicComputers  = forceWebReadyDocumentViewingFirstOnPublicComputers,
         TreatUnknownTypeAs = treatUnknownTypeAs.ToString(),
         WacViewingOnPrivateComputersEnabled              = wacViewingOnPrivateComputersEnabled,
         WacViewingOnPublicComputersEnabled               = wacViewingOnPublicComputersEnabled,
         WebReadyDocumentViewingForAllSupportedTypes      = webReadyDocumentViewingForAllSupportedTypes,
         WebReadyDocumentViewingOnPrivateComputersEnabled = webReadyDocumentViewingOnPrivateComputersEnabled,
         WebReadyDocumentViewingOnPublicComputersEnabled  = webReadyDocumentViewingOnPublicComputersEnabled,
         WebReadyDocumentViewingSupportedFileTypes        = webReadyDocumentViewingSupportedFileTypes,
         WebReadyDocumentViewingSupportedMimeTypes        = webReadyDocumentViewingSupportedMimeTypes,
         WebReadyFileTypes = webReadyFileTypes,
         WebReadyMimeTypes = webReadyMimeTypes
     };
 }
Example #13
0
        // Token: 0x0600095A RID: 2394 RVA: 0x0001FACC File Offset: 0x0001DCCC
        private VdirConfiguration(ITopologyConfigurationSession session, ADOwaVirtualDirectory owaVirtualDirectory)
        {
            AttachmentPolicyLevel treatUnknownTypeAs = ConfigurationBase.AttachmentActionToPolicyLevel(owaVirtualDirectory.ActionForUnknownFileAndMIMETypes);
            AttachmentPolicy      attachmentPolicy   = new AttachmentPolicy(owaVirtualDirectory.BlockedFileTypes.ToArray(), owaVirtualDirectory.BlockedMimeTypes.ToArray(), owaVirtualDirectory.ForceSaveFileTypes.ToArray(), owaVirtualDirectory.ForceSaveMimeTypes.ToArray(), owaVirtualDirectory.AllowedFileTypes.ToArray(), owaVirtualDirectory.AllowedMimeTypes.ToArray(), treatUnknownTypeAs, owaVirtualDirectory.DirectFileAccessOnPublicComputersEnabled.Value, owaVirtualDirectory.DirectFileAccessOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWacViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWacViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WacViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WacViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.WebReadyFileTypes.ToArray(), owaVirtualDirectory.WebReadyMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedFileTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingForAllSupportedTypes.Value);

            this.formsAuthenticationEnabled   = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Fba);
            this.windowsAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.WindowsIntegrated);
            this.basicAuthenticationEnabled   = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Basic);
            this.digestAuthenticationEnabled  = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Digest);
            base.AttachmentPolicy             = attachmentPolicy;
            this.filterWebBeaconsAndHtmlForms = VdirConfiguration.GetWebBeaconFilterLevel(owaVirtualDirectory.FilterWebBeaconsAndHtmlForms);
            base.DefaultTheme = owaVirtualDirectory.DefaultTheme;
            int segmentationBits  = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet];
            int segmentationBits2 = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet2];

            base.SegmentationFlags = ConfigurationBase.SetSegmentationFlags(segmentationBits, segmentationBits2);
            if (owaVirtualDirectory.OutboundCharset != null)
            {
                base.OutboundCharset = owaVirtualDirectory.OutboundCharset.Value;
            }
            if (owaVirtualDirectory.UseGB18030 != null && owaVirtualDirectory.UseGB18030.Value)
            {
                base.UseGB18030 = true;
            }
            else
            {
                base.UseGB18030 = false;
            }
            if (owaVirtualDirectory.UseISO885915 != null && owaVirtualDirectory.UseISO885915.Value)
            {
                base.UseISO885915 = true;
            }
            else
            {
                base.UseISO885915 = false;
            }
            base.InstantMessagingEnabled  = (owaVirtualDirectory.InstantMessagingEnabled ?? false);
            base.InstantMessagingType     = (owaVirtualDirectory.InstantMessagingType ?? InstantMessagingTypeOptions.None);
            base.InstantMessagingEnabled &= (base.InstantMessagingType == InstantMessagingTypeOptions.Ocs);
            if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled)
            {
                this.instantMessagingServerName            = owaVirtualDirectory.InstantMessagingServerName;
                this.instantMessagingCertificateThumbprint = owaVirtualDirectory.InstantMessagingCertificateThumbprint;
                if (string.IsNullOrWhiteSpace(this.instantMessagingServerName))
                {
                    Organization orgContainer = session.GetOrgContainer();
                    ProtocolConnectionSettings sipaccessService = orgContainer.SIPAccessService;
                    if (sipaccessService == null)
                    {
                        this.instantMessagingServerName = string.Empty;
                    }
                    else
                    {
                        this.instantMessagingServerName = sipaccessService.Hostname.ToString();
                    }
                }
            }
            base.AllowOfflineOn = owaVirtualDirectory.AllowOfflineOn;
            base.PlacesEnabled  = (owaVirtualDirectory.PlacesEnabled != null && owaVirtualDirectory.PlacesEnabled.Value);
            base.WeatherEnabled = (owaVirtualDirectory.WeatherEnabled != null && owaVirtualDirectory.WeatherEnabled.Value);
            base.AllowCopyContactsToDeviceAddressBook = (owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook != null && owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook.Value);
            base.RecoverDeletedItemsEnabled           = (owaVirtualDirectory.RecoverDeletedItemsEnabled != null && owaVirtualDirectory.RecoverDeletedItemsEnabled.Value);
            this.expirationTime = DateTime.UtcNow + VdirConfiguration.expirationPeriod;
        }