[Mono-bugs] [Bug 75877][Wis] New - DnsPermission error while creating AppDomain policy

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 22 14:38:45 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sp2kn at virginia.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=75877

--- shadow/75877	2005-08-22 14:38:45.000000000 -0400
+++ shadow/75877.tmp.17892	2005-08-22 14:38:45.000000000 -0400
@@ -0,0 +1,95 @@
+Bug#: 75877
+Product: Mono: Runtime
+Version: 1.1
+OS: Red Hat 9.0
+OS Details: 2.6.12-1.1372_FC3
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: sp2kn at virginia.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DnsPermission error while creating AppDomain policy
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+
+Description of Problem:
+
+When '  PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();'
+is called follwing error is generated           
+
+** ERROR **: pending init System.Net.DnsPermission
+
+Steps to reproduce the problem:
+1. mono --security test.exe 'someapp.exe'
+2. 
+3. 
+
+Actual Results:
+
+** ERROR **: pending init System.Net.DnsPermission
+
+Expected Results:
+
+
+How often does this happen? 
+
+Always
+
+Additional Information:
+
+
+Here's the source code 
+--------------------------------------------------
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+class test{
+        static AppDomain CreateRestrictedDomain ()
+        {
+             PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();
+             FirstMatchCodeGroup root = new FirstMatchCodeGroup(
+                        new AllMembershipCondition(),
+                        new PolicyStatement(new PermissionSet
+(PermissionState.None)));
+
+             UnionCodeGroup child = new UnionCodeGroup(
+                        new AllMembershipCondition(),new PolicyStatement(
+                        new PermissionSet(PermissionState.None)));
+
+             root.AddChild(child);
+
+            policy.RootCodeGroup = root;
+            AppDomain ad = AppDomain.CreateDomain ("Restricted");
+
+             ad.SetAppDomainPolicy (policy);
+             return ad;
+        }
+
+           static int Main (string[] args)
+        {
+                switch (args.Length) {
+                case 0:
+                        Console.WriteLine ("Create a restricted sandbox 
+to execute an assembly.");
+                        Console.WriteLine ("Usage: mono sandbox.exe 
+[@namedpermissionset | permissionset.xml] assembly.exe [parameters ...]");
+                        return 0;
+                case 1:
+                        AppDomain ad = CreateRestrictedDomain ();
+                        return ad.ExecuteAssembly (args [0]);
+                default:
+                        return 0;
+                }
+        }
+}
+~


More information about the mono-bugs mailing list