[Mono-bugs] [Bug 52532][Wis] New - [PATCH] WindowsIdentity and WindowsPrincipal are incomplete (on both Windows and Linux)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 12 Apr 2004 23:49:26 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=52532

--- shadow/52532	2004-04-12 23:49:26.000000000 -0400
+++ shadow/52532.tmp.23025	2004-04-12 23:49:26.000000000 -0400
@@ -0,0 +1,122 @@
+Bug#: 52532
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: ASSIGNED   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: xiaoming.lin@longshine.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] WindowsIdentity and WindowsPrincipal are incomplete (on both Windows and Linux)
+
+Steps to reproduce the problem:
+1. I have a file can't be compiled
+using System;
+using System.Data;
+using System.Collections;
+using System.Collections.Specialized;
+using System.DirectoryServices;
+using System.Security;
+using System.Security.Principal;
+
+namespace Longshine.Indigo.Runtime.Security {
+
+    public sealed class SecurityToolkit {
+        private SecurityToolkit() {}
+
+        public static StringCollection GetUserProvinces(WindowsPrincipal 
+user) {
+            if (user == null)
+                throw new ArgumentException("a", "user");
+
+            if (!user.Identity.IsAuthenticated)
+                throw new SecurityException("a");
+
+            using (DirectoryEntry userEntry = GetWindowsIdentityLdapEntry
+((WindowsIdentity)user.Identity)) {
+                return GetUserProvinces(userEntry);
+            }
+        }
+    }
+}
+2.  mcs SecurityToolkit.cs -r:/usr/local/lib/System.dll -
+r:/usr/local/lib/System.Data.dll -
+r:/usr/local/lib/System.DirectoryServices.dll
+
+3. 
+Actual Results:
+
+SecurityToolkit.cs(126) error CS0246: Cannot find type `WindowsPrincipal'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+Compilation succeeded
+
+How often does this happen? 
+always
+
+Additional Information:
+it can be compiled in windows2003+framework1.1.
+we have develped a big project in windows2000+framework1.0,now we want it 
+can run with linux+mono.
+thanks a lot
+
+------- Additional Comments From bmaurer@users.sf.net  2003-12-25 00:57 -------
+*** Bug 52529 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From bmaurer@users.sf.net  2003-12-25 00:57 -------
+*** Bug 52530 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From bmaurer@users.sf.net  2003-12-25 00:57 -------
+*** Bug 52531 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From bmaurer@users.sf.net  2003-12-25 01:02 -------
+Smaller:
+
+using System.Security.Principal;
+
+public class SecurityToolkit {
+	public static void GetUserProvinces (WindowsPrincipal user) {
+	
+	}
+}
+
+Cant figure out why this is happening, is this an MCS bug?
+
+------- Additional Comments From spouliot@videotron.ca  2003-12-25 14:12 -------
+This shouldn't compile because the class WindowsPrincipal isn't (yet)
+part of mscorlib. This is "easy" to fix (e.g. stub) but you should be
+aware that the WindowsIdentity class is only a stub (there's no code
+in there) - so right now all WindowsIdentity properties throws
+NotImplementedException.
+
+This _may_ be easy to fix if you only require the username (string) to
+do an LDAP lookup. However this won't tell you if the user is
+authenticated.
+
+------- Additional Comments From spouliot@videotron.ca  2003-12-25 23:41 -------
+A stub for the class is now in CVS along with an updated 
+WindowsIdentity class.
+
+However after looking at your sample code I don't think this will 
+resolve your problem - so I changed the bug summary description and 
+will leave it open.
+
+------- Additional Comments From sebastien@ximian.com  2004-04-12 23:49 -------
+Here are patches:
+
+principal.diff must be applied to
+/mcs/class/corlib/System.Security.Principal
+
+runtime.diff must be applied to
+/mono/
+
+Note that the Windows and POSIX version are very similar in use but
+different in implementation (i.e. incompatible).