Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2005-01-10 02:06:21 +0300
committerSebastien Pouliot <sebastien@ximian.com>2005-01-10 02:06:21 +0300
commit24f1097b091eddeca6a8bd42ec4ca9b5fc447a3e (patch)
tree868e3c706a2f787b4549f5b2c50f5a43e708ce73 /mcs/class/corlib/System.Security/PermissionSet.cs
parentd09e2b853936b179cb231fd878933b6d985f9656 (diff)
2005-01-09 Sebastien Pouliot <sebastien@ximian.com>
* CodeAccessPermission.cs: CheckAssert, CheckDemand, CheckDeny and CheckPermitOnly are no more publicly avaiable in Fx 2.0 and have been changed to internal for all profiles. Updated comments to reflect the (better) documentation available with 2.0. * HostSecurityManager.cs: Updated to Dec CTP specs. There is missing documentation (and/or classes) to implement completly the DetermineApplicationTrust method at this point. * PermissionSetCollection.cs: Completed implementation. * PermissionSet.cs: Fix the case where Assert, Deny and PermitOnly must be ignored for non-CAS permissions. * SecurityManager.cs: Refactored resolve methods to implements ResolveSystemPolicy (a resolve without the AppDomain policy level). Added a default implementation for GetZoneAndOrigin (empty ArrayList) which seems to be right (at least) for FullTrust. svn path=/trunk/mcs/; revision=38571
Diffstat (limited to 'mcs/class/corlib/System.Security/PermissionSet.cs')
-rw-r--r--mcs/class/corlib/System.Security/PermissionSet.cs25
1 files changed, 20 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs
index 7dc7b2ccef8..f4ed13b260f 100644
--- a/mcs/class/corlib/System.Security/PermissionSet.cs
+++ b/mcs/class/corlib/System.Security/PermissionSet.cs
@@ -7,7 +7,7 @@
//
// (C) Nick Drochak
// Portions (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -142,6 +142,8 @@ namespace System.Security {
{
new SecurityPermission (SecurityPermissionFlag.Assertion).Demand ();
+ int count = this.Count;
+
// we (current frame) must have the permission to assert it to others
// otherwise we don't assert (but we don't throw an exception)
foreach (IPermission p in list) {
@@ -150,10 +152,13 @@ namespace System.Security {
if (!SecurityManager.IsGranted (p)) {
return;
}
- }
+ } else
+ count--;
}
- throw new NotSupportedException ("Currently only declarative Assert are supported.");
+ // note: we must ignore the stack modifiers for the non-CAS permissions
+ if (count > 0)
+ throw new NotSupportedException ("Currently only declarative Assert are supported.");
}
internal void Clear ()
@@ -241,7 +246,12 @@ namespace System.Security {
[MonoTODO ("Imperative mode isn't supported")]
public virtual void Deny ()
{
- throw new NotSupportedException ("Currently only declarative Deny are supported.");
+ foreach (IPermission p in list) {
+ // note: we ignore non-CAS permissions
+ if (p is IStackWalk) {
+ throw new NotSupportedException ("Currently only declarative Deny are supported.");
+ }
+ }
}
[MonoTODO ("adjust class version with current runtime - unification")]
@@ -325,7 +335,12 @@ namespace System.Security {
[MonoTODO ("Imperative mode isn't supported")]
public virtual void PermitOnly ()
{
- throw new NotSupportedException ("Currently only declarative Deny are supported.");
+ foreach (IPermission p in list) {
+ // note: we ignore non-CAS permissions
+ if (p is IStackWalk) {
+ throw new NotSupportedException ("Currently only declarative Deny are supported.");
+ }
+ }
}
public bool ContainsNonCodeAccessPermissions ()