Author: spouliot
Date: 2005-03-24 10:11:54 -0500 (Thu, 24 Mar 2005)
New Revision: 42219
Modified:
trunk/mcs/class/corlib/System.Security/ChangeLog
trunk/mcs/class/corlib/System.Security/CodeAccessPermission.cs
trunk/mcs/class/corlib/System.Security/PermissionSet.cs
trunk/mcs/class/corlib/System.Security/SecurityException.cs
Log:
2005-03-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* CodeAccessPermission.cs: Fixed PermitOnly when used in a set. Added
an InheritanceDemand for ControlEvidence and ControlPolicy on the
class.
* PermissionSet.cs: Added an InheritanceDemand for MS public key on
class.
* SecurityException.cs: Moved PermissionType up in ToString as this
property isn't restricted (i.e. will be part of the output even if
the other properties can't make it).
Modified: trunk/mcs/class/corlib/System.Security/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Security/ChangeLog 2005-03-24 15:02:25 UTC
(rev 42218)
+++ trunk/mcs/class/corlib/System.Security/ChangeLog 2005-03-24 15:11:54 UTC
(rev 42219)
@@ -1,3 +1,14 @@
+2005-03-24 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * CodeAccessPermission.cs: Fixed PermitOnly when used in a set. Added
+ an InheritanceDemand for ControlEvidence and ControlPolicy on the
+ class.
+ * PermissionSet.cs: Added an InheritanceDemand for MS public key on
+ class.
+ * SecurityException.cs: Moved PermissionType up in ToString as this
+ property isn't restricted (i.e. will be part of the output even if
+ the other properties can't make it).
+
2005-03-15 Sebastien Pouliot <[EMAIL PROTECTED]>
* CodeAccessPermission.cs: Fixed depth for starting the stack walk
Modified: trunk/mcs/class/corlib/System.Security/CodeAccessPermission.cs
===================================================================
--- trunk/mcs/class/corlib/System.Security/CodeAccessPermission.cs
2005-03-24 15:02:25 UTC (rev 42218)
+++ trunk/mcs/class/corlib/System.Security/CodeAccessPermission.cs
2005-03-24 15:11:54 UTC (rev 42219)
@@ -42,6 +42,7 @@
namespace System.Security {
[Serializable]
+ [SecurityPermission (SecurityAction.InheritanceDemand, ControlEvidence
= true, ControlPolicy = true)]
public abstract class CodeAccessPermission : IPermission,
ISecurityEncodable, IStackWalk {
protected CodeAccessPermission ()
@@ -335,10 +336,18 @@
// 2. CheckPermitOnly
if (frame.PermitOnly != null) {
+ // the demanded permission must be in one of
the permitted...
+ bool permit = false;
foreach (IPermission p in frame.PermitOnly) {
- if (!CheckPermitOnly (p as
CodeAccessPermission))
- ThrowSecurityException (this,
"PermitOnly", current, frame.Method, SecurityAction.Demand, p);
+ if (CheckPermitOnly (p as
CodeAccessPermission)) {
+ permit = true;
+ break;
+ }
}
+ if (!permit) {
+ // ...or else we throw
+ ThrowSecurityException (this,
"PermitOnly", current, frame.Method, SecurityAction.Demand, null);
+ }
}
// 3. CheckDeny
Modified: trunk/mcs/class/corlib/System.Security/PermissionSet.cs
===================================================================
--- trunk/mcs/class/corlib/System.Security/PermissionSet.cs 2005-03-24
15:02:25 UTC (rev 42218)
+++ trunk/mcs/class/corlib/System.Security/PermissionSet.cs 2005-03-24
15:11:54 UTC (rev 42219)
@@ -44,6 +44,8 @@
namespace System.Security {
[Serializable]
+ // Microsoft public key - i.e. only MS signed assembly can inherit from
PermissionSet (1.x) or (2.0) FullTrust assemblies
+ [StrongNameIdentityPermission (SecurityAction.InheritanceDemand,
PublicKey="002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")]
public class PermissionSet: ISecurityEncodable, ICollection,
IEnumerable, IStackWalk, IDeserializationCallback {
private static string tagName = "PermissionSet";
@@ -660,7 +662,7 @@
CodeAccessPermission.ThrowSecurityException (this, "Deny", frame.Assembly,
frame.Method,
SecurityAction.Demand, null);
} else if (frame.PermitOnly != null) {
- // but have restrictions (onyl some
permitted permissions)
+ // but have restrictions (only some
permitted permissions)
CodeAccessPermission.ThrowSecurityException (this, "PermitOnly", frame.Assembly,
frame.Method,
SecurityAction.Demand, null);
}
Modified: trunk/mcs/class/corlib/System.Security/SecurityException.cs
===================================================================
--- trunk/mcs/class/corlib/System.Security/SecurityException.cs 2005-03-24
15:02:25 UTC (rev 42218)
+++ trunk/mcs/class/corlib/System.Security/SecurityException.cs 2005-03-24
15:11:54 UTC (rev 42219)
@@ -273,6 +273,9 @@
{
StringBuilder sb = new StringBuilder (base.ToString ());
try {
+ if (permissionType != null) {
+ sb.AppendFormat ("{0}Type: {1}",
Environment.NewLine, PermissionType);
+ }
if (_method != null) {
// method string representation doesn't
include the type
string m = _method.ToString ();
@@ -283,9 +286,6 @@
if (permissionState != null) {
sb.AppendFormat ("{0}State: {1}",
Environment.NewLine, PermissionState);
}
- if (permissionType != null) {
- sb.AppendFormat ("{0}Type: {1}",
Environment.NewLine, PermissionType);
- }
if ((_granted != null) && (_granted.Length >
0)) {
sb.AppendFormat ("{0}Granted: {1}",
Environment.NewLine, GrantedSet);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches