Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -940,6 +940,40 @@ namespace System.Security.Permissions {
// This implementation is only to silence a compiler warning.
return base.GetHashCode();
}
/// <summary>
/// Call this method if you don't need a the FileIOPermission for anything other than calling Demand() once.
///
/// This method tries to verify full access before allocating a FileIOPermission object.
/// If full access is there, then we still have to emulate the checks that creating the
/// FileIOPermission object would have performed.
///
/// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify
///
/// </summary>
/// <param name="access"></param>
/// <param name="path"></param>
/// <param name="checkForDuplicates"></param>
/// <param name="needFullPath"></param>
[System.Security.SecuritySafeCritical]
internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates, bool needFullPath)
{
if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
{
new FileIOPermission(access, new string[] { fullPath }, checkForDuplicates, needFullPath).Demand();
}
else
{
//Emulate FileIOPermission checks
Path.CheckInvalidPathChars(fullPath, true);
if (fullPath.Length > 2 && fullPath.IndexOf(':', 2) != -1)
{
throw new NotSupportedException(Environment.GetResourceString("Argument_PathFormatNotSupported"));
}
}
}
}
[Serializable]
@@ -1214,13 +1248,8 @@ namespace System.Security.Permissions {
private static String GetRoot( String path )
{
#if !PLATFORM_UNIX
String str = path.Substring( 0, 3 );
if (str.EndsWith( ":\\", StringComparison.Ordinal))
#else
String str = path.Substring( 0, 1 );
if(str == "/")
#endif // !PLATFORM_UNIX
{
return str;
}

View File

@@ -47,6 +47,11 @@ namespace System.Security.Permissions
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
#if FEATURE_CORECLR
// This needs to be in the asmmeta to enable SecAnnotate to successfully resolve and run the security rules. It gets marked
// as internal by BCLRewriter so we are simply marking it as FriendAccessAllowed so it stays in the asmmeta.
[System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
#endif // FEATURE_CORECLR
#pragma warning disable 618
sealed public class HostProtectionAttribute : CodeAccessSecurityAttribute
#pragma warning restore 618

View File

@@ -5,7 +5,7 @@
// ==--==
// IBuiltInPermission.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>ShawnFa</OWNER>
//
namespace System.Security.Permissions

View File

@@ -5,7 +5,7 @@
// ==--==
// IUnrestrictedPermission.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>ShawnFa</OWNER>
//
namespace System.Security.Permissions {

View File

@@ -5,7 +5,7 @@
// ==--==
// PermissionState.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>ShawnFa</OWNER>
//
// The Runtime policy manager. Maintains a set of IdentityMapper objects that map
// inbound evidence to groups. Resolves an identity into a set of permissions