You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -4,6 +4,7 @@ using System.Xml;
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
#endif
|
||||
|
||||
namespace System.Xml.XmlConfiguration {
|
||||
internal static class XmlConfigurationString {
|
||||
@@ -21,7 +22,12 @@ namespace System.Xml.XmlConfiguration {
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public sealed class XmlReaderSection : ConfigurationSection {
|
||||
public sealed class XmlReaderSection
|
||||
#if CONFIGURATION_DEP
|
||||
: ConfigurationSection
|
||||
#endif
|
||||
{
|
||||
#if CONFIGURATION_DEP
|
||||
[ConfigurationProperty(XmlConfigurationString.ProhibitDefaultResolverName, DefaultValue = "false")]
|
||||
public string ProhibitDefaultResolverString {
|
||||
get { return (string)this[XmlConfigurationString.ProhibitDefaultResolverName]; }
|
||||
@@ -36,13 +42,17 @@ namespace System.Xml.XmlConfiguration {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//check the config every time, otherwise will have problem in different asp.net pages which have different settings.
|
||||
//ConfigurationManager will cache the section result, so expect no perf issue.
|
||||
internal static bool ProhibitDefaultUrlResolver {
|
||||
get {
|
||||
#if CONFIGURATION_DEP
|
||||
XmlReaderSection section = System.Configuration.ConfigurationManager.GetSection(XmlConfigurationString.XmlReaderSectionPath) as XmlReaderSection;
|
||||
return (section != null) ? section._ProhibitDefaultResolver : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +65,12 @@ namespace System.Xml.XmlConfiguration {
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public sealed class XsltConfigSection : ConfigurationSection {
|
||||
public sealed class XsltConfigSection
|
||||
#if CONFIGURATION_DEP
|
||||
: ConfigurationSection
|
||||
#endif
|
||||
{
|
||||
#if CONFIGURATION_DEP
|
||||
[ConfigurationProperty(XmlConfigurationString.ProhibitDefaultResolverName, DefaultValue = "false")]
|
||||
public string ProhibitDefaultResolverString {
|
||||
get { return (string)this[XmlConfigurationString.ProhibitDefaultResolverName]; }
|
||||
@@ -70,11 +85,15 @@ namespace System.Xml.XmlConfiguration {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
private static bool s_ProhibitDefaultUrlResolver {
|
||||
get {
|
||||
#if CONFIGURATION_DEP
|
||||
XsltConfigSection section = System.Configuration.ConfigurationManager.GetSection(XmlConfigurationString.XsltSectionPath) as XsltConfigSection;
|
||||
return (section != null) ? section._ProhibitDefaultResolver : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +103,7 @@ namespace System.Xml.XmlConfiguration {
|
||||
else
|
||||
return new XmlUrlResolver();
|
||||
}
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
[ConfigurationProperty(XmlConfigurationString.LimitXPathComplexityName, DefaultValue = "true")]
|
||||
internal string LimitXPathComplexityString
|
||||
{
|
||||
@@ -102,16 +121,20 @@ namespace System.Xml.XmlConfiguration {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
internal static bool LimitXPathComplexity
|
||||
{
|
||||
get
|
||||
{
|
||||
#if CONFIGURATION_DEP
|
||||
XsltConfigSection section = System.Configuration.ConfigurationManager.GetSection(XmlConfigurationString.XsltSectionPath) as XsltConfigSection;
|
||||
return (section != null) ? section._LimitXPathComplexity : true;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
[ConfigurationProperty(XmlConfigurationString.EnableMemberAccessForXslCompiledTransformName, DefaultValue = "False")]
|
||||
internal string EnableMemberAccessForXslCompiledTransformString
|
||||
{
|
||||
@@ -129,31 +152,18 @@ namespace System.Xml.XmlConfiguration {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
internal static bool EnableMemberAccessForXslCompiledTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
#if CONFIGURATION_DEP
|
||||
XsltConfigSection section = System.Configuration.ConfigurationManager.GetSection(XmlConfigurationString.XsltSectionPath) as XsltConfigSection;
|
||||
return (section != null) ? section._EnableMemberAccessForXslCompiledTransform : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace System.Xml.XmlConfiguration {
|
||||
public sealed class XsltConfigSection {
|
||||
internal static XmlResolver CreateDefaultResolver() {
|
||||
return XmlNullResolver.Singleton;
|
||||
}
|
||||
internal static bool EnableMemberAccessForXslCompiledTransform = false;
|
||||
internal static bool LimitXPathComplexity = true;
|
||||
}
|
||||
public sealed class XmlReaderSection {
|
||||
internal static XmlResolver CreateDefaultResolver() {
|
||||
return null;
|
||||
}
|
||||
internal static bool ProhibitDefaultUrlResolver = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1 +1 @@
|
||||
d4f3942b5077f197c23152f694d42340681c48b8
|
||||
446dab45c17fc37aa82e9edc5c755e18862a709f
|
||||
@@ -1 +1 @@
|
||||
2c7ce79c3a022ca4a7718a3f15f2fbcc8100b944
|
||||
6fdbc73d6ab2655188f92de5210d78dea358f943
|
||||
@@ -25,6 +25,7 @@ namespace System.Xml.Serialization {
|
||||
}
|
||||
|
||||
static void EnsureSettingsLoaded() {
|
||||
#if CONFIGURATION_DEP
|
||||
if (!settingsInitalized) {
|
||||
lock (appSettingsLock) {
|
||||
if (!settingsInitalized) {
|
||||
@@ -48,6 +49,7 @@ namespace System.Xml.Serialization {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1727,6 +1727,7 @@ namespace System.Xml.Serialization {
|
||||
internal static string TempFilesLocation {
|
||||
get {
|
||||
if (tempFilesLocation == null) {
|
||||
#if CONFIGURATION_DEP
|
||||
// Return different XmlSerializerSection from legacy assembly due to its register config handlers
|
||||
object section = ConfigurationManager.GetSection(ConfigurationStrings.XmlSerializerSectionPath);
|
||||
string location = null;
|
||||
@@ -1736,6 +1737,9 @@ namespace System.Xml.Serialization {
|
||||
location = configSection.TempFilesLocation;
|
||||
}
|
||||
}
|
||||
#else
|
||||
string location = null;
|
||||
#endif
|
||||
if (location != null) {
|
||||
tempFilesLocation = location.Trim();
|
||||
}
|
||||
|
||||
@@ -102,8 +102,12 @@ namespace System.Xml.Serialization {
|
||||
return (bool) AppSettings.UseLegacySerializerGeneration;
|
||||
}
|
||||
else {
|
||||
#if CONFIGURATION_DEP
|
||||
XmlSerializerSection configSection = ConfigurationManager.GetSection(ConfigurationStrings.XmlSerializerSectionPath) as XmlSerializerSection;
|
||||
return configSection == null ? false : configSection.UseLegacySerializerGeneration;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,8 +667,10 @@ namespace System.Xml.Serialization {
|
||||
parameters.GenerateInMemory = true;
|
||||
|
||||
if (string.IsNullOrEmpty(location)) {
|
||||
#if CONFIGURATION_DEP
|
||||
XmlSerializerSection configSection = ConfigurationManager.GetSection(ConfigurationStrings.XmlSerializerSectionPath) as XmlSerializerSection;
|
||||
location = configSection == null ? location : configSection.TempFilesLocation;
|
||||
#endif
|
||||
// Trim leading and trailing white spaces (VSWhidbey 229873)
|
||||
if (!string.IsNullOrEmpty(location)) {
|
||||
location = location.Trim();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
using System;
|
||||
@@ -53,4 +53,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
using System;
|
||||
@@ -126,4 +126,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
|
||||
@@ -95,4 +95,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
using System.Configuration;
|
||||
@@ -105,3 +105,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
ConfigurationPropertyOptions.IsDefaultCollection);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
using System.Configuration;
|
||||
@@ -35,3 +35,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Xml.Serialization.Configuration
|
||||
{
|
||||
using System;
|
||||
@@ -96,4 +97,4 @@ namespace System.Xml.Serialization.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,10 +56,12 @@ namespace System.Xml.Serialization {
|
||||
this.context = context;
|
||||
Schemas.SetCache(Context.Cache, Context.ShareTypes);
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
SchemaImporterExtensionsSection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.SchemaImporterExtensionsSectionPath) as SchemaImporterExtensionsSection;
|
||||
if (section != null)
|
||||
extensions = section.SchemaImporterExtensionsInternal;
|
||||
else
|
||||
#endif
|
||||
extensions = new SchemaImporterExtensionCollection();
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
9bbd7e244026b20f0541c5c6e7484192f8669925
|
||||
b6800a7f4e641f45d10832207ee0dc87098e21de
|
||||
@@ -21,6 +21,7 @@ namespace System.Xml.Serialization {
|
||||
/// The <see cref="XmlCustomFormatter"/> class provides a set of static methods for converting
|
||||
/// primitive type values to and from their XML string representations.</summary>
|
||||
internal class XmlCustomFormatter {
|
||||
#if CONFIGURATION_DEP
|
||||
private static DateTimeSerializationSection.DateTimeSerializationMode mode;
|
||||
|
||||
static DateTimeSerializationSection.DateTimeSerializationMode Mode {
|
||||
@@ -38,6 +39,7 @@ namespace System.Xml.Serialization {
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
private XmlCustomFormatter() {}
|
||||
internal static string FromDefaultValue(object value, string formatter) {
|
||||
if (value == null) return null;
|
||||
@@ -79,13 +81,13 @@ namespace System.Xml.Serialization {
|
||||
}
|
||||
|
||||
internal static string FromDateTime(DateTime value) {
|
||||
#if CONFIGURATION_DEP
|
||||
if (Mode == DateTimeSerializationSection.DateTimeSerializationMode.Local) {
|
||||
return XmlConvert.ToString(value, "yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz");
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
// for mode DateTimeSerializationMode.Roundtrip and DateTimeSerializationMode.Default
|
||||
return XmlConvert.ToString(value, XmlDateTimeSerializationMode.RoundtripKind);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string FromChar(char value) {
|
||||
@@ -314,10 +316,13 @@ namespace System.Xml.Serialization {
|
||||
};
|
||||
|
||||
internal static DateTime ToDateTime(string value) {
|
||||
#if CONFIGURATION_DEP
|
||||
if (Mode == DateTimeSerializationSection.DateTimeSerializationMode.Local) {
|
||||
return ToDateTime(value, allDateTimeFormats);
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// for mode DateTimeSerializationMode.Roundtrip and DateTimeSerializationMode.Default
|
||||
return XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.RoundtripKind);
|
||||
}
|
||||
|
||||
@@ -15,19 +15,25 @@ namespace System.Xml {
|
||||
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
|
||||
public partial class XmlSecureResolver : XmlResolver {
|
||||
XmlResolver resolver;
|
||||
#if !DISABLE_CAS_USE
|
||||
PermissionSet permissionSet;
|
||||
|
||||
public XmlSecureResolver(XmlResolver resolver, string securityUrl) : this(resolver, CreateEvidenceForUrl(securityUrl)) {}
|
||||
#endif
|
||||
|
||||
#if DISABLE_CAS_USE
|
||||
public XmlSecureResolver(XmlResolver resolver, Evidence evidence) : this(resolver, new PermissionSet (PermissionState.None)) {}
|
||||
public XmlSecureResolver(XmlResolver resolver, string securityUrl) : this(resolver, (PermissionSet) null) {}
|
||||
|
||||
public XmlSecureResolver(XmlResolver resolver, Evidence evidence) : this(resolver, (PermissionSet) null) {}
|
||||
#else
|
||||
public XmlSecureResolver(XmlResolver resolver, string securityUrl) : this(resolver, CreateEvidenceForUrl(securityUrl)) {}
|
||||
|
||||
public XmlSecureResolver(XmlResolver resolver, Evidence evidence) : this(resolver, SecurityManager.GetStandardSandbox(evidence)) {}
|
||||
#endif
|
||||
|
||||
public XmlSecureResolver(XmlResolver resolver, PermissionSet permissionSet) {
|
||||
this.resolver = resolver;
|
||||
#if !DISABLE_CAS_USE
|
||||
this.permissionSet = permissionSet;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override ICredentials Credentials {
|
||||
@@ -35,7 +41,9 @@ namespace System.Xml {
|
||||
}
|
||||
|
||||
public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) {
|
||||
#if !DISABLE_CAS_USE
|
||||
permissionSet.PermitOnly();
|
||||
#endif
|
||||
return resolver.GetEntity(absoluteUri, role, ofObjectToReturn);
|
||||
}
|
||||
|
||||
@@ -46,8 +54,8 @@ namespace System.Xml {
|
||||
}
|
||||
|
||||
public static Evidence CreateEvidenceForUrl(string securityUrl) {
|
||||
Evidence evidence = new Evidence();
|
||||
#if !DISABLE_CAS_USE
|
||||
Evidence evidence = new Evidence();
|
||||
if (securityUrl != null && securityUrl.Length > 0) {
|
||||
evidence.AddHostEvidence(new Url(securityUrl));
|
||||
evidence.AddHostEvidence(Zone.CreateFromUrl(securityUrl));
|
||||
@@ -64,10 +72,14 @@ namespace System.Xml {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return evidence;
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !DISABLE_CAS_USE
|
||||
[Serializable]
|
||||
private class UncDirectory : EvidenceBase, IIdentityPermissionFactory {
|
||||
private string uncDir;
|
||||
@@ -96,5 +108,6 @@ namespace System.Xml {
|
||||
return ToXml().ToString();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ namespace System.Xml {
|
||||
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
|
||||
public partial class XmlSecureResolver : XmlResolver {
|
||||
public override Task<object> GetEntityAsync(Uri absoluteUri, string role, Type ofObjectToReturn) {
|
||||
#if !DISABLE_CAS_USE
|
||||
permissionSet.PermitOnly();
|
||||
#endif
|
||||
return resolver.GetEntityAsync(absoluteUri, role, ofObjectToReturn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +116,14 @@ namespace System.Xml.Xsl {
|
||||
if (stylesheet == null) {
|
||||
throw new ArgumentNullException("stylesheet");
|
||||
}
|
||||
#if !DISABLE_CAS_USE
|
||||
if (evidence == null) {
|
||||
evidence = new Evidence();
|
||||
}
|
||||
else {
|
||||
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
|
||||
}
|
||||
#endif
|
||||
Compile(stylesheet, resolver, evidence);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user