Jelajahi Sumber

2004-08-24 Sebastien Pouliot <[email protected]>

	* UrlMembershipCondition.cs: Check now only iterate host provided
	evidences.
	* ZoneMembershipCondition.cs: FromXml doesn't throw exceptions if Zone
	attribute is missing.

svn path=/trunk/mcs/; revision=32771
Sebastien Pouliot 21 tahun lalu
induk
melakukan
555ac6a130

+ 7 - 0
mcs/class/corlib/System.Security.Policy/ChangeLog

@@ -1,3 +1,10 @@
+2004-08-24  Sebastien Pouliot  <[email protected]>
+
+	* UrlMembershipCondition.cs: Check now only iterate host provided
+	evidences.
+	* ZoneMembershipCondition.cs: FromXml doesn't throw exceptions if Zone
+	attribute is missing.
+
 2004-08-23  Sebastien Pouliot  <[email protected]>
 
 	* AllMembershipCondition.cs: Use common template for membership 

+ 4 - 2
mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs

@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections;
 using System.Globalization;
 
 namespace System.Security.Policy {
@@ -55,8 +56,9 @@ namespace System.Security.Policy {
 			if (evidence == null)
 				return false;
 
-			foreach (object o in evidence) {
-				Url u = (o as Url);
+			IEnumerator e = evidence.GetHostEnumerator ();
+			while (e.MoveNext ()) {
+				Url u = (e.Current as Url);
 				if (u != null) {
 					// note: there shouldn't be more than one Url evidence
 					if (System.Security.Policy.Url.Compare (url, u.Value))

+ 7 - 5
mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs

@@ -101,13 +101,15 @@ namespace System.Security.Policy {
                         FromXml (element, null);
                 }
 
-                public void FromXml (SecurityElement element, PolicyLevel level)
-                {
+		public void FromXml (SecurityElement element, PolicyLevel level)
+		{
 			MembershipConditionHelper.CheckSecurityElement (element, "element", version, version);
 
-                        zone = (SecurityZone) Enum.Parse (
-                                typeof (SecurityZone), element.Attribute ("Zone"));
-                }
+			string z = element.Attribute ("Zone");
+			if (z != null) {
+				zone = (SecurityZone) Enum.Parse (typeof (SecurityZone), z);
+			}
+		}
 
                 public override int GetHashCode ()
                 {