Author: spouliot
Date: 2005-03-15 08:04:26 -0500 (Tue, 15 Mar 2005)
New Revision: 41835
Added:
trunk/mono/mono/tests/cas/demand/selfassert.cs
trunk/mono/mono/tests/cas/demand/selfdeny.cs
trunk/mono/mono/tests/cas/demand/selfpermit.cs
Modified:
trunk/mono/mono/tests/cas/demand/Makefile
trunk/mono/mono/tests/cas/demand/README
Log:
Modified: trunk/mono/mono/tests/cas/demand/Makefile
===================================================================
--- trunk/mono/mono/tests/cas/demand/Makefile 2005-03-15 13:03:49 UTC (rev
41834)
+++ trunk/mono/mono/tests/cas/demand/Makefile 2005-03-15 13:04:26 UTC (rev
41835)
@@ -3,13 +3,16 @@
PROFILE = net_1_1
all: pinvoke1.exe pinvoke2.exe pinvoke3.exe \
- sucs1.exe sucs2.exe sucs3.exe sucs4.exe
+ sucs1.exe sucs2.exe sucs3.exe sucs4.exe \
+ selfassert.exe selfdeny.exe selfpermit.exe
aot: pinvoke1.exe.so pinvoke2.exe.so pinvoke3.exe.so \
- sucs1.exe.so sucs2.exe.so sucs3.exe.so sucs4.exe.so
+ sucs1.exe.so sucs2.exe.so sucs3.exe.so sucs4.exe.so \
+ selfassert.exe.so selfdeny.exe.so selfpermit.exe.so
FULLTRUST_TEST_FILES = pinvoke1 pinvoke2 pinvoke3 \
- sucs1 sucs2 sucs3 sucs4
+ sucs1 sucs2 sucs3 sucs4 \
+ selfassert selfdeny selfpermit
UNHANDLED_TEST_FILES =
Modified: trunk/mono/mono/tests/cas/demand/README
===================================================================
--- trunk/mono/mono/tests/cas/demand/README 2005-03-15 13:03:49 UTC (rev
41834)
+++ trunk/mono/mono/tests/cas/demand/README 2005-03-15 13:04:26 UTC (rev
41835)
@@ -27,3 +27,17 @@
Notes
- With Mono runtime the native function getuid is called in libc
- With MS runtime the native function GetTickCount is called in kernel32.dll
+
+
+** Self
+
+Stack walk starts at the caller frame - i.e. the current frame is ignored. The
+self*.cs tests ensure that the walk starts at the right frame (or at least
+that it ignore the caller frame).
+
+selfassert.cs Deny on caller, Assert and Demand on callee. Assert is
+ ignored, Demand is executed and fail on caller's Deny.
+selfdeny.cs Deny and Demand on the same frame. Deny is ignored. Demand is
+ executed (stack walk).
+selfpermit.cs PermitOnly Unmanaged, Demand ControlAppDomain. PermitOnly is
+ ignored and Demand (for ControlAppDomain) succeed.
Added: trunk/mono/mono/tests/cas/demand/selfassert.cs
===================================================================
--- trunk/mono/mono/tests/cas/demand/selfassert.cs 2005-03-15 13:03:49 UTC
(rev 41834)
+++ trunk/mono/mono/tests/cas/demand/selfassert.cs 2005-03-15 13:04:26 UTC
(rev 41835)
@@ -0,0 +1,28 @@
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+public class Program {
+
+ [SecurityPermission (SecurityAction.Assert, UnmanagedCode=true)]
+ [SecurityPermission (SecurityAction.Demand, UnmanagedCode=true)]
+ static int Test ()
+ {
+ return 1;
+ }
+
+ [SecurityPermission (SecurityAction.Deny, UnmanagedCode=true)]
+ static int Main ()
+ {
+ int result = 2;
+ try {
+ result = Test ();
+ Console.WriteLine ("*1* Unexpected call to Test");
+ }
+ catch (SecurityException se) {
+ result = 0;
+ Console.WriteLine ("*0* Expected
SecurityException\n{0}", se);
+ }
+ return result;
+ }
+}
Added: trunk/mono/mono/tests/cas/demand/selfdeny.cs
===================================================================
--- trunk/mono/mono/tests/cas/demand/selfdeny.cs 2005-03-15 13:03:49 UTC
(rev 41834)
+++ trunk/mono/mono/tests/cas/demand/selfdeny.cs 2005-03-15 13:04:26 UTC
(rev 41835)
@@ -0,0 +1,18 @@
+using System;
+using System.Security.Permissions;
+
+public class Program {
+
+ [SecurityPermission (SecurityAction.Deny, UnmanagedCode=true)]
+ [SecurityPermission (SecurityAction.Demand, UnmanagedCode=true)]
+ static int Test ()
+ {
+ Console.WriteLine ("*0* Expected call to Test()");
+ return 0;
+ }
+
+ static int Main ()
+ {
+ return Test ();
+ }
+}
Added: trunk/mono/mono/tests/cas/demand/selfpermit.cs
===================================================================
--- trunk/mono/mono/tests/cas/demand/selfpermit.cs 2005-03-15 13:03:49 UTC
(rev 41834)
+++ trunk/mono/mono/tests/cas/demand/selfpermit.cs 2005-03-15 13:04:26 UTC
(rev 41835)
@@ -0,0 +1,19 @@
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+public class Program {
+
+ [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode=true)]
+ [SecurityPermission (SecurityAction.Demand, ControlAppDomain=true)]
+ static int Test ()
+ {
+ Console.WriteLine ("*0* Expected call to Test()");
+ return 0;
+ }
+
+ static int Main ()
+ {
+ return Test ();
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches