diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-16 16:16:51 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-16 16:16:51 +0400 |
commit | b7c5fd436242f9d07b71f954c23b1ba7ce97a6c2 (patch) | |
tree | f725ae5f4593a7c3a445f441a2072dd25fab1705 /mcs/class/corlib/System.Security/SecurityManager.cs | |
parent | baad260a4a6d03fb2e145810d9110e2bf733108f (diff) |
2005-06-16 Sebastien Pouliot <sebastien@ximian.com>
* SecurityManager.cs: Simplified LinkDemandFullTrust as FullTrust is
immutable.
svn path=/trunk/mcs/; revision=46086
Diffstat (limited to 'mcs/class/corlib/System.Security/SecurityManager.cs')
-rw-r--r-- | mcs/class/corlib/System.Security/SecurityManager.cs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs index 3ca8d108bd4..f10e94f3e3c 100644 --- a/mcs/class/corlib/System.Security/SecurityManager.cs +++ b/mcs/class/corlib/System.Security/SecurityManager.cs @@ -679,20 +679,17 @@ namespace System.Security { private static bool LinkDemandFullTrust (Assembly a) { - // double-lock pattern - if (_fullTrust == null) { - lock (_lockObject) { - if (_fullTrust == null) - _fullTrust = new NamedPermissionSet ("FullTrust"); - } - } + // FullTrust is immutable (and means Unrestricted) + // so we can skip the subset operations and jump to IsUnrestricted. + PermissionSet granted = a.GrantedPermissionSet; + if ((granted != null) && !granted.IsUnrestricted ()) + return false; - try { - return (SecurityManager.CheckPermissionSet (a, _fullTrust, false) == null); - } - catch (SecurityException) { + PermissionSet denied = a.DeniedPermissionSet; + if ((denied != null) && !denied.IsEmpty ()) return false; - } + + return true; } private static bool LinkDemandUnmanaged (Assembly a) |