Пример #1
0
 public static InstantMessagingConfiguration GetInstance(VdirConfiguration vdirConfiguration)
 {
     if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled)
     {
         return(new InstantMessagingConfiguration(vdirConfiguration));
     }
     return(new InstantMessagingConfiguration(null));
 }
        private ConfigurationBase GetPolicyOrVdirConfiguration(NameValueCollection requestHeaders = null, string requestUserAgent = null, string rawUrl = null, Uri uri = null, string userHostAddress = null, bool?isLocal = false)
        {
            ConfigurationBase configurationBase = null;

            if (this.principal != null)
            {
                configurationBase = OwaMailboxPolicyCache.GetPolicyConfiguration(this.principal.MailboxInfo.Configuration.OwaMailboxPolicy, this.principal.MailboxInfo.OrganizationId);
            }
            return(configurationBase ?? VdirConfiguration.GetInstance(requestHeaders, requestUserAgent, rawUrl, uri, userHostAddress, isLocal));
        }
Пример #3
0
        // Token: 0x0600095C RID: 2396 RVA: 0x0001FED4 File Offset: 0x0001E0D4
        internal static VdirConfiguration GetInstance(NameValueCollection requestHeaders = null, string requestUserAgent = null, string rawUrl = null, Uri uri = null, string userHostAddress = null, bool?isLocal = false)
        {
            if (VdirConfiguration.useBackendVdirConfiguration || Globals.IsPreCheckinApp)
            {
                lock (VdirConfiguration.syncRoot)
                {
                    if (VdirConfiguration.instance == null || VdirConfiguration.instance.expirationTime < DateTime.UtcNow)
                    {
                        VdirConfiguration.instance = (Globals.IsPreCheckinApp ? new VdirConfiguration() : VdirConfiguration.CreateInstance(Guid.Empty));
                    }
                }
                return(VdirConfiguration.instance);
            }
            if (!VdirConfiguration.IsRequestFromCafe(requestHeaders ?? HttpContext.Current.Request.Headers) && UserAgentUtilities.IsMonitoringRequest(requestUserAgent ?? HttpContext.Current.Request.UserAgent))
            {
                return(new VdirConfiguration());
            }
            Guid requestVdirObjectGuid = VdirConfiguration.GetRequestVdirObjectGuid(requestHeaders, requestUserAgent, rawUrl, uri, userHostAddress, isLocal);
            VdirConfiguration result;

            lock (VdirConfiguration.syncRoot)
            {
                VdirConfiguration.RemoveEntriesIfExpired();
                VdirConfiguration vdirConfiguration;
                if (VdirConfiguration.instances.TryGetValue(requestVdirObjectGuid, out vdirConfiguration))
                {
                    result = vdirConfiguration;
                }
                else
                {
                    try
                    {
                        vdirConfiguration = VdirConfiguration.CreateInstance(requestVdirObjectGuid);
                        VdirConfiguration.instances.Add(requestVdirObjectGuid, vdirConfiguration);
                        if (VdirConfiguration.minExpirationTime > vdirConfiguration.expirationTime)
                        {
                            VdirConfiguration.minExpirationTime = vdirConfiguration.expirationTime;
                        }
                    }
                    catch (ADConfigurationException innerException)
                    {
                        throw new InvalidRequestException(innerException);
                    }
                    result = vdirConfiguration;
                }
            }
            return(result);
        }
Пример #4
0
        // 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));
        }
Пример #5
0
 private InstantMessagingConfiguration(VdirConfiguration vdirConfiguration)
 {
     this.vdirConfiguration = vdirConfiguration;
 }
Пример #6
0
        // Token: 0x06000959 RID: 2393 RVA: 0x0001EE24 File Offset: 0x0001D024
        private VdirConfiguration()
        {
            AttachmentPolicy attachmentPolicy = new AttachmentPolicy(new StringArrayAppSettingsEntry("BlockFileTypes", new string[]
            {
                ".vsmacros",
                ".msh2xml",
                ".msh1xml",
                ".ps2xml",
                ".ps1xml",
                ".mshxml",
                ".mhtml",
                ".psc2",
                ".psc1",
                ".msh2",
                ".msh1",
                ".aspx",
                ".xml",
                ".wsh",
                ".wsf",
                ".wsc",
                ".vsw",
                ".vst",
                ".vss",
                ".vbs",
                ".vbe",
                ".url",
                ".tmp",
                ".shs",
                ".shb",
                ".sct",
                ".scr",
                ".scf",
                ".reg",
                ".pst",
                ".ps2",
                ".ps1",
                ".prg",
                ".prf",
                ".plg",
                ".pif",
                ".pcd",
                ".ops",
                ".mst",
                ".msp",
                ".msi",
                ".msh",
                ".msc",
                ".mht",
                ".mdz",
                ".mdw",
                ".mdt",
                ".mde",
                ".mdb",
                ".mda",
                ".maw",
                ".mav",
                ".mau",
                ".mat",
                ".mas",
                ".mar",
                ".maq",
                ".mam",
                ".mag",
                ".maf",
                ".mad",
                ".lnk",
                ".ksh",
                ".jse",
                ".its",
                ".isp",
                ".ins",
                ".inf",
                ".htc",
                ".hta",
                ".hlp",
                ".fxp",
                ".exe",
                ".der",
                ".csh",
                ".crt",
                ".cpl",
                ".com",
                ".cmd",
                ".chm",
                ".cer",
                ".bat",
                ".bas",
                ".asx",
                ".asp",
                ".app",
                ".adp",
                ".ade",
                ".ws",
                ".vb",
                ".js"
            }, null).Value, new StringArrayAppSettingsEntry("BlockMimeTypes", new string[]
            {
                "application/x-javascript",
                "application/javascript",
                "application/msaccess",
                "x-internet-signup",
                "text/javascript",
                "application/xml",
                "application/prg",
                "application/hta",
                "text/scriplet",
                "text/xml"
            }, null).Value, new StringArrayAppSettingsEntry("ForceSaveFileTypes", new string[]
            {
                ".vsmacros",
                ".msh2xml",
                ".msh1xml",
                ".ps2xml",
                ".ps1xml",
                ".mshxml",
                ".mhtml",
                ".psc2",
                ".psc1",
                ".msh2",
                ".msh1",
                ".aspx",
                ".xml",
                ".wsh",
                ".wsf",
                ".wsc",
                ".vsw",
                ".vst",
                ".vss",
                ".vbs",
                ".vbe",
                ".url",
                ".tmp",
                ".shs",
                ".shb",
                ".sct",
                ".scr",
                ".scf",
                ".reg",
                ".pst",
                ".ps2",
                ".ps1",
                ".prg",
                ".prf",
                ".plg",
                ".pif",
                ".pcd",
                ".ops",
                ".mst",
                ".msp",
                ".msi",
                ".msh",
                ".msc",
                ".mht",
                ".mdz",
                ".mdw",
                ".mdt",
                ".mde",
                ".mdb",
                ".mda",
                ".maw",
                ".mav",
                ".mau",
                ".mat",
                ".mas",
                ".mar",
                ".maq",
                ".mam",
                ".mag",
                ".maf",
                ".mad",
                ".lnk",
                ".ksh",
                ".jse",
                ".its",
                ".isp",
                ".ins",
                ".inf",
                ".htc",
                ".hta",
                ".hlp",
                ".fxp",
                ".exe",
                ".der",
                ".csh",
                ".crt",
                ".cpl",
                ".com",
                ".cmd",
                ".chm",
                ".cer",
                ".bat",
                ".bas",
                ".asx",
                ".asp",
                ".app",
                ".adp",
                ".ade",
                ".ws",
                ".vb",
                ".js"
            }, null).Value, new StringArrayAppSettingsEntry("ForceSaveMimeTypes", new string[]
            {
                "Application/x-shockwave-flash",
                "Application/octet-stream",
                "Application/futuresplash",
                "Application/x-director"
            }, null).Value, new StringArrayAppSettingsEntry("AllowFileTypes", new string[]
            {
                ".rpmsg",
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".zip",
                ".xls",
                ".wmv",
                ".wma",
                ".wav",
                ".vsd",
                ".txt",
                ".tif",
                ".rtf",
                ".pub",
                ".ppt",
                ".png",
                ".pdf",
                ".one",
                ".mp3",
                ".jpg",
                ".gif",
                ".doc",
                ".bmp",
                ".avi"
            }, null).Value, new StringArrayAppSettingsEntry("AllowMimeTypes", new string[0], null).Value, (AttachmentPolicyLevel)Enum.Parse(typeof(AttachmentPolicyLevel), new StringAppSettingsEntry("ActionForUnknownFileAndMIMETypes", "ForceSave", null).Value), new BoolAppSettingsEntry("DirectFileAccessOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("DirectFileAccessOnPrivateComputersEnabled", true, null).Value, new BoolAppSettingsEntry("ForceWacViewingFirstOnPublicComputers", false, null).Value, new BoolAppSettingsEntry("ForceWacViewingFirstOnPrivateComputers", false, null).Value, new BoolAppSettingsEntry("WacViewingOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("WacViewingOnPrivateComputersEnabled", true, null).Value, new BoolAppSettingsEntry("ForceWebReadyDocumentViewingFirstOnPublicComputers", false, null).Value, new BoolAppSettingsEntry("ForceWebReadyDocumentViewingFirstOnPrivateComputers", false, null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingOnPrivateComputersEnabled", true, null).Value, new StringArrayAppSettingsEntry("WebReadyFileTypes", new string[]
            {
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".xls",
                ".rtf",
                ".pdf"
            }, null).Value, new StringArrayAppSettingsEntry("WebReadyMimeTypes", new string[0], null).Value, new StringArrayAppSettingsEntry("WebReadyDocumentViewingSupportedFileTypes", new string[]
            {
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".xls",
                ".rtf",
                ".pdf"
            }, null).Value, new StringArrayAppSettingsEntry("WebReadyDocumentViewingSupportedMimeTypes", new string[0], null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingForAllSupportedTypes", false, null).Value);

            base.AttachmentPolicy = attachmentPolicy;
            WebBeaconFilterLevels value = (WebBeaconFilterLevels)Enum.Parse(typeof(WebBeaconFilterLevels), new StringAppSettingsEntry("FilterWebBeaconsAndHtmlForms", "UserFilterChoice", null).Value);

            this.filterWebBeaconsAndHtmlForms = VdirConfiguration.GetWebBeaconFilterLevel(new WebBeaconFilterLevels?(value));
            base.DefaultTheme               = new StringAppSettingsEntry("DefaultTheme", string.Empty, null).Value;
            base.SegmentationFlags          = (ulong)Enum.Parse(typeof(Feature), new StringAppSettingsEntry("SegmentationFlags", "All", null).Value);
            base.OutboundCharset            = (OutboundCharsetOptions)Enum.Parse(typeof(OutboundCharsetOptions), new StringAppSettingsEntry("OutboundCharset", "AutoDetect", null).Value);
            base.UseGB18030                 = new BoolAppSettingsEntry("UseGB18030", false, null).Value;
            base.UseISO885915               = new BoolAppSettingsEntry("UseISO885915", false, null).Value;
            base.InstantMessagingType       = (InstantMessagingTypeOptions)Enum.Parse(typeof(InstantMessagingTypeOptions), new StringAppSettingsEntry("InstantMessagingType", "Ocs", null).Value);
            base.InstantMessagingEnabled    = new BoolAppSettingsEntry("InstantMessagingEnabled", true, null).Value;
            base.AllowOfflineOn             = (AllowOfflineOnEnum)Enum.Parse(typeof(AllowOfflineOnEnum), new StringAppSettingsEntry("AllowOfflineOn", "AllComputers", null).Value);
            this.formsAuthenticationEnabled = new BoolAppSettingsEntry("FormsAuthenticationEnabled", true, null).Value;
            base.RecoverDeletedItemsEnabled = new BoolAppSettingsEntry("RecoverDeletedItemsEnabled", true, null).Value;
        }
Пример #7
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;
        }