Author: spouliot
Date: 2005-04-04 08:23:01 -0400 (Mon, 04 Apr 2005)
New Revision: 42512

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

        * AssemblyName.cs: Implemented EscapedCodeBase using the copy of 
        System.Uri (System.dll) located in Mono.Security.Uri. Added missing
        null check in GetObjectData.
        * Module.cs: Added a FileIOPermission for PathDiscovery on 
        FullyQualifiedName property (but not on Name property like MS).
        Added missing null check in GetObjectData.



Modified: trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs    2005-04-04 
12:07:51 UTC (rev 42511)
+++ trunk/mcs/class/corlib/System.Reflection/AssemblyName.cs    2005-04-04 
12:23:01 UTC (rev 42512)
@@ -7,7 +7,7 @@
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 // Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -29,16 +29,16 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Configuration.Assemblies;
 using System.Globalization;
-using System.Reflection;
 using System.Runtime.Serialization;
 using System.Security.Cryptography;
 using System.Text;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 
+using Mono.Security;
+
 namespace System.Reflection {
 
 // References:
@@ -98,17 +98,12 @@
                        set { codebase = value; }
                }
 
-               [MonoTODO("RFC 2396")]
-               private string Escape (string url) 
-               {
-                       // we already have code in 
mcs\class\System\System\Uri.cs
-                       // but Uri class ins't part of corlib !
-                       // TODO
-                       return url;
-               }
-
                public string EscapedCodeBase {
-                       get { return Escape (codebase); }
+                       get {
+                               if (codebase == null)
+                                       return null;
+                               return Uri.EscapeString (codebase, false, true, 
true);
+                       }
                }
 
                public CultureInfo CultureInfo {
@@ -249,6 +244,9 @@
 
                public void GetObjectData (SerializationInfo info, 
StreamingContext context)
                {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
                        info.AddValue ("_Name", name);
                        info.AddValue ("_PublicKey", publicKey);
                        info.AddValue ("_PublicToken", keyToken);

Modified: trunk/mcs/class/corlib/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/ChangeLog  2005-04-04 12:07:51 UTC 
(rev 42511)
+++ trunk/mcs/class/corlib/System.Reflection/ChangeLog  2005-04-04 12:23:01 UTC 
(rev 42512)
@@ -1,3 +1,12 @@
+2005-04-04  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * AssemblyName.cs: Implemented EscapedCodeBase using the copy of 
+       System.Uri (System.dll) located in Mono.Security.Uri. Added missing
+       null check in GetObjectData.
+       * Module.cs: Added a FileIOPermission for PathDiscovery on 
+       FullyQualifiedName property (but not on Name property like MS).
+       Added missing null check in GetObjectData.
+
 2005-03-30  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * Binder.cs (check_type): Fix byref support. Fixes #73972.

Modified: trunk/mcs/class/corlib/System.Reflection/Module.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/Module.cs  2005-04-04 12:07:51 UTC 
(rev 42511)
+++ trunk/mcs/class/corlib/System.Reflection/Module.cs  2005-04-04 12:23:01 UTC 
(rev 42512)
@@ -27,12 +27,11 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
-using System.Reflection;
 using System.Runtime.Serialization;
 using System.Security.Cryptography.X509Certificates;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
+using System.Security;
 using System.Security.Permissions;
 
 namespace System.Reflection {
@@ -73,9 +72,16 @@
                }
        
                public virtual string FullyQualifiedName {
-                       get { return fqname; }
+                       get {
+                               if (SecurityManager.SecurityEnabled) {
+                                       new FileIOPermission 
(FileIOPermissionAccess.PathDiscovery, fqname).Demand ();
+                               }
+                               return fqname;
+                       }
                }
-       
+
+               // Note: we do not ask for PathDiscovery because no path is 
returned here.
+               // However MS Fx requires it (see FDBK23572 for details).
                public string Name {
                        get { return name; }
                }
@@ -200,6 +206,9 @@
                [SecurityPermission (SecurityAction.LinkDemand, 
SerializationFormatter = true)]
                public virtual void GetObjectData (SerializationInfo info, 
StreamingContext context) 
                {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
                        UnitySerializationHolder.GetModuleData (this, info, 
context);
                }
        

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

Reply via email to