예제 #1
0
        private static void LoadDisableSendAuxRecordConfiguration()
        {
            try {
                if (LocalAppContextSwitches.DontEnableSchSendAuxRecord)
                {
                    disableSendAuxRecord = true;
                    return;
                }

                int schSendAuxRecordKeyValue = 1;
                schSendAuxRecordKeyValue = RegistryConfiguration.AppConfigReadInt(sendAuxRecordAppSetting, 1);
                if (schSendAuxRecordKeyValue == 0)
                {
                    disableSendAuxRecord = true;
                    return;
                }

                schSendAuxRecordKeyValue = RegistryConfiguration.GlobalConfigReadInt(sendAuxRecordValueName, 1);
                if (schSendAuxRecordKeyValue == 0)
                {
                    disableSendAuxRecord = true;
                    return;
                }
            }
            catch (Exception e)
            {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
            }
        }
        private static bool LoadAllowDangerousUnicodeDecompositionsConfiguration(bool useFeature)
        {
            int allowDangerousUnicodeDecompositionsKeyValue;

            allowDangerousUnicodeDecompositionsKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalAllowDangerousUnicodeDecompositions, 0);
            if (allowDangerousUnicodeDecompositionsKeyValue == 1)
            {
                return(true);
            }

            allowDangerousUnicodeDecompositionsKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalAllowDangerousUnicodeDecompositions, 0);
            if (allowDangerousUnicodeDecompositionsKeyValue == 1)
            {
                return(true);
            }

            return(useFeature);
        }
        private static bool LoadUseStrictRfcInterimResponseHandlingConfiguration(bool useFeature)
        {
            int useStrictRfcInterimResponseHandlingKeyValue;

            useStrictRfcInterimResponseHandlingKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalUseStrictRfcInterimResponseHandling, 1);
            if (useStrictRfcInterimResponseHandlingKeyValue == 0)
            {
                return(false);
            }

            useStrictRfcInterimResponseHandlingKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalUseStrictRfcInterimResponseHandling, 1);
            if (useStrictRfcInterimResponseHandlingKeyValue == 0)
            {
                return(false);
            }

            return(useFeature);
        }
        private static bool LoadUseSafeSynchronousClose(bool useFeature)
        {
            int useSynchronousCloseValue;

            useSynchronousCloseValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalUseSafeSynchronousClose, 1);
            if (useSynchronousCloseValue == 0)
            {
                return(false);
            }

            useSynchronousCloseValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalUseSafeSynchronousClose, 1);
            if (useSynchronousCloseValue == 0)
            {
                return(false);
            }

            return(useFeature);
        }
        private static bool LoadUseHttpPipeliningAndBufferPoolingConfiguration(bool useFeature)
        {
            int useHttpPipeliningAndBufferPoolingKeyValue;

            useHttpPipeliningAndBufferPoolingKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalUseHttpPipeliningAndBufferPooling, 1);
            if (useHttpPipeliningAndBufferPoolingKeyValue == 0)
            {
                return(false);
            }

            useHttpPipeliningAndBufferPoolingKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalUseHttpPipeliningAndBufferPooling, 1);
            if (useHttpPipeliningAndBufferPoolingKeyValue == 0)
            {
                return(false);
            }

            return(useFeature);
        }
        private static bool LoadDisableSendAuxRecordConfiguration(bool disable)
        {
            int schSendAuxRecordKeyValue;

            schSendAuxRecordKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalSendAuxRecordName, 1);
            if (schSendAuxRecordKeyValue == 0)
            {
                return(true);
            }

            schSendAuxRecordKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalSendAuxRecordName, 1);
            if (schSendAuxRecordKeyValue == 0)
            {
                return(true);
            }

            return(disable);
        }
예제 #7
0
        private static bool LoadAllowAllUriEncodingExpansionConfiguration(bool useFeature)
        {
            int allowAllUriEncodingExpansionKeyValue;

            allowAllUriEncodingExpansionKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalAllowAllUriEncodingExpansion, 0);
            if (allowAllUriEncodingExpansionKeyValue == 1)
            {
                return(true);
            }

            allowAllUriEncodingExpansionKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalAllowAllUriEncodingExpansion, 0);
            if (allowAllUriEncodingExpansionKeyValue == 1)
            {
                return(true);
            }

            return(useFeature);
        }
예제 #8
0
        private static bool LoadUseStrictIPv6AddressParsingConfiguration(bool useFeature)
        {
            int useStrictIPv6AddressParsingKeyValue;

            useStrictIPv6AddressParsingKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalUseStrictIPv6AddressParsing, 1);
            if (useStrictIPv6AddressParsingKeyValue == 0)
            {
                return(false);
            }

            useStrictIPv6AddressParsingKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalUseStrictIPv6AddressParsing, 1);
            if (useStrictIPv6AddressParsingKeyValue == 0)
            {
                return(false);
            }

            return(useFeature);
        }
예제 #9
0
        private static int?ReadPrefixLookupMaxEntriesConfig()
        {
            int?maxPrefixLookupEntries = null;

            int configuredMaxPrefixLookupEntries =
                RegistryConfiguration.GlobalConfigReadInt(configPrefixLookupMaxCount, -1);

            if (configuredMaxPrefixLookupEntries > 0)
            {
                maxPrefixLookupEntries = configuredMaxPrefixLookupEntries;
            }

            // Per-process setting will override global configuration.
            configuredMaxPrefixLookupEntries =
                RegistryConfiguration.AppConfigReadInt(configPrefixLookupMaxCount, -1);

            if (configuredMaxPrefixLookupEntries > 0)
            {
                maxPrefixLookupEntries = configuredMaxPrefixLookupEntries;
            }
            return(maxPrefixLookupEntries);
        }
예제 #10
0
        private static IAuthenticationManager SelectAuthenticationManagerInstance()
        {
            bool highPerformance = false;

            try
            {
                if (RegistryConfiguration.GlobalConfigReadInt(configHighPerformance, 0) == 1)
                {
                    highPerformance = true;
                }
                else if (RegistryConfiguration.AppConfigReadInt(configHighPerformance, 0) == 1)
                {
                    highPerformance = true;
                }

                if (highPerformance)
                {
                    int?maxPrefixLookupEntries = ReadPrefixLookupMaxEntriesConfig();
                    if ((maxPrefixLookupEntries != null) && (maxPrefixLookupEntries > 0))
                    {
                        return(new AuthenticationManager2((int)maxPrefixLookupEntries));
                    }
                    else
                    {
                        return(new AuthenticationManager2());
                    }
                }
            }
            catch (Exception e)
            {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
            }

            return(new AuthenticationManagerDefault());
        }
        private static bool LoadDisableSystemDefaultTlsVersionsConfiguration(bool disable)
        {
            if (LocalAppContextSwitches.DontEnableSystemDefaultTlsVersions)
            {
                // .Net 4.6.2 and below will disable SystemDefaultTls unless the registry key is specifically set to 1.
                int globalOverride = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalSystemDefaultTlsVersionsName, 0);
                disable = globalOverride != 1;
            }
            else
            {
                // .Net 4.6.3 and above will enable SystemDefaultTls unless the registry key is specifically set to 0.
                int globalOverride = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalSystemDefaultTlsVersionsName, 1);
                disable = globalOverride == 0;
            }

            if (!disable)
            {
                int appLocalOverride = RegistryConfiguration.AppConfigReadInt(RegistryLocalSystemDefaultTlsVersionsName, 1);
                disable = appLocalOverride != 1;
            }

            return(disable);
        }
        private static bool LoadDisableCertificateEKUsConfiguration(bool disable)
        {
            int requireCertificateEKUsKeyValue;

            if (LocalAppContextSwitches.DontCheckCertificateEKUs)
            {
                return(true);
            }

            requireCertificateEKUsKeyValue = RegistryConfiguration.AppConfigReadInt(RegistryLocalRequireCertificateEKUs, 1);
            if (requireCertificateEKUsKeyValue == 0)
            {
                return(true);
            }

            requireCertificateEKUsKeyValue = RegistryConfiguration.GlobalConfigReadInt(RegistryGlobalRequireCertificateEKUs, 1);
            if (requireCertificateEKUsKeyValue == 0)
            {
                return(true);
            }

            return(disable);
        }