Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@ -30,10 +30,10 @@ Global
{5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{88A04AB0-F61E-4DD2-9E12-928DCA261263}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{88A04AB0-F61E-4DD2-9E12-928DCA261263}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{88A04AB0-F61E-4DD2-9E12-928DCA261263}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU

View File

@ -8,7 +8,6 @@
namespace System.IO
{
[System.Security.SecurityCriticalAttribute]
public static partial class FileSystemAclExtensions
{
public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo) { throw null; }
@ -23,7 +22,6 @@ namespace System.IO
}
namespace System.Security.AccessControl
{
[System.Security.SecurityCriticalAttribute]
public abstract partial class DirectoryObjectSecurity : System.Security.AccessControl.ObjectSecurity
{
protected DirectoryObjectSecurity() { }
@ -46,19 +44,16 @@ namespace System.Security.AccessControl
protected void SetAccessRule(System.Security.AccessControl.ObjectAccessRule rule) { }
protected void SetAuditRule(System.Security.AccessControl.ObjectAuditRule rule) { }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class DirectorySecurity : System.Security.AccessControl.FileSystemSecurity
{
public DirectorySecurity() { }
public DirectorySecurity(string name, System.Security.AccessControl.AccessControlSections includeSections) { }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class FileSecurity : System.Security.AccessControl.FileSystemSecurity
{
public FileSecurity() { }
public FileSecurity(string fileName, System.Security.AccessControl.AccessControlSections includeSections) { }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class FileSystemAccessRule : System.Security.AccessControl.AccessRule
{
public FileSystemAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
@ -67,7 +62,6 @@ namespace System.Security.AccessControl
public FileSystemAccessRule(string identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
public System.Security.AccessControl.FileSystemRights FileSystemRights { get { throw null; } }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class FileSystemAuditRule : System.Security.AccessControl.AuditRule
{
public FileSystemAuditRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
@ -77,7 +71,6 @@ namespace System.Security.AccessControl
public System.Security.AccessControl.FileSystemRights FileSystemRights { get { throw null; } }
}
[System.FlagsAttribute]
[System.Security.SecurityCriticalAttribute]
public enum FileSystemRights
{
AppendData = 4,
@ -104,7 +97,6 @@ namespace System.Security.AccessControl
WriteData = 2,
WriteExtendedAttributes = 16,
}
[System.Security.SecurityCriticalAttribute]
public abstract partial class FileSystemSecurity : System.Security.AccessControl.NativeObjectSecurity
{
internal FileSystemSecurity() : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }

View File

@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netfx-Windows_NT;
netcoreapp2.0-Windows_NT;
netcoreapp2.0-Unix;
netstandard;
</BuildConfigurations>
<PackageConfigurations>
netstandard;
netfx-Windows_NT;
netcoreapp2.0-Windows_NT;
</PackageConfigurations>
<BuildConfigurations>
$(PackageConfigurations);
netcoreapp-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@ -138,4 +138,10 @@
<data name="PlatformNotSupported_AccessControl" xml:space="preserve">
<value>Access Control List (ACL) APIs are part of resource management on Windows and are not supported on this platform.</value>
</data>
</root>
<data name="TypeUnrecognized_AccessControl" xml:space="preserve">
<value>AccessControlType '{0}' unrecognized</value>
</data>
<data name="InvalidOperation_RemoveFail" xml:space="preserve">
<value>Remove access rule failed</value>
</data>
</root>

View File

@ -7,20 +7,19 @@
<PropertyGroup>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<ProjectGuid>{D77FBA6C-1AA6-45A4-93E2-97A370672C53}</ProjectGuid>
<AllowUnsafeBlocks Condition="'$(TargetGroup)'=='netcoreapp2.0'">true</AllowUnsafeBlocks>
<AllowUnsafeBlocks Condition="$(TargetGroup.StartsWith('netcoreapp'))">true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='netfx'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsUnix)' == 'true' OR '$(TargetGroup)' == 'netstandard'">SR.PlatformNotSupported_AccessControl</GeneratePlatformNotSupportedAssemblyMessage>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' == 'netstandard'">SR.PlatformNotSupported_AccessControl</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Unix-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp2.0-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(IsPartialFacadeAssembly)'!='true' AND '$(TargetsWindows)'=='true'">
<ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp'))">
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Errors.cs">
<Link>Common\Interop\Windows\Interop.Errors.cs</Link>
</Compile>
@ -37,7 +36,6 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'!='netfx'">
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.Resources.ResourceManager" />
@ -48,4 +46,4 @@
<Reference Include="System.Security.Principal.Windows" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Win32.SafeHandles;
using System.Diagnostics.Contracts;
using System.Security.AccessControl;
using System;
@ -25,7 +24,6 @@ namespace System.IO
{
if (directorySecurity == null)
throw new ArgumentNullException(nameof(directorySecurity));
Contract.EndContractBlock();
String fullPath = Path.GetFullPath(directoryInfo.FullName);
directorySecurity.Persist(fullPath);
@ -45,7 +43,6 @@ namespace System.IO
{
if (fileSecurity == null)
throw new ArgumentNullException(nameof(fileSecurity));
Contract.EndContractBlock();
String fullPath = Path.GetFullPath(fileInfo.FullName);
// Appropriate security check should be done for us by FileSecurity.
@ -62,14 +59,12 @@ namespace System.IO
return new FileSecurity(handle, fileStream.Name, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
}
[System.Security.SecuritySafeCritical] // auto-generated
public static void SetAccessControl(this FileStream fileStream, FileSecurity fileSecurity)
{
SafeFileHandle handle = fileStream.SafeFileHandle;
if (fileSecurity == null)
throw new ArgumentNullException(nameof(fileSecurity));
Contract.EndContractBlock();
if (handle.IsClosed)
{

View File

@ -10,7 +10,6 @@
using Microsoft.Win32.SafeHandles;
using Microsoft.Win32;
using System.Collections;
using System.Diagnostics.Contracts;
using System.Diagnostics;
using System.IO;
using System.Reflection;
@ -45,7 +44,6 @@ namespace System.Security.AccessControl
{
throw new ArgumentNullException(nameof(securityDescriptor));
}
Contract.EndContractBlock();
_securityDescriptor = securityDescriptor;
}
@ -347,9 +345,8 @@ namespace System.Security.AccessControl
case AccessControlModification.RemoveAll:
result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Allow, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
if (result == false)
{
Debug.Assert(false, "Invalid operation");
throw new Exception();
{
throw new InvalidOperationException(SR.InvalidOperation_RemoveFail);
}
break;
@ -393,9 +390,8 @@ nameof(modification),
case AccessControlModification.RemoveAll:
result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Deny, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
if (result == false)
{
Debug.Assert(false, "Invalid operation");
throw new Exception();
{
throw new InvalidOperationException(SR.InvalidOperation_RemoveFail);
}
break;
@ -412,9 +408,8 @@ nameof(modification),
}
}
else
{
Debug.Assert(false, "rule.AccessControlType unrecognized");
throw new Exception();
{
throw new ArgumentException(SR.Format(SR.TypeUnrecognized_AccessControl, rule.AccessControlType));
}
modified = result;
@ -488,9 +483,8 @@ nameof(modification),
case AccessControlModification.RemoveAll:
result = _securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
if (result == false)
{
Debug.Assert(false, "Invalid operation");
throw new Exception();
{
throw new InvalidOperationException(SR.InvalidOperation_RemoveFail);
}
break;
@ -534,7 +528,6 @@ nameof(modification),
// SR.AccessControl_InvalidAccessRuleType,
// "rule");
//}
Contract.EndContractBlock();
return ModifyAccess(modification, rule as ObjectAccessRule, out modified);
}
@ -547,7 +540,6 @@ nameof(modification),
// SR.AccessControl_InvalidAuditRuleType,
// "rule");
//}
Contract.EndContractBlock();
return ModifyAudit(modification, rule as ObjectAuditRule, out modified);
}
#endregion
@ -560,7 +552,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -583,7 +574,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -604,7 +594,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -625,7 +614,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -651,7 +639,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -677,7 +664,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
if (_securityDescriptor == null)
{
@ -703,7 +689,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -724,7 +709,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -745,7 +729,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -766,7 +749,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();
@ -787,7 +769,6 @@ nameof(modification),
{
throw new ArgumentNullException(nameof(rule));
}
Contract.EndContractBlock();
WriteLock();

View File

@ -14,7 +14,6 @@
using Microsoft.Win32.SafeHandles;
using Microsoft.Win32;
using System.Collections;
using System.Diagnostics.Contracts;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
@ -181,7 +180,6 @@ namespace System.Security.AccessControl
{
if (fileSystemRights < (FileSystemRights)0 || fileSystemRights > FileSystemRights.FullControl)
throw new ArgumentOutOfRangeException(nameof(fileSystemRights), SR.Format(SR.Argument_InvalidEnumValue, fileSystemRights, nameof(AccessControl.FileSystemRights)));
Contract.EndContractBlock();
if (controlType == AccessControlType.Allow)
{
@ -292,7 +290,6 @@ namespace System.Security.AccessControl
{
if (fileSystemRights < (FileSystemRights)0 || fileSystemRights > FileSystemRights.FullControl)
throw new ArgumentOutOfRangeException(nameof(fileSystemRights), SR.Format(SR.Argument_InvalidEnumValue, fileSystemRights, nameof(AccessControl.FileSystemRights)));
Contract.EndContractBlock();
return (int)fileSystemRights;
}
@ -317,25 +314,21 @@ namespace System.Security.AccessControl
#endregion
[System.Security.SecurityCritical] // auto-generated
internal FileSystemSecurity(bool isContainer)
: base(isContainer, s_ResourceType, _HandleErrorCode, isContainer)
{
}
[System.Security.SecurityCritical] // auto-generated
internal FileSystemSecurity(bool isContainer, String name, AccessControlSections includeSections, bool isDirectory)
: base(isContainer, s_ResourceType, name, includeSections, _HandleErrorCode, isDirectory)
{
}
[System.Security.SecurityCritical] // auto-generated
internal FileSystemSecurity(bool isContainer, SafeFileHandle handle, AccessControlSections includeSections, bool isDirectory)
: base(isContainer, s_ResourceType, handle, includeSections, _HandleErrorCode, isDirectory)
{
}
[System.Security.SecurityCritical] // auto-generated
private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
{
System.Exception exception = null;
@ -428,7 +421,6 @@ namespace System.Security.AccessControl
return persistRules;
}
[System.Security.SecurityCritical] // auto-generated
internal void Persist(String fullPath)
{
WriteLock();
@ -445,7 +437,6 @@ namespace System.Security.AccessControl
}
}
[System.Security.SecuritySafeCritical] // auto-generated
internal void Persist(SafeFileHandle handle, String fullPath)
{
WriteLock();
@ -486,7 +477,6 @@ namespace System.Security.AccessControl
{
if (rule == null)
throw new ArgumentNullException(nameof(rule));
Contract.EndContractBlock();
// If the rule to be removed matches what is there currently then
// remove it unaltered. That is, don't mask off the Synchronize bit.
@ -533,7 +523,6 @@ namespace System.Security.AccessControl
{
if (rule == null)
throw new ArgumentNullException(nameof(rule));
Contract.EndContractBlock();
// If the rule to be removed matches what is there currently then
// remove it unaltered. That is, don't mask off the Synchronize bit
@ -618,13 +607,11 @@ namespace System.Security.AccessControl
{
#region Constructors
[System.Security.SecuritySafeCritical] // auto-generated
public FileSecurity()
: base(false)
{
}
[System.Security.SecuritySafeCritical] // auto-generated
public FileSecurity(String fileName, AccessControlSections includeSections)
: base(false, fileName, includeSections, false)
{
@ -635,7 +622,6 @@ namespace System.Security.AccessControl
// it public. We don't want to get into a situation where someone can
// pass in the string foo.txt and a handle to bar.exe, and we do a
// demand on the wrong file name.
[System.Security.SecurityCritical] // auto-generated
internal FileSecurity(SafeFileHandle handle, String fullPath, AccessControlSections includeSections)
: base(false, handle, includeSections, false)
{
@ -648,13 +634,11 @@ namespace System.Security.AccessControl
{
#region Constructors
[System.Security.SecuritySafeCritical] // auto-generated
public DirectorySecurity()
: base(true)
{
}
[System.Security.SecuritySafeCritical] // auto-generated
public DirectorySecurity(String name, AccessControlSections includeSections)
: base(true, name, includeSections, true)
{

View File

@ -43,6 +43,7 @@ namespace System.Security.AccessControl
}
[Fact]
[ActiveIssue(24903, TargetFrameworkMonikers.NetFramework)]
public void GetAccessRules_InvalidTargetType()
{
var activeDirectorySecurity = new ActiveDirectorySecurity();
@ -492,6 +493,23 @@ namespace System.Security.AccessControl
Assert.False(existingRules.Contains(customAccessRuleSynchronize));
}
[Fact]
public void RemoveAccessRuleAll_AccessControlType_Deny_ThrowException()
{
var descriptor = new CommonSecurityDescriptor(true, true, string.Empty);
var customObjectSecurity = new CustomDirectoryObjectSecurity(descriptor);
var objectTypeGuid = Guid.NewGuid();
var identityReference = new NTAccount(@"NT AUTHORITY\SYSTEM");
var customAccessRuleReadWrite = new CustomAccessRule(
identityReference, ReadWriteAccessMask, true, InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly, objectTypeGuid, Guid.NewGuid(), AccessControlType.Deny
);
customObjectSecurity.AddAccessRule(customAccessRuleReadWrite);
AssertExtensions.Throws<InvalidOperationException, SystemException>(() => customObjectSecurity.RemoveAccessRuleAll(customAccessRuleReadWrite));
}
[Fact]
public void RemoveAccessRuleAll_AccessControlType_Deny_Succeeds()
{