2005-08-22 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Mon, 22 Aug 2005 15:12:45 +0000 (15:12 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Mon, 22 Aug 2005 15:12:45 +0000 (15:12 -0000)
* GenericPrincipal.cs: Roles are case-insensitive.

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

mcs/class/corlib/System.Security.Principal/ChangeLog
mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs

index 6feb31736e93731d47d224264b49153688a446b8..5246c7635cf7e059cb4d73beebf2812854b6ae02 100644 (file)
@@ -1,3 +1,7 @@
+2005-08-22  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * GenericPrincipal.cs: Roles are case-insensitive.
+
 2005-06-18  Sebastien Pouliot  <sebastien@ximian.com>
 
        * IdentityReference.cs: Constructor is internal (which means it the
index c368edbe46e49203112a37bf98ffd3746c2dd877..19ba283f81ce742bb4eddf042b05e8fddb185c4b 100644 (file)
@@ -1,8 +1,9 @@
 //
 // System.Security.Principal.GenericPrincipal.cs
 //
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
+// Authors:
+//     Miguel de Icaza (miguel@ximian.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) Ximian, Inc.  http://www.ximian.com
 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
@@ -62,10 +63,13 @@ namespace System.Security.Principal {
                        if (roles == null)
                                return false;
 
-                       foreach (string r in roles)
-                               if (role == r)
-                                       return true;
-
+                       int l = role.Length;
+                       foreach (string r in roles) {
+                               if ((r != null) && (l == r.Length)) {
+                                       if (String.Compare (role, 0, r, 0, l, true) == 0)
+                                               return true;
+                               }
+                       }
                        return false;
                }
        }