Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@@ -6,7 +6,5 @@
<AssemblyKey>MSFT</AssemblyKey>
<IsNETCoreApp>true</IsNETCoreApp>
<IsNETCoreAppRef>false</IsNETCoreAppRef>
<IsUAP>true</IsUAP>
<ISUAPRef>false</ISUAPRef>
</PropertyGroup>
</Project>

View File

@@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Security.AccessControl.csproj">
<SupportedFramework>net461;netcoreapp2.0;uap10.1;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>net461;netcoreapp2.0;$(UAPvNextTFM);$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.Security.AccessControl.csproj" />
<HarvestIncludePaths Include="ref/net46;lib/net46;runtimes/win/lib/net46" />

View File

@@ -3,8 +3,8 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{F80C478C-48EE-46A5-89C4-EE0CFB23A14F}</ProjectGuid>
<!-- UAP10.1 is not yet mapped to netstandard2.0, manually duplicate this ref -->
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netstandard2.0;uap10.1</PackageTargetFramework>
<!-- UAPvNext is not yet mapped to netstandard2.0, manually duplicate this ref -->
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netstandard2.0;$(UAPvNextTFM)</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
@@ -18,7 +18,7 @@
<Reference Include="mscorlib" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<SuppressPackageTargetFrameworkCompatibility Include="uap10.1" />
<SuppressPackageTargetFrameworkCompatibility Include="$(UAPvNextTFM)" />
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View File

@@ -1,4 +0,0 @@
advapi32.dll!OpenProcessToken
advapi32.dll!OpenThreadToken
advapi32.dll!RevertToSelf
advapi32.dll!SetThreadToken

View File

@@ -36,7 +36,7 @@ namespace System.Security.AccessControl
internal sealed class Privilege
{
[ThreadStatic]
private static TlsContents tlsSlotData;
private static TlsContents t_tlsSlotData;
private static Dictionary<Luid, string> privileges = new Dictionary<Luid, string>();
private static Dictionary<string, Luid> luids = new Dictionary<string, Luid>();
private static ReaderWriterLockSlim privilegeLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
@@ -463,12 +463,12 @@ namespace System.Security.AccessControl
// Retrieve TLS state
//
this.tlsContents = tlsSlotData;
this.tlsContents = t_tlsSlotData;
if (this.tlsContents == null)
{
this.tlsContents = new TlsContents();
tlsSlotData = this.tlsContents;
t_tlsSlotData = this.tlsContents;
}
else
{
@@ -685,7 +685,7 @@ namespace System.Security.AccessControl
if (0 == this.tlsContents.DecrementReferenceCount())
{
this.tlsContents = null;
tlsSlotData = null;
t_tlsSlotData = null;
}
}
}

View File

@@ -39,6 +39,7 @@ namespace System.Security.AccessControl.Tests
[Theory]
[MemberData(nameof(AccessRule_TestData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "FileSystemAccessRule is not supported on UAP")]
public void AccessRule_Constructor(string sid, int accessMask, bool isInherited, int inheritanceFlags, int propagationFlags, int accessControlType)
{
IdentityReference identityReference = new SecurityIdentifier(sid);
@@ -59,6 +60,7 @@ namespace System.Security.AccessControl.Tests
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "FileSystemAccessRule is not supported on UAP")]
public override void AccessRule_Constructor_Invalid()
{
AssertExtensions.Throws<ArgumentNullException>("identity", () => Constructor(null, 1, true, (InheritanceFlags)1, (PropagationFlags)1, (AccessControlType)0));

View File

@@ -40,6 +40,7 @@ namespace System.Security.AccessControl.Tests
[Theory]
[MemberData(nameof(AuditRule_TestData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "FileSystemAuditRule is not supported on UAP")]
public void AuditRule_Constructor(string sid, int accessMask, bool isInherited, int inheritanceFlags, int propagationFlags, int AuditFlags)
{
IdentityReference identityReference = new SecurityIdentifier(sid);
@@ -60,6 +61,7 @@ namespace System.Security.AccessControl.Tests
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "FileSystemAuditRule is not supported on UAP")]
public override void AuditRule_Constructor_Invalid()
{
AssertExtensions.Throws<ArgumentNullException>("identity", () => Constructor(null, 1, true, (InheritanceFlags)1, (PropagationFlags)1, (AuditFlags)0));

View File

@@ -59,56 +59,56 @@ namespace System.Security.AccessControl.Tests
// test case 1: SACL is not null, SACL.IsContainer is true, but isContainer parameter is false
sacl = new SystemAcl(true, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("systemAcl", () =>
{
sd = new CommonSecurityDescriptor(false, true, ControlFlags.SystemAclPresent, null, null, sacl, null);
});
// test case 2: SACL is not null, SACL.IsContainer is false, but isContainer parameter is true
sacl = new SystemAcl(false, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("systemAcl", () =>
{
sd = new CommonSecurityDescriptor(true, true, ControlFlags.SystemAclPresent, null, null, sacl, null);
});
// test case 3: DACL is not null, DACL.IsContainer is true, but isContainer parameter is false
dacl = new DiscretionaryAcl(true, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("discretionaryAcl", () =>
{
sd = new CommonSecurityDescriptor(false, true, ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
});
// test case 4: DACL is not null, DACL.IsContainer is false, but isContainer parameter is true
dacl = new DiscretionaryAcl(false, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("discretionaryAcl", () =>
{
sd = new CommonSecurityDescriptor(true, true, ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
});
// test case 5: SACL is not null, SACL.IsDS is true, but isDS parameter is false
sacl = new SystemAcl(true, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("systemAcl", () =>
{
sd = new CommonSecurityDescriptor(true, false, ControlFlags.SystemAclPresent, null, null, sacl, null);
});
// test case 6: SACL is not null, SACL.IsDS is false, but isDS parameter is true
sacl = new SystemAcl(true, false, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("systemAcl", () =>
{
sd = new CommonSecurityDescriptor(true, true, ControlFlags.SystemAclPresent, null, null, sacl, null);
});
// test case 7: DACL is not null, DACL.IsDS is true, but isDS parameter is false
dacl = new DiscretionaryAcl(true, true, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("discretionaryAcl", () =>
{
sd = new CommonSecurityDescriptor(true, false, ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
});
// test case 8: DACL is not null, DACL.IsDS is false, but isDS parameter is true
dacl = new DiscretionaryAcl(true, false, 10);
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("discretionaryAcl", () =>
{
sd = new CommonSecurityDescriptor(true, true, ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
});
@@ -207,4 +207,4 @@ namespace System.Security.AccessControl.Tests
return result;
}
}
}
}

View File

@@ -65,7 +65,7 @@ namespace System.Security.AccessControl.Tests
});
// case 5: ControlFlags.SelfRelative is not set
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>(null, () =>
{
byte[] binaryForm = new byte[24];
for (int i = 0; i < binaryForm.Length; i++)
@@ -84,7 +84,7 @@ namespace System.Security.AccessControl.Tests
});
// Case 7, an array of garbage
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>(null, () =>
{
byte[] binaryForm = { 1, 0, 0, 128, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, binaryForm, 0);
@@ -118,4 +118,4 @@ namespace System.Security.AccessControl.Tests
Assert.True(String.Compare(verifierSddl, resultSddlForm, StringComparison.CurrentCultureIgnoreCase) == 0);
}
}
}
}

View File

@@ -46,35 +46,35 @@ namespace System.Security.AccessControl.Tests
});
// Case 3, sddl form owner symbol exists but no content
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("sddlForm", () =>
{
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, "O:G:SYD:AI(A;ID;FR;;;BA)S:AI(AU;IDFA;FR;;;BA)");
// expect to throw exception but not
});
// Case 4, sddl form group symbol exists but no content
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("sddlForm", () =>
{
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, "O:LAG:D:AI(A;ID;FR;;;BA)S:AI(AU;IDFA;FR;;;BA)");
// expect to throw exception but not
});
// Case 5, garbage string sddl
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("sddlForm", () =>
{
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, "ABCDEFGHIJKLMNOPQ");
// expect to throw exception but not
});
// Case 7, sddl form with invalid owner sid
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("sddlForm", () =>
{
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, "O:XXG:D:AI(A;ID;FR;;;BA)S:AI(AU;IDFA;FR;;;BA)");
// expect to throw exception but not
});
// Case 8, sddl form with invalid group sid
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("sddlForm", () =>
{
commonSecurityDescriptor = new CommonSecurityDescriptor(false, false, "O:LAG:YYD:AI(A;ID;FR;;;BA)S:AI(AU;IDFA;FR;;;BA)");
// expect to throw exception but not

View File

@@ -102,7 +102,7 @@ namespace System.Security.AccessControl.Tests
byte[] opaque = null;
//Case 1, non-Container, but InheritanceFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("inheritanceFlags", () =>
{
isContainer = false;
isDS = false;
@@ -115,7 +115,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 2, non-Container, but PropagationFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = false;
isDS = false;
@@ -129,7 +129,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 3, Container, InheritanceFlags is None, PropagationFlags is InheritOnly
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -143,7 +143,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 4, Container, InheritanceFlags is None, PropagationFlags is NoPropagateInherit
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -157,7 +157,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 5, Container, InheritanceFlags is None, PropagationFlags is NoPropagateInherit | InheritOnly
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -171,7 +171,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 6, accessMask = 0
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = true;
isDS = false;
@@ -232,7 +232,7 @@ namespace System.Security.AccessControl.Tests
//bug# 288116
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -342,4 +342,4 @@ namespace System.Security.AccessControl.Tests
}
}
}
}

View File

@@ -141,7 +141,7 @@ namespace System.Security.AccessControl.Tests
//Case 3, accessMask = 0
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = true;
isDS = false;
@@ -239,4 +239,4 @@ namespace System.Security.AccessControl.Tests
}
}
}
}

View File

@@ -128,7 +128,7 @@ namespace System.Security.AccessControl.Tests
//Case 3, accessMask = 0
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = true;
isDS = false;
@@ -224,4 +224,4 @@ namespace System.Security.AccessControl.Tests
});
}
}
}
}

View File

@@ -87,7 +87,7 @@ namespace System.Security.AccessControl.Tests
GenericAce gAce = null;
byte[] opaque = null;
//Case 1, non-Container, but InheritanceFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("inheritanceFlags", () =>
{
isContainer = false;
isDS = false;
@@ -101,7 +101,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 2, non-Container, but PropagationFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = false;
isDS = false;
@@ -134,7 +134,7 @@ namespace System.Security.AccessControl.Tests
//Case 4, accessMask = 0
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = true;
isDS = false;
@@ -303,4 +303,4 @@ namespace System.Security.AccessControl.Tests
});
}
}
}
}

View File

@@ -220,7 +220,7 @@ namespace System.Security.AccessControl.Tests
aceFlag = 0;
binaryForm = new byte[65536];
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("binaryForm", () =>
{
revision = 127;
capacity = 1;

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="System.Security.AccessControl.Tests">
<Assembly Name="System.Security.AccessControl">
<!-- Needed for 2 CustomAce tests that require constructor metadata -->
<Namespace Name="System.Security.AccessControl" Dynamic="Required All" />
</Assembly>
</Library>
</Directives>

View File

@@ -72,9 +72,9 @@
<Compile Include="SystemAcl\SystemAcl_RemoveInheritedAces.cs" />
<Compile Include="SystemAcl\SystemAcl_SetAudit.cs" />
<Compile Include="Utils.cs" />
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
<Link>Common\System\AssertExtensions.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -109,7 +109,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 2, SystemAudit Ace but non AuditFlags
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("auditFlags", () =>
{
isContainer = false;
isDS = false;
@@ -121,7 +121,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 3, 0 accessMask
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = false;
isDS = false;
@@ -133,7 +133,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 4, non-Container, but InheritanceFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("inheritanceFlags", () =>
{
isContainer = false;
isDS = false;
@@ -145,7 +145,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 5, non-Container, but PropagationFlags is not None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = false;
isDS = false;
@@ -157,7 +157,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 6, Container, but InheritanceFlags is None, but PropagationFlags is InheritOnly
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -169,7 +169,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 7, Container, but InheritanceFlags is None, but PropagationFlags is NoPropagateInherit
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -181,7 +181,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 8, Container, but InheritanceFlags is None, but PropagationFlags is NoPropagateInherit | InheritOnly
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("propagationFlags", () =>
{
isContainer = true;
isDS = false;
@@ -262,4 +262,4 @@ namespace System.Security.AccessControl.Tests
});
}
}
}
}

View File

@@ -118,7 +118,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 2, SystemAudit Ace but non AuditFlags
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("auditFlags", () =>
{
isContainer = false;
isDS = false;
@@ -130,7 +130,7 @@ namespace System.Security.AccessControl.Tests
});
//Case 3, 0 accessMask
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = false;
isDS = false;
@@ -201,4 +201,4 @@ namespace System.Security.AccessControl.Tests
// Non-canonical ACLs cannot be modified
}
}
}
}

View File

@@ -132,7 +132,7 @@ new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(si
//Case 3, accessMask = 0
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("accessMask", () =>
{
isContainer = true;
isDS = false;
@@ -150,7 +150,7 @@ new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(si
//Case 4, Audit Qualifier None
Assert.Throws<ArgumentException>(() =>
AssertExtensions.Throws<ArgumentException>("auditFlags", () =>
{
isContainer = true;
isDS = false;
@@ -212,4 +212,4 @@ new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(si
});
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More