2005-04-25 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Mon, 25 Apr 2005 16:25:03 +0000 (16:25 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Mon, 25 Apr 2005 16:25:03 +0000 (16:25 -0000)
* AllMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* ApplicationDirectory.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2. Removed FIXME - confirmed as "by design" by MS.
* ApplicationDirectoryMembershipCondition.cs: Added [ComVisible (true)]
in NET_2_0 to match beta2.
* ApplicationSecurityInfo.cs: Updated to match beta2.
* ApplicationSecurityManager.cs: Updated to match beta2.
* ApplicationTrust.cs: Updated to match beta2.
* ApplicationTrustCollection.cs: Updated to match beta2.
* ApplicationTrustEnumerator.cs: Added [ComVisible (true)] to match
beta2.
* ApplicationVersionMatch.cs: Added [ComVisible (true)] to match beta2.
* CodeConnectAccess.cs: Added [ComVisible (true)] to match beta2.
* CodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
Reworked Equals to avoid multiple typecast.
* Evidence.cs: Updated to match beta2. Now use internal method
Assembly.UnprotectedGetName during security manager initialization.
* FileCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match
beta2. Removed Scope property (didn't survive beta2).
* FirstMatchCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* Gac.cs: Renamed class to GacInstalled. Added [ComVisible (true)] to
match beta2.
* GacMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* Hash.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
* HashMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2. Reworked Equals to avoid multiple typecast.
* IApplicationTrustManager.cs: Added [ComVisible (true)] to match
beta2.
* IIdentityPermissionFactory.cs: Added [ComVisible (true)] in NET_2_0
to match beta2.
* IMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* NetCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match
beta2. Removed Scope property (didn't survive beta2).
* PermissionRequestEvidence.cs: Added [ComVisible (true)] in NET_2_0
to match beta2.
* PolicyException.cs: Added [ComVisible (true)] in NET_2_0 to match
beta2.
* PolicyLevel.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
* PolicyStatementAttribute.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* PolicyStatement.cs: Added [ComVisible (true)] in NET_2_0 to match
beta2.
* ProvideAssemblyEvidenceEventArgs.cs: Added [ComVisible (true)] to
match beta2.
* Publisher.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
Reworked Equals to avoid multiple typecast.
* PublisherMembershipCondition.cs: Added [ComVisible (true)] in
NET_2_0 to match beta2. Reworked Equals to avoid multiple typecast.
* Site.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. Fixed
allowed characters accepted in site names (different in 2.0 from 1.x).
* SiteMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.
* StrongName.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
* StrongNameMembershipCondition.cs: Added [ComVisible (true)] in
NET_2_0 to match beta2.
* TrustManagerContext.cs: Updated to match beta2.
* TrustManagerUIContext.cs: Added [ComVisible (true)] to match beta2.
* UnionCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match
beta2.
* Url.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. Fixed
the difference in Url matching between 1.x and 2.0. Reworked Equals to
avoid multiple typecast.
* UrlMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2. Fixed the difference in Url matching between 1.x and 2.0.
* Zone.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
Reworked Equals to avoid multiple typecast.
* ZoneMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
match beta2.

svn path=/trunk/mcs/; revision=43550

42 files changed:
mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/ApplicationSecurityInfo.cs
mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs
mcs/class/corlib/System.Security.Policy/ApplicationTrust.cs
mcs/class/corlib/System.Security.Policy/ApplicationTrustCollection.cs
mcs/class/corlib/System.Security.Policy/ApplicationTrustEnumerator.cs
mcs/class/corlib/System.Security.Policy/ApplicationVersionMatch.cs
mcs/class/corlib/System.Security.Policy/ChangeLog
mcs/class/corlib/System.Security.Policy/CodeConnectAccess.cs
mcs/class/corlib/System.Security.Policy/CodeGroup.cs
mcs/class/corlib/System.Security.Policy/Evidence.cs
mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
mcs/class/corlib/System.Security.Policy/Gac.cs
mcs/class/corlib/System.Security.Policy/GacMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/Hash.cs
mcs/class/corlib/System.Security.Policy/HashMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/IApplicationTrustManager.cs
mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs
mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
mcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs
mcs/class/corlib/System.Security.Policy/PolicyException.cs
mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
mcs/class/corlib/System.Security.Policy/PolicyStatement.cs
mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs
mcs/class/corlib/System.Security.Policy/ProvideAssemblyEvidenceEventArgs.cs
mcs/class/corlib/System.Security.Policy/Publisher.cs
mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/Site.cs
mcs/class/corlib/System.Security.Policy/SiteMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/StrongName.cs
mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/TrustManagerContext.cs
mcs/class/corlib/System.Security.Policy/TrustManagerUIContext.cs
mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs
mcs/class/corlib/System.Security.Policy/Url.cs
mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs
mcs/class/corlib/System.Security.Policy/Zone.cs
mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs

index 1c26ca4ebca13fb098a9868e75a9c3a762ef970d..142d5d325149e9336a91144e20541a53bc8fddd9 100755 (executable)
@@ -5,7 +5,7 @@
 //     Ajay kumar Dwivedi (adwiv@yahoo.com)
 //     Sebastien Pouliot  <sebastien@ximian.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
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class AllMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;
index 9594414ce9ad2c8fa3ec4553a14a06e490a3af0d..5f187d91dc2a93ea55736dc8ef8d7a4a9cf33510 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Jackson Harper, All rights reserved.
-// 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
@@ -30,6 +30,7 @@
 
 using System.Globalization;
 using System.IO;
+using System.Runtime.InteropServices;
 using System.Text;
 
 using Mono.Security;
@@ -37,6 +38,9 @@ using Mono.Security;
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class ApplicationDirectory : IBuiltInEvidence {
                
                private string directory;
@@ -110,9 +114,9 @@ namespace System.Security.Policy {
                
                public override bool Equals (object other)
                {
-                       if (null != other && (other is ApplicationDirectory)) {
-                               ApplicationDirectory compare = (ApplicationDirectory) other;
-// FIXME: to duplicate (faulty ?) MS behaviour (see FDBK14362)
+                       ApplicationDirectory compare = (other as ApplicationDirectory);
+                       if (compare != null) {
+                               // MS "by design" behaviour (see FDBK14362)
                                ThrowOnInvalid (compare.directory);
                                // no C14N or other mojo here (it's done elsewhere)
                                return (directory == compare.directory);
@@ -127,7 +131,7 @@ namespace System.Security.Policy {
                
                public override string ToString ()
                {
-// FIXME: to duplicate (faulty ?) MS behaviour (see FDBK14362)
+                       // MS "by design" behaviour (see FDBK14362)
                        ThrowOnInvalid (Directory);
                        SecurityElement element = new SecurityElement ("System.Security.Policy.ApplicationDirectory");
                        element.AddAttribute ("version", "1");
index a5ff3807522f748aa44a441f5e5b66fdda80db61..9185ff34f368b61b3da4729cdcd97450799942ed 100644 (file)
@@ -7,7 +7,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //\r
 // (C) 2002 Nick Drochak, All rights reserved.\r
-// 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
@@ -33,12 +33,16 @@ using System.Collections;
 using System.Globalization;
 using System.IO;
 using System.Reflection;
+using System.Runtime.InteropServices;
 
 using Mono.Security;
 \r
 namespace System.Security.Policy {\r
 \r
        [Serializable]\r
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class ApplicationDirectoryMembershipCondition : IConstantMembershipCondition, IMembershipCondition {\r
 
                private readonly int version = 1;
index 7816cf3548de24fd9a279df07ae5a4c455f5c1b3..7f95344847f0c87f1e78b45dace4513b9156bf52 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System.Collections;
-using System.Globalization;
+using System.Runtime.InteropServices;
 using System.Security.Permissions;
 
 namespace System.Security.Policy {
 
-       public sealed class ApplicationSecurityInfo : ISecurityEncodable, ISecurityPolicyEncodable {
+       [ComVisible (true)]
+       public sealed class ApplicationSecurityInfo {
 
                private ActivationContext _context;
                private Evidence _evidence;
@@ -88,66 +88,6 @@ namespace System.Security.Policy {
                                _deployid = value;
                        }
                }
-
-               // methods
-
-               [MonoTODO]
-               public override bool Equals (object obj)
-               {
-                       if (obj == null)
-                               return false;
-                       ApplicationSecurityInfo asi = (obj as ApplicationSecurityInfo);
-                       if (asi == null)
-                               return false;
-                       // TODO
-                       return false;
-               }
-
-               public void FromXml (SecurityElement element)
-               {
-                       FromXml (element, null);
-               }
-
-               [MonoTODO]
-               public void FromXml (SecurityElement element, PolicyLevel level)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
-               [MonoTODO]
-               public bool IsInApplication (Evidence evidence)
-               {
-                       if (evidence == null)
-                               return false; // ???
-
-                       IEnumerator e = evidence.GetHostEnumerator ();
-                       while (e.MoveNext ()) {
-                       }
-
-                       e = evidence.GetAssemblyEnumerator ();
-                       while (e.MoveNext ()) {
-                       }
-
-                       // we found them all!
-                       return true;
-               }
-
-               public SecurityElement ToXml ()
-               {
-                       return ToXml (null);
-               }
-
-               [MonoTODO]
-               public SecurityElement ToXml (PolicyLevel level)
-               {
-                       throw new NotImplementedException ();
-               }
        }
 }
 
index 3b9fdeea2bea134efa748f7fa572ae97f135e86d..aafc23f6d1518674794c90e6717521991981e7ae 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
-       [Serializable]
+       [ComVisible (true)]
        public static class ApplicationSecurityManager {
 
                private const string config = "ApplicationTrust.config";
 
                static private IApplicationTrustManager _appTrustManager;
-               static private ITrustManager _trustManager;
-               static private IDictionary _globalApps;
-               static private IDictionary _userApps;
-               static private ApplicationTrustCollection _machineAppTrusts;
                static private ApplicationTrustCollection _userAppTrusts;
 
                // properties
@@ -51,33 +47,6 @@ namespace System.Security.Policy {
                        get { return _appTrustManager; }
                }
 
-               [MonoTODO]
-               public static IDictionary GlobalApplications {
-                       get { return _globalApps; }
-                       set { _globalApps = value; }
-               }
-
-               [MonoTODO]
-               public static string GlobalApplicationsLocation {
-                       get { throw new NotImplementedException (); }
-               }
-
-               [MonoTODO]
-               public static ApplicationTrustCollection MachineApplicationTrusts {
-                       get { return _machineAppTrusts; }
-               }
-
-               [MonoTODO]
-               public static IDictionary UserApplications {
-                       get { return _userApps; }
-                       set { _userApps = value; }
-               }
-
-               [MonoTODO]
-               public static string UserApplicationsLocation {
-                       get { throw new NotImplementedException (); }
-               }
-
                [MonoTODO]
                public static ApplicationTrustCollection UserApplicationTrusts {
                        get { return _userAppTrusts; }
@@ -92,18 +61,6 @@ namespace System.Security.Policy {
                                throw new ArgumentNullException ("activationContext");
                        throw new NotImplementedException ();
                }
-
-               [MonoTODO]
-               public static void Persist ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public static PolicyStatement Resolve (Evidence evidence)
-               {
-                       throw new NotImplementedException ();
-               }
        }
 }
 
index ee8ac3ff3e931feb4e369e0dd2fc6b619818f0e2..d98773bd6745d133de6476c9fb110c47be6d6127 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
-       public sealed class ApplicationTrust : ISecurityEncodable, ISecurityPolicyEncodable {
+       [ComVisible (true)]
+       public sealed class ApplicationTrust : ISecurityEncodable {
 
                private ApplicationIdentity _appid;
                private PolicyStatement _defaultPolicy;
@@ -75,19 +76,6 @@ namespace System.Security.Policy {
                        set { _persist = value; }
                }
 
-               [MonoTODO ("incomplete")]
-               public override bool Equals (object obj) 
-               {
-                       if (obj == null)
-                               return false;
-                       ApplicationTrust at = (obj as ApplicationTrust);
-                       if (at == null)
-                               return false;
-
-                       // TODO
-                       return false;
-               }
-
                [MonoTODO ("incomplete")]
                public void FromXml (SecurityElement element) 
                {
@@ -96,28 +84,11 @@ namespace System.Security.Policy {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO ("incomplete - is PolicyLevel used ?")]
-               public void FromXml (SecurityElement element, PolicyLevel level) 
-               {
-                       FromXml (element);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
                [MonoTODO ("incomplete")]
                public SecurityElement ToXml () 
                {
                        throw new NotImplementedException ();
                }
-
-               [MonoTODO ("incomplete - is PolicyLevel used ?")]
-               public SecurityElement ToXml (PolicyLevel level) 
-               {
-                       return ToXml ();
-               }
        }
 }
 
index 7fc114f8b5e60fc5586e0b4940c3be61d1fce830..48936cdb356780f6c566b82d2dc523d7d5b0e610 100644 (file)
 
 using System.Collections;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
+       [ComVisible (true)]
        public sealed class ApplicationTrustCollection : ICollection, IEnumerable {
 
                private ArrayList _list;
 
-               internal ApplicationTrustCollection ()
+               public ApplicationTrustCollection ()
                {
                        _list = new ArrayList ();
                }
 
-               // constants
+               // constants (from beta1 - still useful ?)
 
-               public const string ApplicationTrustProperty = "ApplicationTrust";
-               public const string InstallReferenceIdentifier = "{3f471841-eef2-47d6-89c0-d028f03a4ad5}";
+//             public const string ApplicationTrustProperty = "ApplicationTrust";
+//             public const string InstallReferenceIdentifier = "{3f471841-eef2-47d6-89c0-d028f03a4ad5}";
 
                // properties
 
index 6828ae57d56a71bb9c76f43e3557e99854e1a389..442bd471b5024a5580ad23dc7d0c55c24cdda46b 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 #if NET_2_0
 
 using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
+       [ComVisible (true)]
        public sealed class ApplicationTrustEnumerator : IEnumerator {
 
                private IEnumerator e;
index 5a63b328deafe154ea328ac4f53127300e565f3b..12c8fc58b60e97ef8df6d87fd58719d50eccdac9 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
-       [Serializable]
+       [ComVisible (true)]
        public enum ApplicationVersionMatch {
                MatchExactVersion,
                MatchAllVersions
index b2fb8399efab0ac590c7499ef666ec9fe8c5d5c2..8d5ea63fbe896b0487f45a5ff1ac60edd563924f 100644 (file)
@@ -1,3 +1,78 @@
+2005-04-25  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AllMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2.
+       * ApplicationDirectory.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2. Removed FIXME - confirmed as "by design" by MS.
+       * ApplicationDirectoryMembershipCondition.cs: Added [ComVisible (true)]
+       in NET_2_0 to match beta2.
+       * ApplicationSecurityInfo.cs: Updated to match beta2.
+       * ApplicationSecurityManager.cs: Updated to match beta2.
+       * ApplicationTrust.cs: Updated to match beta2.
+       * ApplicationTrustCollection.cs: Updated to match beta2.
+       * ApplicationTrustEnumerator.cs: Added [ComVisible (true)] to match 
+       beta2.
+       * ApplicationVersionMatch.cs: Added [ComVisible (true)] to match beta2.
+       * CodeConnectAccess.cs: Added [ComVisible (true)] to match beta2.
+       * CodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. 
+       Reworked Equals to avoid multiple typecast.
+       * Evidence.cs: Updated to match beta2. Now use internal method 
+       Assembly.UnprotectedGetName during security manager initialization.
+       * FileCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match 
+       beta2. Removed Scope property (didn't survive beta2).
+       * FirstMatchCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to 
+       match beta2.
+       * Gac.cs: Renamed class to GacInstalled. Added [ComVisible (true)] to
+       match beta2.
+       * GacMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to 
+       match beta2.
+       * Hash.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
+       * HashMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2. Reworked Equals to avoid multiple typecast.
+       * IApplicationTrustManager.cs: Added [ComVisible (true)] to match 
+       beta2.
+       * IIdentityPermissionFactory.cs: Added [ComVisible (true)] in NET_2_0
+       to match beta2.
+       * IMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2.
+       * NetCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match 
+       beta2. Removed Scope property (didn't survive beta2).
+       * PermissionRequestEvidence.cs: Added [ComVisible (true)] in NET_2_0 
+       to match beta2.
+       * PolicyException.cs: Added [ComVisible (true)] in NET_2_0 to match 
+       beta2.
+       * PolicyLevel.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
+       * PolicyStatementAttribute.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2.
+       * PolicyStatement.cs: Added [ComVisible (true)] in NET_2_0 to match 
+       beta2.
+       * ProvideAssemblyEvidenceEventArgs.cs: Added [ComVisible (true)] to 
+       match beta2.
+       * Publisher.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. 
+       Reworked Equals to avoid multiple typecast.
+       * PublisherMembershipCondition.cs: Added [ComVisible (true)] in 
+       NET_2_0 to match beta2. Reworked Equals to avoid multiple typecast.
+       * Site.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. Fixed
+       allowed characters accepted in site names (different in 2.0 from 1.x).
+       * SiteMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2.
+       * StrongName.cs: Added [ComVisible (true)] in NET_2_0 to match beta2.
+       * StrongNameMembershipCondition.cs: Added [ComVisible (true)] in 
+       NET_2_0 to match beta2.
+       * TrustManagerContext.cs: Updated to match beta2.
+       * TrustManagerUIContext.cs: Added [ComVisible (true)] to match beta2.
+       * UnionCodeGroup.cs: Added [ComVisible (true)] in NET_2_0 to match
+       beta2.
+       * Url.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. Fixed
+       the difference in Url matching between 1.x and 2.0. Reworked Equals to
+       avoid multiple typecast.
+       * UrlMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to 
+       match beta2. Fixed the difference in Url matching between 1.x and 2.0.
+       * Zone.cs: Added [ComVisible (true)] in NET_2_0 to match beta2. 
+       Reworked Equals to avoid multiple typecast.
+       * ZoneMembershipCondition.cs: Added [ComVisible (true)] in NET_2_0 to
+       match beta2.
+
 2005-04-05  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Hash.cs: Added Assert for FileIOPermission to GetData so it's 
index e3da351eb170641705b92e7a868f6d85a92164d4..fe5f85161ffd0485220ed8d2df319ac9c0938447 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
+       [ComVisible (true)]
        public class CodeConnectAccess {
 
                public static readonly string AnyScheme = "*";
index a228d39ccf434a8bdd457c0787123fc744027bef..1adf5680ed09119e2a02d3856d5760c23fbe3ae5 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2001 Nick Drochak, All rights reserved.
-// 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
 using System.Collections;
 using System.Globalization;
 using System.Reflection;
+using System.Runtime.InteropServices;
 using System.Security.Permissions;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public abstract class CodeGroup {
                PolicyStatement m_policy;
                IMembershipCondition m_membershipCondition;
@@ -133,10 +137,11 @@ namespace System.Security.Policy {
 
                public override bool Equals (object o)
                {
-                       if (!(o is CodeGroup))
+                       CodeGroup cg = (o as CodeGroup);
+                       if (cg == null)
                                return false;
 
-                       return Equals ((CodeGroup)o, false);
+                       return Equals (cg, false);
                }
 
                public bool Equals (CodeGroup cg, bool compareChildren)
index a01dd91fbcafc4af45901d43c91cf0189740a1c8..21b1151fc694c33eef7d6194bfed0714d169cd13 100644 (file)
@@ -45,6 +45,9 @@ namespace System.Security.Policy {
 
        [Serializable]
        [MonoTODO ("Fix serialization compatibility with MS.NET")]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class Evidence : ICollection, IEnumerable {
        
                private bool _locked;
@@ -277,7 +280,7 @@ namespace System.Security.Policy {
                        }
 
                        // strongnamed assemblies gets a StrongName evidence
-                       AssemblyName an = a.GetName ();
+                       AssemblyName an = a.UnprotectedGetName ();
                        byte[] pk = an.GetPublicKey ();
                        if ((pk != null) && (pk.Length > 0)) {
                                StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (pk);
@@ -299,14 +302,14 @@ namespace System.Security.Policy {
 #if NET_2_0
                        // assemblies loaded from the GAC also get a Gac evidence (new in Fx 2.0)
                        if (a.GlobalAssemblyCache) {
-                               e.AddHost (new Gac ());
+                               e.AddHost (new GacInstalled ());
                        }
 
                        // the current HostSecurityManager may add/remove some evidence
                        AppDomainManager dommgr = AppDomain.CurrentDomain.DomainManager;
                        if (dommgr != null) {
-                               if ((dommgr.HostSecurityManager.Flags & HostSecurityManagerFlags.HostAssemblyEvidence) ==
-                                       HostSecurityManagerFlags.HostAssemblyEvidence) {
+                               if ((dommgr.HostSecurityManager.Flags & HostSecurityManagerOptions.HostAssemblyEvidence) ==
+                                       HostSecurityManagerOptions.HostAssemblyEvidence) {
                                        e = dommgr.HostSecurityManager.ProvideAssemblyEvidence (a, e);
                                }
                        }
index 37276264ff3583eee0da73955fb23286e9077ab9..50f5555b8cc77cb5c30540a3948914d3dc45ec3b 100644 (file)
@@ -5,7 +5,7 @@
 //   Nick Drochak (ndrochak@gol.com)
 //
 // (C) 2001 Nick Drochak, All rights reserved.
-// 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
@@ -34,12 +34,12 @@ using System.Security.Permissions;
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class FileCodeGroup : CodeGroup {
 
                private FileIOPermissionAccess m_access;
-#if NET_2_0
-               private CodeGroupGrantScope _scope = CodeGroupGrantScope.Assembly;
-#endif
 
                public FileCodeGroup (IMembershipCondition membershipCondition, FileIOPermissionAccess access) 
                        : base (membershipCondition, null)
@@ -123,14 +123,6 @@ namespace System.Security.Policy {
                        get { return "Same directory FileIO - " + m_access.ToString (); }
                }
 
-#if NET_2_0
-               [ComVisible (false)]
-               public CodeGroupGrantScope Scope {
-                       get { return _scope; }
-                       set { _scope = value; }
-               }
-#endif
-
                public override bool Equals (object o)
                {
                        if (!(o is FileCodeGroup))
index 6d5825dd48f8320235c2e93c8c23eac3b5557f17..81ce191dd1b50cc9eec254be8a5632c82338ea47 100644 (file)
@@ -5,7 +5,7 @@
 //  Jackson Harper (Jackson@LatitudeGeo.com)
 //
 // (C) 2002 Jackson Harper, All rights reserved.
-// 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
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class FirstMatchCodeGroup : CodeGroup {
                
                public FirstMatchCodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
index 3405667cb348f6221d801940f05336664561b5ac..2723b8806d65bba2465e06402b2644a90147b5d8 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 #if NET_2_0
 
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
-       public sealed class Gac : IIdentityPermissionFactory, IBuiltInEvidence {
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public sealed class GacInstalled : IIdentityPermissionFactory, IBuiltInEvidence {
 
-               public Gac ()
+               public GacInstalled ()
                {
                }
 
                public object Copy ()
                {
-                       return (object) new Gac ();
+                       return (object) new GacInstalled ();
                }
 
                public IPermission CreateIdentityPermission (Evidence evidence)
@@ -53,7 +57,7 @@ namespace System.Security.Policy {
                {
                        if (o == null)
                                return false;
-                       return (o is Gac);
+                       return (o is GacInstalled);
                }
 
                public override int GetHashCode ()
index e574fa53cd8b5751c80a5acc2f3cd98044e58707..1383f26ce476f8fc430a879f417849a7b7391368 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 using System.Collections;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class GacMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;
@@ -50,7 +54,7 @@ namespace System.Security.Policy {
                        // true only if Gac is in host-supplied evidences
                        IEnumerator e = evidence.GetHostEnumerator ();
                        while (e.MoveNext ()) {
-                               if (e.Current is Gac)
+                               if (e.Current is GacInstalled)
                                        return true;
                        }
                        return false;
index ccb19ec95b03287293cc0717e7419f2451875714..dd505f7b75f7133d66e54a3698e167519934d5a2 100644 (file)
 //
 
 using System.IO;
-using System.Text;
 using System.Reflection;
+using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 using System.Security.Cryptography;
 using System.Security.Permissions;
+using System.Text;
 
 namespace System.Security.Policy {
 
-#if !NET_2_0
+[Serializable]
+#if NET_2_0
+[ComVisible (true)]
+#else
 [MonoTODO("This doesn't match the MS version perfectly.")]
 // but it does seems to works exactly like Fx 2.0 beta 1 !?!?!
 #endif
-
-[Serializable]
 public sealed class Hash : ISerializable, IBuiltInEvidence {
 
        private Assembly assembly;
index cfa7ca7fc9e7a8670905dff1ee7ce6c0b243a1a7..cccdcda0c044c2f1a71bbfb2bf2905f1497a8306 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Jackson Harper, All rights reserved
-// 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
@@ -31,6 +31,7 @@
 using System.Collections;
 using System.Globalization;
 using System.Reflection;
+using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 using System.Security.Cryptography;
 
@@ -40,6 +41,7 @@ namespace System.Security.Policy {
 
        [Serializable]
 #if NET_2_0
+       [ComVisible (true)]
        public sealed class HashMembershipCondition : IMembershipCondition, IDeserializationCallback, ISerializable {
 #else
        public sealed class HashMembershipCondition : IMembershipCondition {
@@ -123,12 +125,10 @@ namespace System.Security.Policy {
 
                public override bool Equals (object o)
                {
-                       HashMembershipCondition other;
-                       if (!(o is HashMembershipCondition))
+                       HashMembershipCondition other = (o as HashMembershipCondition);
+                       if (other == null)
                                return false;
 
-                       other = (HashMembershipCondition)o;
-                       
                        return ((other.HashAlgorithm == hash_algorithm) &&
                                Compare (hash_value, other.hash_value));
                }
index cba3df2c48e8b14c216e7730412277e842c2f28e..ee11455535cdc7199be0f88f2efa5016e9ec5f8e 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
+       [ComVisible (true)]
        public interface IApplicationTrustManager : ISecurityEncodable {
 
                ApplicationTrust DetermineApplicationTrust (ActivationContext activationContext, TrustManagerContext context);
index 0f0df88d32f5992d9b0fe55aa97358f0c058fdc7..c5f8bd5f588e2f250312e6523af25f19f4183912 100644 (file)
@@ -1,11 +1,10 @@
+//
 // System.Security.Policy.IIdentityPermissionFactory\r
 //\r
 // Nick Drochak (ndrochak@gol.com)\r
 //\r
 // (C) 2001 Nick Drochak\r
-
-//
-// 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
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
+using System.Runtime.InteropServices;
+\r
+namespace System.Security.Policy {
+\r
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public interface IIdentityPermissionFactory {
 \r
-namespace System.Security.Policy\r
-{\r
-       public interface IIdentityPermissionFactory\r
-       {\r
                IPermission CreateIdentityPermission(Evidence evidence);\r
        }\r
 }\r
index 79fc499d0dae582097c3dafddd91f9e629144d07..c3a9a982c42ce3cbd6cac788b7a20c98dc7f80d0 100644 (file)
@@ -1,11 +1,10 @@
+//
 // System.Security.Policy.IMembershipCondition.cs\r
 //\r
 // Nick Drochak (ndrochak@gol.com)\r
 //\r
 // (C) 2001 Nick Drochak\r
-
-//
-// 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
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
+using System.Runtime.InteropServices;
 \r
-namespace System.Security.Policy\r
-{\r
-       public interface IMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable\r
-               {\r
-                       bool Check (Evidence evidence);\r
-                       IMembershipCondition Copy ();\r
+namespace System.Security.Policy {\r
+
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public interface IMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable {\r
+
+               bool Check (Evidence evidence);\r
+               IMembershipCondition Copy ();\r
+
 #if !BOOTSTRAP_WITH_OLDLIB
-                       bool Equals (object obj);\r
-                       string ToString ();\r
+               bool Equals (object obj);\r
+               string ToString ();\r
 #endif
-               }\r
+       }\r
 }\r
-\r
index d507be0efdc152e5a0ff2191f275971aef6e6b66..33b4a7671f6fdf0828bcf510779604bc54051273 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Jackson Harper, All rights reserved
-// 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
@@ -35,13 +35,15 @@ using System.Runtime.InteropServices;
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class NetCodeGroup : CodeGroup {
 
 #if NET_2_0
                public static readonly string AbsentOriginScheme = String.Empty;
                public static readonly string AnyOtherOriginScheme = "*";
 
-               private CodeGroupGrantScope _scope = CodeGroupGrantScope.Assembly;
                private Hashtable _rules = new Hashtable ();
                private int _hashcode;
 #endif
@@ -77,13 +79,6 @@ namespace System.Security.Policy {
 #endif
                }
 
-#if NET_2_0
-               [ComVisible (false)]
-               public CodeGroupGrantScope Scope {
-                       get { return _scope; }
-                       set { _scope = value; }
-               }
-#endif
 
                //
                // Public Methods
@@ -264,4 +259,3 @@ namespace System.Security.Policy {
 #endif
        }
 }
-
index 24d1a6e9f55336d7a77b8407af747f06645397e2..22e0bf60ad66269554624f9849f17b914a2ef1c2 100755 (executable)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //\r
 // (C) 2003 Nick Drochak\r
-// 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
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
+using System.Runtime.InteropServices;
 \r
 namespace System.Security.Policy {
 \r
        [Serializable]\r
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class PermissionRequestEvidence : IBuiltInEvidence {
 \r
                private PermissionSet requested, optional, denied;\r
@@ -87,7 +92,6 @@ namespace System.Security.Policy {
 \r
                // interface IBuiltInEvidence\r
 \r
-               [MonoTODO]\r
                int IBuiltInEvidence.GetRequiredSize (bool verbose) \r
                {
                        int size = verbose ? 3 : 1;
index d2f17478d026b360ca9b3c14e79d48c5f63de5f4..5cbcc3c35a5b98cb044029bad214750caa787a76 100644 (file)
@@ -5,7 +5,7 @@
 //     Duncan Mak (duncan@ximian.com)
 //
 // 2002 (C) Ximian, Inc. http://www.ximian.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
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 
 namespace System.Security.Policy {
 
-          [Serializable]
+       [Serializable]
 #if NET_2_0
-          public class PolicyException : SystemException, _Exception {
+       [ComVisible (true)]
+       public class PolicyException : SystemException, _Exception {
 #else
-          public class PolicyException : SystemException {
+       public class PolicyException : SystemException {
 #endif
-                        // Constructors
-                        public PolicyException ()
-                                   : base (Locale.GetText ("Cannot run because of policy."))
-                        {
-                        }
+               // Constructors
+               public PolicyException ()
+                       : base (Locale.GetText ("Cannot run because of policy."))
+               {
+               }
 
-                        public PolicyException (string message)
-                                   : base (message)
-                        {
-                        }
+               public PolicyException (string message)
+                       : base (message)
+               {
+               }
                         
-                        protected PolicyException (SerializationInfo info,
-                                   StreamingContext context)
-                                   : base (info, context)
-                        {
-                        }
+               protected PolicyException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+               }
 
-                        public PolicyException (string message, Exception innerException)
-                                   :base (message, innerException)
-                        {
-                        }
-                                   
-          }
+               public PolicyException (string message, Exception innerException)
+                       :base (message, innerException)
+               {
+               }
+       }
 }
index 908293a1aaa817e0ab8a2ad292660ecedb2b6c58..433c9d0d2f85271be1ab7d86669231d93d99c110 100644 (file)
@@ -9,7 +9,7 @@
 // (C) 2001 Nick Drochak
 // (C) 2003 Duncan Mak, Ximian Inc.
 // Portions (C) 2004 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
@@ -43,6 +43,9 @@ using Mono.Xml;
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class PolicyLevel {
 
                 string label;
index 265478b655a7052563cd0cd1a866f6283f3047fa..b72bf11dd1a2eed1bd098fb152c643f39bb5665c 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //\r
 // (C) 2002\r
-// 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
@@ -34,6 +34,9 @@ using System.Security.Permissions;
 namespace System.Security.Policy {\r
 \r
        [Serializable]\r
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class PolicyStatement : ISecurityEncodable, ISecurityPolicyEncodable {
 
                private PermissionSet perms;\r
index 14128e860d05dd98a3efd8001cf0d92b599b2138..1e384405d54847a0762bd53c14aa3cfc3fc70667 100644 (file)
@@ -1,11 +1,11 @@
+//
 // System.Security.Policy.PolicyStatementAttribute
 //
-// Nick Drochak (ndrochak@gol.com)
+// Author:
+//     Nick Drochak (ndrochak@gol.com)
 //
 // (C) 2001 Nick Drochak
-
-//
-// 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
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-namespace System.Security.Policy
-{
+using System.Runtime.InteropServices;
+
+namespace System.Security.Policy {
+
        [Flags]
        [Serializable]
-       public enum PolicyStatementAttribute    {
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public enum PolicyStatementAttribute {
                Nothing = 0,
                Exclusive = 1,
                LevelFinal = 2,
index 9fd5c1f9a519a38a2c45d1f696bae8875dc0dd81..06e6f41fcaa5b95d26a09a9906ccc3ab935cd2ee 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
 using System.Reflection;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
+       [ComVisible (true)]
        public class ProvideAssemblyEvidenceEventArgs : EventArgs {
 
                private Assembly _assembly;
@@ -50,7 +51,6 @@ namespace System.Security.Policy {
 
                public Evidence Evidence {
                        get { return _evidence; }
-                       set { _evidence = value; }
                }
        }
 }
index 8656176ed7aabc7f58a4dcfa17d4f75bd811a6a2..21a774ffbdce73e66dc44e8415ea24b5dc6c6d7b 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002, 2003 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
 
 using System.Security.Cryptography.X509Certificates;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
-[Serializable]
-public sealed class Publisher : IIdentityPermissionFactory, IBuiltInEvidence {
+       [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public sealed class Publisher : IIdentityPermissionFactory, IBuiltInEvidence {
        
-       private X509Certificate m_cert;
+               private X509Certificate m_cert;
 
-       public Publisher (X509Certificate cert) 
-       {
-               if (cert == null)
-                       throw new ArgumentNullException ("cert");
+               public Publisher (X509Certificate cert) 
+               {
+                       if (cert == null)
+                               throw new ArgumentNullException ("cert");
 #if NET_2_0
-               if (cert.GetHashCode () == 0)
-                       throw new ArgumentException ("cert");
+                       if (cert.GetHashCode () == 0)
+                               throw new ArgumentException ("cert");
 #endif
-               m_cert = cert;
-       }
+                       m_cert = cert;
+               }
 
-       public X509Certificate Certificate { 
-               get {
-                       if (m_cert.GetHashCode () == 0) {
+               public X509Certificate Certificate { 
+                       get {
+                               if (m_cert.GetHashCode () == 0) {
 #if NET_2_0
-                               throw new ArgumentException ("m_cert");
+                                       throw new ArgumentException ("m_cert");
 #else
-                               throw new NullReferenceException ("m_cert");
-#endif
+                                       throw new NullReferenceException ("m_cert");
+#endif 
+                               }
+                               return m_cert; 
                        }
-                       return m_cert; 
                }
-       }
 
-       public object Copy () 
-       {
-               return new Publisher (m_cert);
-       }
+               public object Copy () 
+               {
+                       return new Publisher (m_cert);
+               }
 
-       public IPermission CreateIdentityPermission (Evidence evidence) 
-       {
-               return new PublisherIdentityPermission (m_cert);
-       }
+               public IPermission CreateIdentityPermission (Evidence evidence) 
+               {
+                       return new PublisherIdentityPermission (m_cert);
+               }
 
-       public override bool Equals (object o) 
-       {
-               if (!(o is Publisher))
-                       throw new ArgumentException ("not a Publisher");
-               return m_cert.Equals ((o as Publisher).Certificate);
-       }
+               public override bool Equals (object o) 
+               {
+                       Publisher p = (o as Publisher);
+                       if (p == null)
+                               throw new ArgumentException ("not a Publisher");
+                       return m_cert.Equals (p.Certificate);
+               }
        
-       public override int GetHashCode () 
-       {
-               return m_cert.GetHashCode ();
-       }
+               public override int GetHashCode () 
+               {
+                       return m_cert.GetHashCode ();
+               }
 
-       public override string ToString ()
-       {
-               SecurityElement se = new SecurityElement ("System.Security.Policy.Publisher");
-               se.AddAttribute ("version", "1");
-               SecurityElement cert = new SecurityElement ("X509v3Certificate");
-               string data = m_cert.GetRawCertDataString ();
-               if (data != null)
-                       cert.Text = data;
-               se.AddChild (cert);
-               return se.ToString ();
-       }
+               public override string ToString ()
+               {
+                       SecurityElement se = new SecurityElement ("System.Security.Policy.Publisher");
+                       se.AddAttribute ("version", "1");
+                       SecurityElement cert = new SecurityElement ("X509v3Certificate");
+                       string data = m_cert.GetRawCertDataString ();
+                       if (data != null)
+                               cert.Text = data;
+                       se.AddChild (cert);
+                       return se.ToString ();
+               }
 
-       // interface IBuiltInEvidence
+               // interface IBuiltInEvidence
 
-       [MonoTODO]
-       int IBuiltInEvidence.GetRequiredSize (bool verbose) 
-       {
-               return (verbose ? 3 : 1) + m_cert.GetRawCertData ().Length;
-       }
+               [MonoTODO]
+               int IBuiltInEvidence.GetRequiredSize (bool verbose) 
+               {
+                       return (verbose ? 3 : 1) + m_cert.GetRawCertData ().Length;
+               }
 
-       [MonoTODO]
-       int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) 
-       {
-               return 0;
-       }
+               [MonoTODO]
+               int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) 
+               {
+                       return 0;
+               }
 
-       [MonoTODO]
-       int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose) 
-       {
-               return 0;
+               [MonoTODO]
+               int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose) 
+               {
+                       return 0;
+               }
        }
 }
-
-}
index 321bf42bee670a59554720af891608f1ed502189..68367d6d53d591481b69bf0014e50483f2112307 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002, 2003 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
 
 using System.Collections;
 using System.Security.Cryptography.X509Certificates;
+using System.Runtime.InteropServices;
 
 using Mono.Security.Cryptography;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class PublisherMembershipCondition : IConstantMembershipCondition, IMembershipCondition {
 
                private readonly int version = 1;
@@ -46,7 +50,6 @@ namespace System.Security.Policy {
                {
                }
 
-               // LAMESPEC: Undocumented ArgumentNullException exception
                public PublisherMembershipCondition (X509Certificate certificate) 
                {
                        if (certificate == null)
@@ -62,7 +65,6 @@ namespace System.Security.Policy {
                        x509 = certificate;
                }
        
-               // LAMESPEC: Undocumented ArgumentNullException exception
                public X509Certificate Certificate {
                        get { return x509; }
                        set { 
@@ -94,9 +96,10 @@ namespace System.Security.Policy {
        
                public override bool Equals (object o) 
                {
-                       if (!(o is PublisherMembershipCondition))
+                       PublisherMembershipCondition pmc = (o as PublisherMembershipCondition);
+                       if (pmc == null)
                                return false;
-                       return x509.Equals ((o as PublisherMembershipCondition).Certificate);
+                       return x509.Equals (pmc.Certificate);
                }
        
                public void FromXml (SecurityElement e) 
index 3cfcffeca553b85ef194a0a07a37c8ddd976651d..baa9cc3fed0c8813375e37268c09cb117e92aa0c 100644 (file)
@@ -7,7 +7,7 @@
 //
 // (C) 2003 Ximian, Inc (http://www.ximian.com)
 // Portions (C) 2004 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
 
 using System.Globalization;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 using Mono.Security;
 
 namespace System.Security.Policy {
 
-        [Serializable]
-        public sealed class Site: IIdentityPermissionFactory, IBuiltInEvidence {
+       [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public sealed class Site: IIdentityPermissionFactory, IBuiltInEvidence {
 
                internal string origin_site;
 
@@ -139,11 +143,21 @@ namespace System.Security.Policy {
                                        continue;
                                foreach (char c in part) {
                                        int x = Convert.ToInt32 (c);
+#if NET_2_0
+                                       bool result = ((x == 33) || (x == 45)   // !-
+                                               || (x >= 35 && x <= 41)         // #$%&'()
+                                               || (x >= 48 && x <= 57)         // 0-9
+                                               || (x >= 64 && x <= 90)         // @,A-Z
+                                               || (x >= 94 && x <= 95)         // ^_
+                                               || (x >= 97 && x <= 123)        // a-z{
+                                               || (x >= 125 && x <= 126));     // }~
+#else
                                        bool result = ((x == 45)                // -
                                                || (x >= 47 && x <= 57)         // /,0-9
                                                || (x >= 64 && x <= 90)         // @,A-Z
                                                || (x == 95)                    // _
                                                || (x >= 97 && x <= 122));      // a-z
+#endif
                                        if (!result)
                                                return false;
                                }
index 9eebdf07fc0e0394f6fb9464eb4904198fd7e737..02eeca79e3819ac8a3bb437e676baefa48489c75 100755 (executable)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2004 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
 
 using System.Collections;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class SiteMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;
index 4b9fc6900e4d0a2816e9bb3fb5752752f4461ff2..f838abc8181842cbdd9d66cc8372894cf9383e50 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (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
 //
 
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
 [Serializable]
+#if NET_2_0
+[ComVisible (true)]
+#endif
 public sealed class StrongName : IIdentityPermissionFactory, IBuiltInEvidence {
 
        private StrongNamePublicKeyBlob publickey;
index fd2e67b2f66fd4bb8d357d2edb382099188e71b9..dfac5195a2c36bef55b30ecf774c92c7047af773 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2003 Duncan Mak, Ximian Inc.
-// 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
 
 using System.Globalization;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
         public sealed class StrongNameMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;
index 3305c74225786ff1272b1546b2d9531935da76d4..dad57931788c4574a13a2d4d36153ec676efc1d0 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
 using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
+       [ComVisible (true)]
        public class TrustManagerContext {
 
-               private bool _debug;
                private bool _ignorePersistedDecision;
                private bool _noPrompt;
                private bool _keepAlive;
                private bool _persist;
+               private ApplicationIdentity _previousId;
                private TrustManagerUIContext _ui;
 
                [MonoTODO]
@@ -50,7 +51,6 @@ namespace System.Security.Policy {
 
                public TrustManagerContext (TrustManagerUIContext uiContext)
                {
-                       _debug = false;
                        _ignorePersistedDecision = false;
                        _noPrompt = false;
                        _keepAlive = false;
@@ -58,32 +58,32 @@ namespace System.Security.Policy {
                        _ui = uiContext;
                }
 
-               public bool Debug {
-                       get { return _debug; }
-                       set { _debug = value; }
-               }
-
-               public bool IgnorePersistedDecision {
+               public virtual bool IgnorePersistedDecision {
                        get { return _ignorePersistedDecision; }
                        set { _ignorePersistedDecision = value; }
                }
 
-               public bool NoPrompt {
-                       get { return _noPrompt; }
-                       set { _noPrompt = value; }
-               }
-
-               public bool KeepAlive {
+               public virtual bool KeepAlive {
                        get { return _keepAlive; }
                        set { _keepAlive = value; }
                }
 
-               public bool Persist {
+               public virtual bool NoPrompt {
+                       get { return _noPrompt; }
+                       set { _noPrompt = value; }
+               }
+
+               public virtual bool Persist {
                        get { return _persist; }
                        set { _persist = value; }
                }
 
-               public TrustManagerUIContext UIContext {
+               public virtual ApplicationIdentity PreviousApplicationIdentity {
+                       get { return _previousId; }
+                       set { _previousId = value; }
+               }
+
+               public virtual TrustManagerUIContext UIContext {
                        get { return _ui; }
                        set { _ui = value; }
                }
index 536dc90a49989ec349a5523ff75c4192990c169c..8f6e1da9905fa606d6b1cbb8c57563c0c1926496 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.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
 
 #if NET_2_0
 
-using System;
-using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
-       [Serializable]
+       [ComVisible (true)]
        public enum TrustManagerUIContext {
                Install,
                Upgrade,
index ec0fa5ee207a45f2da7ef21c81470f5f5ac9d82e..67cf7baf26627de8873067fae624b520278a6e1b 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2003 Ximian, Inc (http://www.ximian.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
 
 using System.Globalization;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class UnionCodeGroup : CodeGroup {
 
                public UnionCodeGroup (IMembershipCondition membershipCondition, PolicyStatement policyStatement)
index 9fdc183511113cca6e13c181e337a0e11f531fd4..0a709976aad232446c6a85653137c2cd6d36f345 100644 (file)
@@ -7,7 +7,7 @@
 //
 // (C) 2003 Ximian, Inc (http://www.ximian.com)
 // (C) 2004 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
 //
 
 using System.Globalization;
+using System.Runtime.InteropServices;
 using System.Security.Permissions;
 
 using Mono.Security;
 
 namespace System.Security.Policy {
 
-        [Serializable]
+       [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
         public sealed class Url: IIdentityPermissionFactory, IBuiltInEvidence {
 
                 private string origin_url;
@@ -66,14 +70,29 @@ namespace System.Security.Policy {
 
                 public override bool Equals (object o)
                 {
-                       if (o is System.Security.Policy.Url)
-                               return (String.Compare (((Url) o).Value, Value, true, CultureInfo.InvariantCulture) == 0);
-                       return false;
+                       Url u = (o as System.Security.Policy.Url);
+                       if (u == null)
+                               return false;
+
+                       string url1 = u.Value;
+                       string url2 = origin_url;
+#if NET_2_0
+                       if (url1.IndexOf (Uri.SchemeDelimiter) < 0)
+                               url1 = "file://" + url1;
+                       if (url2.IndexOf (Uri.SchemeDelimiter) < 0)
+                               url2 = "file://" + url2;
+#endif
+                       return (String.Compare (url1, url2, true, CultureInfo.InvariantCulture) == 0);
                 }
 
                 public override int GetHashCode ()
                 {
-                        return origin_url.GetHashCode ();
+                       string s = origin_url;
+#if NET_2_0
+                       if (s.IndexOf (Uri.SchemeDelimiter) < 0)
+                               s = "file://" + s;
+#endif
+                        return s.GetHashCode ();
                 }
 
                 public override string ToString ()
@@ -108,28 +127,50 @@ namespace System.Security.Policy {
                }
 
                // internal
+#if NET_2_0
+               private string Prepare (string url) 
+               {
+                       if (url == null)
+                               throw new ArgumentNullException ("Url");
+                       if (url == String.Empty)
+                               throw new FormatException (Locale.GetText ("Invalid (empty) Url"));
 
-               internal string Prepare (string url) 
+                       int protocolPos = url.IndexOf (Uri.SchemeDelimiter);    // '://'
+                       if (protocolPos > 0) {
+                               if (url.StartsWith ("file://")) {
+                                       // convert file url into uppercase
+                                       url = "file://" + url.Substring (7);
+                               }
+                               // don't escape and don't reduce (e.g. '.' and '..')
+                               Uri uri = new Uri (url, false, false);
+                               url = uri.ToString ();
+                       }
+
+                       int lastpos = url.Length - 1;
+                       if (url [lastpos] == '/')
+                               url = url.Substring (0, lastpos);
+
+                       return url;
+               }
+#else
+               private string Prepare (string url) 
                {
                        if (url == null)
                                throw new ArgumentNullException ("Url");
                        if (url == String.Empty)
                                throw new FormatException (Locale.GetText ("Invalid (empty) Url"));
 
-                       // is a protocol specified
                        int protocolPos = url.IndexOf (Uri.SchemeDelimiter);    // '://'
                        if (protocolPos > 0) {
                                if (url.StartsWith ("file://")) {
                                        // convert file url into uppercase
                                        url = "file://" + url.Substring (7).ToUpperInvariant ();
-                               }
-                               else {
+                               } else {
                                        // add a trailing slash if none (lonely one) is present
                                        if (url.LastIndexOf ("/") == protocolPos + 2)
                                                url += "/";
                                }
-                       }
-                       else {
+                       } else {
                                // add file scheme (default) and convert url to uppercase
                                url = "file://" + url.ToUpperInvariant ();
                        }
@@ -145,5 +186,6 @@ namespace System.Security.Policy {
 
                        return url;
                }
+#endif
        }
 }
index af0c9b1f4bb1573e89c22ac82d329009895242c9..1d2a415f7475f9e28b03eef8c8431c0c736fbdfb 100644 (file)
@@ -7,7 +7,7 @@
 //
 // (C) 2003, Ximian Inc.
 // (C) 2004 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
 
 using System.Collections;
 using System.Globalization;
+using System.Runtime.InteropServices;
+
+using Mono.Security;
 
 namespace System.Security.Policy {
 
        [Serializable]
-        public sealed class UrlMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public sealed class UrlMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;
 
                private Url url;
+               private string userUrl;
                 
                 public UrlMembershipCondition (string url)
                 {
+                       if (url == null)
+                               throw new ArgumentNullException ("url");
+#if NET_2_0
+                       CheckUrl (url);
+                       userUrl = url;
+                        this.url = new Url (url);
+#else
                         this.url = new Url (url);
+                       userUrl = this.url.Value;
+#endif
                 }
 
-               internal UrlMembershipCondition (Url url)
+               internal UrlMembershipCondition (Url url, string userUrl)
                {
                        // as the Url object has already been validated there's no
                        // need to restart the whole process by converting to string
                        this.url = (Url) url.Copy ();
+                       this.userUrl = userUrl;
                }
 
                // properties
 
                 public string Url {
-                        get { return url.Value; }
+                        get {
+                               if (userUrl == null)
+                                       userUrl = url.Value;
+                               return userUrl;
+                       }
                        set { url = new Url (value); }
                 }
 
@@ -88,21 +109,27 @@ namespace System.Security.Policy {
 
                 public IMembershipCondition Copy ()
                 {
-                        return new UrlMembershipCondition (url);
+                        return new UrlMembershipCondition (url, userUrl);
                 }
 
                public override bool Equals (object o)
                {
-                       if (o is UrlMembershipCondition) {
-                               string u = url.Value;
-                               int wildcard = u.LastIndexOf ("*");     // partial match with a wildcard at the end
-                               if (wildcard == -1)
-                                       wildcard = u.Length;            // exact match
-
-                               return (String.Compare (u, 0, (o as UrlMembershipCondition).Url,
-                                       0, wildcard, true, CultureInfo.InvariantCulture) == 0);
+                       UrlMembershipCondition umc = (o as UrlMembershipCondition);
+                       if (o == null)
+                               return false;
+
+                       string u = url.Value;
+                       int length = u.Length; // exact match
+
+                       // partial match with a wildcard at the end
+                       if (u [length - 1] == '*') {
+                               length--;
+                               // in this case the last / could be ommited
+                               if (u [length - 1] == '/')
+                                       length--;
                        }
-                       return false;
+
+                       return (String.Compare (u, 0, umc.Url, 0, length, true, CultureInfo.InvariantCulture) == 0);
                }
 
                 public void FromXml (SecurityElement element)
@@ -115,7 +142,17 @@ namespace System.Security.Policy {
                        MembershipConditionHelper.CheckSecurityElement (element, "element", version, version);
                        
                        string u = element.Attribute ("Url");
+#if NET_2_0
+                       if (u != null) {
+                               CheckUrl (u);
+                               url = new Url (u);
+                       } else {
+                               url = null;
+                       }
+#else
                        url = (u == null) ? null : new Url (u);
+#endif
+                       userUrl = u;
                }
 
                 public override int GetHashCode ()
@@ -125,7 +162,7 @@ namespace System.Security.Policy {
 
                 public override string ToString ()
                 {
-                        return "Url - " + url.Value;
+                        return "Url - " + Url;
                 }
 
                 public SecurityElement ToXml ()
@@ -137,8 +174,28 @@ namespace System.Security.Policy {
                 {
                        // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references
                        SecurityElement se = MembershipConditionHelper.Element (typeof (UrlMembershipCondition), version);
-                        se.AddAttribute ("Url", url.Value);
+                        se.AddAttribute ("Url", userUrl);
                         return se;
                 }
+
+               // internal stuff
+
+#if NET_2_0
+               internal void CheckUrl (string url)
+               {
+                       // In .NET 1.x Url class checked the validity of the 
+                       // URL but that's no more the case in 2.x - but we 
+                       // still need the check done here
+                       int protocolPos = url.IndexOf (Uri.SchemeDelimiter);
+                       string u = (protocolPos < 0) ? "file://" + url : url;
+
+                       Uri uri = new Uri (u, false, false);
+                       // no * except for the "lone star" case
+                       if (uri.Host.IndexOf ('*') >= 1) {
+                               string msg = Locale.GetText ("Invalid * character in url");
+                               throw new ArgumentException (msg, "name");
+                       }
+               }
+#endif
         }
 }
index 180ee5f2c6d2b2e02cf6883b397ebda356126625..b5546cc724952091e305321d7addc0e5cbf6244f 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.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
 using System.IO;
 using System.Globalization;
 using System.Security.Permissions;
+using System.Runtime.InteropServices;
 
 using Mono.Security;
 
 namespace System.Security.Policy {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public sealed class Zone : IIdentityPermissionFactory, IBuiltInEvidence {
-               SecurityZone zone;
+
+               private SecurityZone zone;
                
                public Zone (SecurityZone zone)
                {
@@ -106,10 +111,11 @@ namespace System.Security.Policy {
 
                public override bool Equals (object o)
                {
-                       if (!(o is Zone))
+                       Zone z = (o as Zone);
+                       if (z == null)
                                return false;
 
-                       return (((Zone) o).zone == zone);
+                       return (z.zone == zone);
                }
 
                public override int GetHashCode ()
@@ -132,7 +138,8 @@ namespace System.Security.Policy {
                        return 3;
                }
 
-               int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) {
+               int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+               {
                        int new_zone = (int) buffer [position++];
                        new_zone += buffer [position++];
                        return position;
@@ -147,4 +154,3 @@ namespace System.Security.Policy {
                }
        }
 }
-
index b51796a958a7ae1eee87f2a1e72d22edd6e2e899..9e2411c58d637d667079d2200ee2ee44a33f5b0a 100644 (file)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2003, Ximian Inc.
-// 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
 
 using System.Collections;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Policy {
 
        [Serializable]
-        public sealed class ZoneMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+       public sealed class ZoneMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
 
                private readonly int version = 1;