You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@ -1 +1 @@
|
||||
4b30c4caffe091787335adcea178360bfdd89f5a
|
||||
831c5ba22827b30e58d524a8eeb0afbb55fdee3b
|
@ -12,6 +12,7 @@ namespace System.Configuration.Internal {
|
||||
using System.Threading;
|
||||
using System.Security;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Xml;
|
||||
|
||||
//
|
||||
// A public implementation of IInternalConfigHost that simply
|
||||
@ -30,15 +31,23 @@ namespace System.Configuration.Internal {
|
||||
// * It allows straightforward chaining of host functionality,
|
||||
// see UpdateConfigHost as an example.
|
||||
//
|
||||
public class DelegatingConfigHost : IInternalConfigHost {
|
||||
public class DelegatingConfigHost : IInternalConfigHost, IInternalConfigurationBuilderHost {
|
||||
IInternalConfigHost _host;
|
||||
IInternalConfigurationBuilderHost _configBuilderHost;
|
||||
|
||||
protected DelegatingConfigHost() {}
|
||||
|
||||
// The host that is delegated to.
|
||||
protected IInternalConfigHost Host {
|
||||
get {return _host;}
|
||||
set {_host = value;}
|
||||
set {
|
||||
_host = value;
|
||||
_configBuilderHost = _host as IInternalConfigurationBuilderHost;
|
||||
}
|
||||
}
|
||||
|
||||
protected IInternalConfigurationBuilderHost ConfigBuilderHost {
|
||||
get { return _configBuilderHost; }
|
||||
}
|
||||
|
||||
public virtual void Init(IInternalConfigRoot configRoot, params object[] hostInitParams) {
|
||||
@ -226,6 +235,22 @@ namespace System.Configuration.Internal {
|
||||
}
|
||||
}
|
||||
|
||||
public virtual XmlNode ProcessRawXml(XmlNode rawXml, ConfigurationBuilder builder) {
|
||||
if (ConfigBuilderHost != null) {
|
||||
return ConfigBuilderHost.ProcessRawXml(rawXml, builder);
|
||||
}
|
||||
|
||||
return rawXml;
|
||||
}
|
||||
|
||||
public virtual ConfigurationSection ProcessConfigurationSection(ConfigurationSection configSection, ConfigurationBuilder builder) {
|
||||
if (ConfigBuilderHost != null) {
|
||||
return ConfigBuilderHost.ProcessConfigurationSection(configSection, builder);
|
||||
}
|
||||
|
||||
return configSection;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,12 @@ namespace System.Configuration.Internal {
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Policy;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
|
||||
//
|
||||
// An IInternalConfigHost with common implementations of some file functions.
|
||||
//
|
||||
internal sealed class InternalConfigHost : IInternalConfigHost {
|
||||
internal sealed class InternalConfigHost : IInternalConfigHost, IInternalConfigurationBuilderHost {
|
||||
private IInternalConfigRoot _configRoot;
|
||||
|
||||
internal InternalConfigHost() {
|
||||
@ -446,6 +447,21 @@ namespace System.Configuration.Internal {
|
||||
}
|
||||
}
|
||||
|
||||
XmlNode IInternalConfigurationBuilderHost.ProcessRawXml(XmlNode rawXml, ConfigurationBuilder builder) {
|
||||
if (builder != null) {
|
||||
return builder.ProcessRawXml(rawXml);
|
||||
}
|
||||
|
||||
return rawXml;
|
||||
}
|
||||
|
||||
ConfigurationSection IInternalConfigurationBuilderHost.ProcessConfigurationSection(ConfigurationSection configSection, ConfigurationBuilder builder) {
|
||||
if (builder != null) {
|
||||
return builder.ProcessConfigurationSection(configSection);
|
||||
}
|
||||
|
||||
return configSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,12 @@ namespace System.Configuration.Internal {
|
||||
// taken begin with the prefix "hl", for example, "hlFindConfigRecord".
|
||||
//
|
||||
internal sealed class InternalConfigRoot : IInternalConfigRoot {
|
||||
IInternalConfigHost _host; // host, need to create records
|
||||
ReaderWriterLock _hierarchyLock; // lock to protect hierarchy
|
||||
IInternalConfigHost _host; // host, need to create records
|
||||
IInternalConfigurationBuilderHost _configBuilderHost; // _configBuilderHost, need to create records
|
||||
ReaderWriterLock _hierarchyLock; // lock to protect hierarchy
|
||||
BaseConfigurationRecord _rootConfigRecord; // root config record, one level above machine.config.
|
||||
bool _isDesignTime; // Is the hierarchy for runtime or designtime?
|
||||
private Configuration _CurrentConfiguration = null;
|
||||
private Configuration _CurrentConfiguration = null;
|
||||
|
||||
public event InternalConfigEventHandler ConfigChanged;
|
||||
public event InternalConfigEventHandler ConfigRemoved;
|
||||
@ -45,6 +46,7 @@ namespace System.Configuration.Internal {
|
||||
|
||||
void IInternalConfigRoot.Init(IInternalConfigHost host, bool isDesignTime) {
|
||||
_host = host;
|
||||
_configBuilderHost = host as IInternalConfigurationBuilderHost;
|
||||
_isDesignTime = isDesignTime;
|
||||
_hierarchyLock = new ReaderWriterLock();
|
||||
|
||||
@ -61,6 +63,10 @@ namespace System.Configuration.Internal {
|
||||
get {return _host;}
|
||||
}
|
||||
|
||||
internal IInternalConfigurationBuilderHost ConfigBuilderHost {
|
||||
get { return _configBuilderHost; }
|
||||
}
|
||||
|
||||
internal BaseConfigurationRecord RootConfigRecord {
|
||||
get {return _rootConfigRecord;}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
f3ec52b9de8334b4d7e7adc40b9aaf60dc3d3b35
|
||||
f694686b8988e10f7079f698a90c2e51a2f86158
|
@ -53,12 +53,12 @@ namespace System.Configuration {
|
||||
}
|
||||
|
||||
// parentConfig contains the config that we'd merge with.
|
||||
override protected object CreateSection(bool inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, object parentConfig, ConfigXmlReader reader) {
|
||||
override protected object CreateSection(bool inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, SectionInput sectionInput, object parentConfig, ConfigXmlReader reader) {
|
||||
// Get the factory used to create a section.
|
||||
RuntimeConfigurationFactory factory = (RuntimeConfigurationFactory) factoryRecord.Factory;
|
||||
|
||||
// Use the factory to create a section.
|
||||
object config = factory.CreateSection(inputIsTrusted, this, factoryRecord, sectionRecord, parentConfig, reader);
|
||||
object config = factory.CreateSection(inputIsTrusted, this, factoryRecord, sectionRecord, sectionInput, parentConfig, reader);
|
||||
|
||||
return config;
|
||||
}
|
||||
@ -215,7 +215,7 @@ namespace System.Configuration {
|
||||
|
||||
private object CreateSectionImpl(
|
||||
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
|
||||
object parentConfig, ConfigXmlReader reader) {
|
||||
SectionInput sectionInput, object parentConfig, ConfigXmlReader reader) {
|
||||
|
||||
object config;
|
||||
|
||||
@ -233,6 +233,10 @@ namespace System.Configuration {
|
||||
configSection.DeserializeSection(reader);
|
||||
}
|
||||
|
||||
if (configRecord != null && sectionInput != null && sectionInput.ConfigBuilder != null) {
|
||||
configSection = configRecord.CallHostProcessConfigurationSection(configSection, sectionInput.ConfigBuilder);
|
||||
}
|
||||
|
||||
// throw if there are any cached errors
|
||||
ConfigurationErrorsException errors = configSection.GetErrors();
|
||||
if (errors != null) {
|
||||
@ -270,15 +274,15 @@ namespace System.Configuration {
|
||||
[PermissionSet(SecurityAction.Assert, Unrestricted=true)]
|
||||
private object CreateSectionWithFullTrust(
|
||||
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
|
||||
object parentConfig, ConfigXmlReader reader) {
|
||||
SectionInput sectionInput, object parentConfig, ConfigXmlReader reader) {
|
||||
|
||||
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
|
||||
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, sectionInput, parentConfig, reader);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2107:ReviewDenyAndPermitOnlyUsage", Justification = "This PermitOnly is meant to protect unassuming handlers from malicious callers by undoing any asserts we have put on the stack.")]
|
||||
private object CreateSectionWithRestrictedPermissions(
|
||||
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
|
||||
object parentConfig, ConfigXmlReader reader) {
|
||||
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
|
||||
SectionInput sectionInput, object parentConfig, ConfigXmlReader reader) {
|
||||
|
||||
// run configuration section handlers as if user code was on the stack
|
||||
bool revertPermitOnly = false;
|
||||
@ -289,7 +293,7 @@ namespace System.Configuration {
|
||||
revertPermitOnly = true;
|
||||
}
|
||||
|
||||
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
|
||||
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, sectionInput, parentConfig, reader);
|
||||
}
|
||||
finally {
|
||||
if (revertPermitOnly) {
|
||||
@ -299,13 +303,13 @@ namespace System.Configuration {
|
||||
}
|
||||
|
||||
internal object CreateSection(bool inputIsTrusted, RuntimeConfigurationRecord configRecord,
|
||||
FactoryRecord factoryRecord, SectionRecord sectionRecord, object parentConfig, ConfigXmlReader reader) {
|
||||
FactoryRecord factoryRecord, SectionRecord sectionRecord, SectionInput sectionInput, object parentConfig, ConfigXmlReader reader) {
|
||||
|
||||
if (inputIsTrusted) {
|
||||
return CreateSectionWithFullTrust(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
|
||||
return CreateSectionWithFullTrust(configRecord, factoryRecord, sectionRecord, sectionInput, parentConfig, reader);
|
||||
}
|
||||
else {
|
||||
return CreateSectionWithRestrictedPermissions(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
|
||||
return CreateSectionWithRestrictedPermissions(configRecord, factoryRecord, sectionRecord, sectionInput, parentConfig, reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ namespace System.Configuration {
|
||||
private const int Flag_ProtectionProviderModified = 0x00080000;
|
||||
private const int Flag_OverrideModeDefaultModified = 0x00100000;
|
||||
private const int Flag_OverrideModeModified = 0x00200000; // Used only for modified tracking
|
||||
private const int Flag_ConfigBuilderDetermined = 0x00400000;
|
||||
private const int Flag_ConfigBuilderModified = 0x00800000;
|
||||
|
||||
private ConfigurationSection _configurationSection;
|
||||
private SafeBitVector32 _flags;
|
||||
@ -55,6 +57,8 @@ namespace System.Configuration {
|
||||
private string _configSourceStreamName;
|
||||
private ProtectedConfigurationProvider _protectionProvider;
|
||||
private string _protectionProviderName;
|
||||
private ConfigurationBuilder _configBuilder;
|
||||
private string _configBuilderName;
|
||||
private OverrideModeSetting _overrideModeDefault; // The default mode for the section in _configurationSection
|
||||
private OverrideModeSetting _overrideMode; // The override mode at the current config path
|
||||
|
||||
@ -128,8 +132,10 @@ namespace System.Configuration {
|
||||
if (sectionRecord.HasFileInput) {
|
||||
SectionInput fileInput = sectionRecord.FileInput;
|
||||
|
||||
_flags[ Flag_ProtectionProviderDetermined ] = fileInput.IsProtectionProviderDetermined;
|
||||
_protectionProvider = fileInput.ProtectionProvider;
|
||||
_flags[Flag_ConfigBuilderDetermined] = fileInput.IsConfigBuilderDetermined;
|
||||
_configBuilder = fileInput.ConfigBuilder;
|
||||
_flags[Flag_ProtectionProviderDetermined] = fileInput.IsProtectionProviderDetermined;
|
||||
_protectionProvider = fileInput.ProtectionProvider;
|
||||
|
||||
SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;
|
||||
|
||||
@ -137,10 +143,13 @@ namespace System.Configuration {
|
||||
_configSourceStreamName = sectionXmlInfo.ConfigSourceStreamName;
|
||||
_overrideMode = sectionXmlInfo.OverrideModeSetting;
|
||||
_flags[ Flag_InheritInChildApps ] = !sectionXmlInfo.SkipInChildApps;
|
||||
_configBuilderName = sectionXmlInfo.ConfigBuilderName;
|
||||
_protectionProviderName = sectionXmlInfo.ProtectionProviderName;
|
||||
}
|
||||
else {
|
||||
_flags[ Flag_ProtectionProviderDetermined ] = false;
|
||||
_flags[Flag_ConfigBuilderDetermined] = false;
|
||||
_configBuilder = null;
|
||||
_flags[Flag_ProtectionProviderDetermined] = false;
|
||||
_protectionProvider = null;
|
||||
}
|
||||
|
||||
@ -599,6 +608,21 @@ namespace System.Configuration {
|
||||
get {return (ProtectionProvider != null);}
|
||||
}
|
||||
|
||||
internal string ConfigBuilderName {
|
||||
get { return _configBuilderName; }
|
||||
}
|
||||
|
||||
public ConfigurationBuilder ConfigurationBuilder {
|
||||
get {
|
||||
if (!_flags[Flag_ConfigBuilderDetermined] && _configRecord != null) {
|
||||
_configBuilder = _configRecord.GetConfigBuilderFromName(_configBuilderName);
|
||||
_flags[Flag_ConfigBuilderDetermined] = true;
|
||||
}
|
||||
|
||||
return _configBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
public ProtectedConfigurationProvider ProtectionProvider {
|
||||
get {
|
||||
if (!_flags[ Flag_ProtectionProviderDetermined] && _configRecord != null) {
|
||||
|
@ -15,8 +15,14 @@ namespace System.Configuration {
|
||||
private static object s_unevaluated = new object();
|
||||
|
||||
// input from the XML file
|
||||
private SectionXmlInfo _sectionXmlInfo;
|
||||
private SectionXmlInfo _sectionXmlInfo;
|
||||
|
||||
// Provider to enhance config sources
|
||||
private ConfigurationBuilder _configBuilder;
|
||||
|
||||
// Has the config provider been determined for this input?
|
||||
private bool _isConfigBuilderDetermined;
|
||||
|
||||
// Provider to use for encryption
|
||||
private ProtectedConfigurationProvider _protectionProvider;
|
||||
|
||||
@ -79,6 +85,18 @@ namespace System.Configuration {
|
||||
_resultRuntimeObject = s_unevaluated;
|
||||
}
|
||||
|
||||
internal bool IsConfigBuilderDetermined {
|
||||
get { return _isConfigBuilderDetermined; }
|
||||
}
|
||||
|
||||
internal ConfigurationBuilder ConfigBuilder {
|
||||
get { return _configBuilder; }
|
||||
set {
|
||||
_configBuilder = value;
|
||||
_isConfigBuilderDetermined = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsProtectionProviderDetermined {
|
||||
get {return _isProtectionProviderDetermined;}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace System.Configuration {
|
||||
private object _configSourceStreamVersion; // version of the configSource filestream
|
||||
private bool _skipInChildApps; // skip inheritence by child apps?
|
||||
private string _rawXml; // raw xml input of the section
|
||||
private string _configBuilderName; // name of the configuration provider
|
||||
private string _protectionProviderName; // name of the protection provider
|
||||
|
||||
private OverrideModeSetting _overrideMode; // override mode for child config paths
|
||||
@ -36,7 +37,7 @@ namespace System.Configuration {
|
||||
string configKey, string definitionConfigPath, string targetConfigPath, string subPath,
|
||||
string filename, int lineNumber, object streamVersion,
|
||||
string rawXml, string configSource, string configSourceStreamName, object configSourceStreamVersion,
|
||||
string protectionProviderName, OverrideModeSetting overrideMode, bool skipInChildApps) {
|
||||
string configBuilderName, string protectionProviderName, OverrideModeSetting overrideMode, bool skipInChildApps) {
|
||||
|
||||
_configKey = configKey;
|
||||
_definitionConfigPath = definitionConfigPath;
|
||||
@ -49,6 +50,7 @@ namespace System.Configuration {
|
||||
_configSource = configSource;
|
||||
_configSourceStreamName = configSourceStreamName;
|
||||
_configSourceStreamVersion = configSourceStreamVersion;
|
||||
_configBuilderName = configBuilderName;
|
||||
_protectionProviderName = protectionProviderName;
|
||||
_overrideMode = overrideMode;
|
||||
_skipInChildApps = skipInChildApps;
|
||||
@ -111,6 +113,11 @@ namespace System.Configuration {
|
||||
set {_rawXml = value;}
|
||||
}
|
||||
|
||||
internal string ConfigBuilderName {
|
||||
get { return _configBuilderName; }
|
||||
set { _configBuilderName = value; }
|
||||
}
|
||||
|
||||
internal string ProtectionProviderName {
|
||||
get {return _protectionProviderName;}
|
||||
set {_protectionProviderName = value;}
|
||||
|
Reference in New Issue
Block a user