Author: spouliot
Date: 2005-06-16 08:01:55 -0400 (Thu, 16 Jun 2005)
New Revision: 46084
Modified:
trunk/mono/mono/tests/cas/linkdemand/ChangeLog
trunk/mono/mono/tests/cas/linkdemand/Makefile
trunk/mono/mono/tests/cas/linkdemand/README
trunk/mono/mono/tests/cas/linkdemand/aptc1.cs
trunk/mono/mono/tests/cas/linkdemand/aptc2.cs
trunk/mono/mono/tests/cas/linkdemand/icall1.cs
Log:
2005-06-16 Sebastien Pouliot <[EMAIL PROTECTED]>
* aptc1.cs: Add a RequestRefuse for SkipVerification when RESTRICT is
defined.
* aptc2.cs: Add a RequestRefuse for SkipVerification when RESTRICT is
defined. Change IsSigned() for IsRestricted().
* icall1.cs: Fix typos.
* Makefile: Changed compilation for aptc*.cs. Removed icall5.cs from
testing (until I figure out exactly the rules being used).
* README: Updated informations about the APTC tests.
Modified: trunk/mono/mono/tests/cas/linkdemand/ChangeLog
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/ChangeLog 2005-06-16 11:57:10 UTC
(rev 46083)
+++ trunk/mono/mono/tests/cas/linkdemand/ChangeLog 2005-06-16 12:01:55 UTC
(rev 46084)
@@ -1,3 +1,14 @@
+2005-06-16 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * aptc1.cs: Add a RequestRefuse for SkipVerification when RESTRICT is
+ defined.
+ * aptc2.cs: Add a RequestRefuse for SkipVerification when RESTRICT is
+ defined. Change IsSigned() for IsRestricted().
+ * icall1.cs: Fix typos.
+ * Makefile: Changed compilation for aptc*.cs. Removed icall5.cs from
+ testing (until I figure out exactly the rules being used).
+ * README: Updated informations about the APTC tests.
+
2005-03-14 Sebastien Pouliot <[EMAIL PROTECTED]>
* icall1.cs: Fixed test to work on NET_2_0. We're now accepting the
Modified: trunk/mono/mono/tests/cas/linkdemand/Makefile
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/Makefile 2005-06-16 11:57:10 UTC
(rev 46083)
+++ trunk/mono/mono/tests/cas/linkdemand/Makefile 2005-06-16 12:01:55 UTC
(rev 46084)
@@ -4,10 +4,10 @@
compiler_defines = -d:NET_1_1
ifeq ($(PROFILE), net_2_0)
-CSCOMPILE = gmcs --debug
+CSCOMPILE = gmcs -debug
compiler_defines += -d:NET_2_0
else
-CSCOMPILE = mcs --debug
+CSCOMPILE = mcs -debug
endif
all: icall1.exe icall2.exe icall3.exe icall4.exe icall5.exe icall6.exe \
@@ -25,22 +25,19 @@
refcas1.exe.so refcas2.exe.so refcas3.exe.so refcas4.exe.so
refcas5.exe.so \
noncas1.exe.so noncas2.exe.so noncas3.exe.so noncas4.exe.so
-FULLTRUST_TEST_FILES = icall1 icall2 icall3 icall4 icall5 icall6 \
- aptc1a aptc1b aptc2a aptc2b \
+FULLTRUST_TEST_FILES = icall1 icall2 icall3 icall4 icall6 \
+ aptc1a aptc1b aptc2a \
pinvoke1 pinvoke2 pinvoke4 \
cas1 cas3 cas6 cas7 cas8 cas9 \
refcas1 refcas2 refcas3 refcas4 \
noncas1 noncas2 noncas3 noncas4
-UNHANDLED_TEST_FILES = cas2 pinvoke3
+UNHANDLED_TEST_FILES = aptc2b cas2 pinvoke3
run: all
@for i in $(FULLTRUST_TEST_FILES); do \
$(RUNTIME) $$i.exe; \
done;
- @for i in $(INTERNET_TEST_FILES); do \
- MONO_CAS_ZONE=Internet $(RUNTIME) $$i.exe; \
- done;
test: all
@failed=0; \
@@ -89,13 +86,13 @@
$(CSCOMPILE) $^ /out:$@ /keyfile:ecma.pub /delaysign+
$(compiler_defines)
aptc1b.exe: aptc1.cs aptc.snk
- $(CSCOMPILE) aptc1.cs /out:$@ /keyfile:aptc.snk $(compiler_defines)
+ $(CSCOMPILE) aptc1.cs /out:$@ /d:RESTRICT $(compiler_defines)
aptc2a.exe: aptc2.cs aptclib.dll
$(CSCOMPILE) aptc2.cs /out:$@ /r:aptclib.dll $(compiler_defines)
aptc2b.exe: aptc2.cs aptclib.dll
- $(CSCOMPILE) aptc2.cs /out:$@ /keyfile:aptc.snk /r:aptclib.dll
$(compiler_defines)
+ $(CSCOMPILE) aptc2.cs /out:$@ /d:RESTRICT /r:aptclib.dll
$(compiler_defines)
aptclib.dll: aptclib.cs aptc.snk
$(CSCOMPILE) aptclib.cs /out:$@ /target:library /keyfile:aptc.snk
$(compiler_defines)
Modified: trunk/mono/mono/tests/cas/linkdemand/README
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/README 2005-06-16 11:57:10 UTC (rev
46083)
+++ trunk/mono/mono/tests/cas/linkdemand/README 2005-06-16 12:01:55 UTC (rev
46084)
@@ -75,15 +75,13 @@
The files aptc1.cs and aptc2.cs are compiled twice.
-The first time the files are compiled without a public key (no strongname).
-This means that the security manager (if active) will allow the call to
-succeed _only if_
- (a) the calling assembly is strongnamed;
+The first time the files are compiled without restrictions (e.g. they have
+FullTrust by default). The second time SkipVerification is refused at the
+asssembly level (i.e. resulting in less than FullTrust). This means that the
+security manager (if active) will allow the call to succeed _only if_
+
+ (a) the calling assembly has FullTrust;
(b) the called assembly has a [AllowPartiallyTustedCallers] attribute
-The second compilation strongname the assemblies. This means that this
-will always succeed in calling other strongnamed assemblies (with or
-without APTC).
-
[1] For example an unsigned assembly can calls System.Console.WriteLine only
because mscorlib.dll contains the [AllowPartiallyTustedCallers].
Modified: trunk/mono/mono/tests/cas/linkdemand/aptc1.cs
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/aptc1.cs 2005-06-16 11:57:10 UTC
(rev 46083)
+++ trunk/mono/mono/tests/cas/linkdemand/aptc1.cs 2005-06-16 12:01:55 UTC
(rev 46084)
@@ -1,6 +1,12 @@
using System;
using System.Security;
+using System.Security.Permissions;
+#if RESTRICT
+// this ensure we don't have FullTrust
+[assembly: SecurityPermission (SecurityAction.RequestRefuse, SkipVerification
= true)]
+#endif
+
public class Program {
static int Main ()
Modified: trunk/mono/mono/tests/cas/linkdemand/aptc2.cs
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/aptc2.cs 2005-06-16 11:57:10 UTC
(rev 46083)
+++ trunk/mono/mono/tests/cas/linkdemand/aptc2.cs 2005-06-16 12:01:55 UTC
(rev 46084)
@@ -1,15 +1,24 @@
using System;
using System.Reflection;
-//using System.Runtime.CompilerServices;
using System.Security;
+using System.Security.Permissions;
using Mono.Test;
+#if RESTRICT
+// this ensure we don't have FullTrust
+[assembly: SecurityPermission (SecurityAction.RequestRefuse, SkipVerification
= true)]
+#endif
+
public class Program {
- static bool IsSigned ()
+ static bool IsRestricted ()
{
- return (Assembly.GetExecutingAssembly ().GetName
().GetPublicKey () != null);
+#if RESTRICT
+ return true;
+#else
+ return false;
+#endif
}
static int Main ()
@@ -18,12 +27,12 @@
// aptclib.dll is strongnamed and DOESN'T have
[AllowPartiallyTrustedCallers]
// so this call will work ONLY IF this assembly IS
strongnamed
string s = AptcLibrary.Hello ("World");
- int ec = IsSigned () ? 0 : 1;
+ int ec = IsRestricted () ? 1 : 0;
Console.WriteLine ("*{0}* AptcLibrary: {1}", ec, s);
return ec;
}
catch (SecurityException se) {
- int ec = IsSigned () ? 1 : 0;
+ int ec = IsRestricted () ? 0 : 1;
Console.WriteLine ("*{0}* Expected
SecurityException\n{1}", ec, se);
return ec;
}
Modified: trunk/mono/mono/tests/cas/linkdemand/icall1.cs
===================================================================
--- trunk/mono/mono/tests/cas/linkdemand/icall1.cs 2005-06-16 11:57:10 UTC
(rev 46083)
+++ trunk/mono/mono/tests/cas/linkdemand/icall1.cs 2005-06-16 12:01:55 UTC
(rev 46084)
@@ -53,9 +53,9 @@
#endif
}
#if NET_2_0
- Console.WriteLine ("*0* Excepted internal call: {0}",
result);
+ Console.WriteLine ("*0* Expected internal call: {0}",
result);
#else
- Console.WriteLine ("*0* Unexcepted (1.x) but accepted
(like 2.x) internal call: {0}", result);
+ Console.WriteLine ("*0* Unexpected (1.x) but accepted
(like 2.x) internal call: {0}", result);
#endif
return 0;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches