Author: spouliot
Date: 2005-06-14 10:17:53 -0400 (Tue, 14 Jun 2005)
New Revision: 45969

Modified:
   trunk/mcs/class/corlib/System.Reflection/Assembly.cs
   trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs
   trunk/mcs/class/corlib/System.Reflection/ChangeLog
Log:
2005-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * Assembly.cs: UnprotectedGetName is now virtual to allow for more
        initialization in AssemblyBuilder. The [Granted|Refused]PermissionSet
        now use the ResolvingPolicyLevel to support the policy 
        FullTrustAssemblies during resolution.
        * AssemblyName.cs: Return null instead of "new byte [0]" if no public
        key is available.



Modified: trunk/mcs/class/corlib/System.Reflection/Assembly.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/Assembly.cs        2005-06-14 
14:14:36 UTC (rev 45968)
+++ trunk/mcs/class/corlib/System.Reflection/Assembly.cs        2005-06-14 
14:17:53 UTC (rev 45969)
@@ -354,7 +354,7 @@
                }
 
                // the security runtime requires access to the assemblyname 
(e.g. to get the strongname)
-               internal AssemblyName UnprotectedGetName ()
+               internal virtual AssemblyName UnprotectedGetName ()
                {
                        AssemblyName aname = new AssemblyName ();
                        FillName (this, aname);
@@ -795,6 +795,12 @@
                internal PermissionSet GrantedPermissionSet {
                        get {
                                if (_granted == null) {
+                                       if 
(SecurityManager.ResolvingPolicyLevel != null) {
+                                               if 
(SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
+                                                       return 
DefaultPolicies.FullTrust;
+                                               else
+                                                       return null; // we 
can't resolve during resolution
+                                       }
                                        Resolve ();
                                }
                                return _granted;
@@ -805,6 +811,12 @@
                        get {
                                // yes we look for granted, as denied may be 
null
                                if (_granted == null) {
+                                       if 
(SecurityManager.ResolvingPolicyLevel != null) {
+                                               if 
(SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
+                                                       return null;
+                                               else
+                                                       return 
DefaultPolicies.FullTrust; // deny unrestricted
+                                       }
                                        Resolve ();
                                }
                                return _denied;

Modified: trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs    2005-06-14 
14:14:36 UTC (rev 45968)
+++ trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs    2005-06-14 
14:17:53 UTC (rev 45969)
@@ -211,13 +211,9 @@
 
                public byte[] GetPublicKey() 
                {
-                       // to match MS implementation -- funny one
-                       if (publicKey != null)
-                               return publicKey;
-                       else if (name == null)
-                               return null;
-                       else
-                               return new byte [0];
+                       return publicKey;
+                       // FIXME: In some cases MS implementation returns 
+                       // "new byte [0]" instead of null
                }
 
                public byte[] GetPublicKeyToken() 

Modified: trunk/mcs/class/corlib/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/ChangeLog  2005-06-14 14:14:36 UTC 
(rev 45968)
+++ trunk/mcs/class/corlib/System.Reflection/ChangeLog  2005-06-14 14:17:53 UTC 
(rev 45969)
@@ -1,3 +1,12 @@
+2005-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * Assembly.cs: UnprotectedGetName is now virtual to allow for more
+       initialization in AssemblyBuilder. The [Granted|Refused]PermissionSet
+       now use the ResolvingPolicyLevel to support the policy 
+       FullTrustAssemblies during resolution.
+       * AssemblyName.cs: Return null instead of "new byte [0]" if no public
+       key is available.
+
 2005-06-09  Kamil Skalski <[EMAIL PROTECTED]>
        * MonoGenericClass.cs: Add overrides of Get{Method,Constructor,Field} 
        for obtaining instanciated *Info objects from non-instanciated 
counterparts

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to