You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -2,7 +2,10 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<AssemblyVersion>4.1.1.0</AssemblyVersion>
|
||||
<AssemblyKey>MSFT</AssemblyKey>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
<IsNetFxNETStandard>true</IsNetFxNETStandard>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
netfx;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
|
@ -6,4 +6,6 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.SecureString))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.SecureStringMarshal))]
|
||||
#if !netfx
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.SecureStringMarshal))]
|
||||
#endif // !netfx
|
@ -4,17 +4,24 @@
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ProjectGuid>{899EC05D-7861-447F-9216-67F8547516DD}</ProjectGuid>
|
||||
<DefineConstants Condition="'$(TargetGroup)' == 'netfx'">$(DefineConstants);netfx</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Security.SecureString.cs" />
|
||||
<Compile Condition="'$(TargetGroup)' == 'netfx'" Include="System.Security.SecureString.netfx.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
|
||||
<Reference Include="mscorlib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
14
external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.netfx.cs
vendored
Normal file
14
external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.netfx.cs
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Security
|
||||
{
|
||||
public static partial class SecureStringMarshal
|
||||
{
|
||||
public static System.IntPtr SecureStringToCoTaskMemAnsi(System.Security.SecureString s) { throw null; }
|
||||
public static System.IntPtr SecureStringToCoTaskMemUnicode(System.Security.SecureString s) { throw null; }
|
||||
public static System.IntPtr SecureStringToGlobalAllocAnsi(System.Security.SecureString s) { throw null; }
|
||||
public static System.IntPtr SecureStringToGlobalAllocUnicode(System.Security.SecureString s) { throw null; }
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
<BuildConfigurations>
|
||||
uap-Windows_NT;
|
||||
netcoreapp;
|
||||
netfx;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -7,14 +7,21 @@
|
||||
<AssemblyName>System.Security.SecureString</AssemblyName>
|
||||
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
|
||||
<Compile Include="System\Security\SecureStringMarshal.netfx.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.InteropServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
|
||||
<Reference Include="mscorlib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
@ -0,0 +1,16 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Security
|
||||
{
|
||||
public static class SecureStringMarshal
|
||||
{
|
||||
public static IntPtr SecureStringToCoTaskMemAnsi(SecureString s) => Marshal.SecureStringToCoTaskMemAnsi(s);
|
||||
public static IntPtr SecureStringToGlobalAllocAnsi(SecureString s) => Marshal.SecureStringToGlobalAllocAnsi(s);
|
||||
public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s) => Marshal.SecureStringToCoTaskMemUnicode(s);
|
||||
public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s) => Marshal.SecureStringToGlobalAllocUnicode(s);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@ -29,9 +30,9 @@ namespace System.Security.Tests
|
||||
[Fact]
|
||||
public static unsafe void Ctor_CharInt_Invalid()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("value", () => new SecureString(null, 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("length", () => { fixed (char* chars = "test") new SecureString(chars, -1); });
|
||||
Assert.Throws<ArgumentOutOfRangeException>("length", () => CreateSecureString(CreateString(ushort.MaxValue + 2 /*65537: Max allowed length is 65536*/)));
|
||||
AssertExtensions.Throws<ArgumentNullException>("value", () => new SecureString(null, 0));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("length", () => { fixed (char* chars = "test") new SecureString(chars, -1); });
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("length", () => CreateSecureString(CreateString(ushort.MaxValue + 2 /*65537: Max allowed length is 65536*/)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -55,7 +56,7 @@ namespace System.Security.Tests
|
||||
{
|
||||
using (SecureString ss = CreateSecureString(CreateString(ushort.MaxValue + 1)))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => ss.AppendChar('a'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("capacity", () => ss.AppendChar('a'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,13 +199,13 @@ namespace System.Security.Tests
|
||||
{
|
||||
using (SecureString testString = CreateSecureString("bd"))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.InsertAt(-1, 'S'));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.InsertAt(6, 'S'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.InsertAt(-1, 'S'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.InsertAt(6, 'S'));
|
||||
}
|
||||
|
||||
using (SecureString testString = CreateSecureString(CreateString(ushort.MaxValue + 1)))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => testString.InsertAt(22, 'S'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("capacity", () => testString.InsertAt(22, 'S'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,9 +257,9 @@ namespace System.Security.Tests
|
||||
{
|
||||
using (SecureString testString = CreateSecureString("test"))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(testString.Length));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(testString.Length + 1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(-1));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(testString.Length));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.RemoveAt(testString.Length + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,19 +293,19 @@ namespace System.Security.Tests
|
||||
{
|
||||
using (SecureString testString = CreateSecureString("test"))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(-1, 'a'));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(testString.Length, 'b'));
|
||||
Assert.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(testString.Length + 1, 'c'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(-1, 'a'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(testString.Length, 'b'));
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => testString.SetAt(testString.Length + 1, 'c'));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void SecureStringMarshal_NullArgsAllowed_IntPtrZero()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToCoTaskMemAnsi(null));
|
||||
Assert.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToCoTaskMemUnicode(null));
|
||||
Assert.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToGlobalAllocAnsi(null));
|
||||
Assert.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToGlobalAllocUnicode(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToCoTaskMemAnsi(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToCoTaskMemUnicode(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToGlobalAllocAnsi(null));
|
||||
AssertExtensions.Throws<ArgumentNullException>("s", () => SecureStringMarshal.SecureStringToGlobalAllocUnicode(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -10,6 +10,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="SecureStringTests.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
|
||||
<Link>Common\System\AssertExtensions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
Reference in New Issue
Block a user