2006-01-25 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Wed, 25 Jan 2006 17:58:20 +0000 (17:58 -0000)
committerChris Toshok <toshok@novell.com>
Wed, 25 Jan 2006 17:58:20 +0000 (17:58 -0000)
* AuthorizationRule.cs (CheckUser): handle * and ?, and use
String.Compare instead of ==.
(CheckVerb): use String.Compare instead of ==.

* AuthorizationSection.cs (IsValidUser): return false for a null
user.

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

mcs/class/System.Web/System.Web.Configuration_2.0/AuthorizationRule.cs
mcs/class/System.Web/System.Web.Configuration_2.0/AuthorizationSection.cs
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog

index 6f30bc2174f679817b8e2b0b21a3e7e5869e3d5a..05fc123d8031a3bd74becb4630eb463dd0ba6b5b 100644 (file)
@@ -223,7 +223,7 @@ namespace System.Web.Configuration {
                internal bool CheckVerb (string verb)
                {
                        foreach (string v in Verbs) {
                internal bool CheckVerb (string verb)
                {
                        foreach (string v in Verbs) {
-                               if (verb == v)
+                               if (String.Compare (v, verb, true) == 0)
                                        return true;
                        }
                        return false;
                                        return true;
                        }
                        return false;
@@ -232,7 +232,9 @@ namespace System.Web.Configuration {
                internal bool CheckUser (string user)
                {
                        foreach (string u in Users) {
                internal bool CheckUser (string user)
                {
                        foreach (string u in Users) {
-                               if (u == user)
+                               if (String.Compare (u, user, true) == 0 ||
+                                   u == "*" ||
+                                   (u == "?" && user == ""))
                                        return true;
                        }
                        return false;
                                        return true;
                        }
                        return false;
index c20b8d319404d6f3b4db18cdae8757bf6a8ae6bb..b3a16a78ebbfca18fbad5961074fcbeebce64688 100644 (file)
@@ -69,6 +69,9 @@ namespace System.Web.Configuration {
 
                internal bool IsValidUser (IPrincipal user, string verb)
                {
 
                internal bool IsValidUser (IPrincipal user, string verb)
                {
+                       if (user == null)
+                               return false;
+
                        foreach (AuthorizationRule rule in Rules) {
                                if (!rule.CheckVerb (verb))
                                        continue;
                        foreach (AuthorizationRule rule in Rules) {
                                if (!rule.CheckVerb (verb))
                                        continue;
index 007a0a1289ec083d4adc2f43c12ae7ade5908d81..8c4192ab1b7ab9e4432fc805df00091d992d6352 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-25  Chris Toshok  <toshok@ximian.com>
+
+       * AuthorizationRule.cs (CheckUser): handle * and ?, and use
+       String.Compare instead of ==.
+       (CheckVerb): use String.Compare instead of ==.
+
+       * AuthorizationSection.cs (IsValidUser): return false for a null
+       user.
+
 2006-01-22  Chris Toshok  <toshok@ximian.com>
 
        * GlobalizationSection.cs (VerifyData): quiet mcs.
 2006-01-22  Chris Toshok  <toshok@ximian.com>
 
        * GlobalizationSection.cs (VerifyData): quiet mcs.