[Mono-bugs] [Bug 56144][Nor] Changed - Environment.UserName must represent the username (not the %USERNAME% variable)
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 28 Mar 2004 23:25:02 -0500 (EST)
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=56144
--- shadow/56144 2004-03-28 23:09:25.000000000 -0500
+++ shadow/56144.tmp.21224 2004-03-28 23:25:01.000000000 -0500
@@ -2,13 +2,13 @@
Product: Mono: Runtime
Version: unspecified
OS: All
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Normal
Component: misc
AssignedTo: mono-bugs@ximian.com
ReportedBy: sebastien@ximian.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -91,6 +91,37 @@
environment variables for this.
------- Additional Comments From sebastien@ximian.com 2004-03-28 23:09 -------
Created an attachment (id=7124)
envun.cs
+
+------- Additional Comments From sebastien@ximian.com 2004-03-28 23:25 -------
+Using a slightly modified [1] version of the
+WindowsIdentity.Impersonate sample code from MSDN (not reproduced [2])
+on the MS runtime (not yet implemented in Mono) we see that
+Environment.UserName isn't cached on the start of the running
+assembly. This is really the current OS identity associated with the
+Win32 thread/process.
+
+>impersonate
+
+Enter the name of a machine on which to log on: farscape
+Enter the login of a user on farscape that you wish to impersonate: test
+Enter the password for test: *********
+LogonUser called.
+Did LogonUser Succeed? Yes
+Value of Windows NT token: 1768
+Before impersonation: FARSCAPE\spouliot
+Env.UserName: spouliot
+After impersonation: FARSCAPE\test
+Env.UserName: test
+After Undo: FARSCAPE\spouliot
+Env.UserName: spouliot
+
+
+[1] Just added a
+Console.WriteLine ("Env.UserName: {0}", Environment.UserName);
+after each time WindowsIdentity.GetCurrent().Name was displayed.
+
+[2] Sample can be found at
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecurityprincipalwindowsidentityclassimpersonatetopic.asp