[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSUserName() returns wrong user and..
From: |
Matt Rice |
Subject: |
NSUserName() returns wrong user and.. |
Date: |
Sat, 8 Nov 2003 04:25:08 -0800 (PST) |
two seperate things in this email... srry
1)
basically NSUserName() depends on the LOGNAME
environment
variable which isn't updated when using su (unless you
use su -) getlogin() has the same issue..
this can cause issues like where NSHomeDirectory()
returns the wrong home directory and you get access
denied messages or worse, if you're su'd to root you
write files to someone else's ~ then they get access
denied messages when attempting to write to root owned
stuff in their home directory.
attached are some patches for make/user_home.c and
base/Source/NSUser.m which switches around the order
of the calls
here is a url which makes me believe this is the
correct behavior and that the docs are just unspecific
with their definition of current user
http://cocoa.mamasam.com/COCOADEV/2003/09/2/73680.php
2)
I tested this a bit on mingw and noticed the
NSHomeDirectoryForUser(...) call doesn't work on my
windows machine, basically it's an old version of
windows which hasn't a USERPROFILE or HOMEPATH
environment variable (i guess I should probably just
set it...) below is the output of
int main() { NSLog(@"foo"); }
(where NSLog attempts to get timezone and language
information from the user defaults and some other
stuff), didn't really have time to track this down..
in the middle of moving so I probably won't be able to
reply any time soon.
matt
2003-11-08 11:46:43.939 foo.exe[-470601]
NSHomeDirectoryForUser(default) failed
2003-11-08 11:46:44.049 foo.exe[-470601]
NSHomeDirectoryForUser(default) failed
2003-11-08 11:46:44.049 foo.exe[-470601]
NSHomeDirectoryForUser(default) failed
2003-11-08 11:46:44.049 foo.exe[-470601] File
NSData.m: 153. In readContentsOfFile Open
(C:\GNUstep\System\Library\Libraries\Resources\gnustep-base\NSTimeZones\zones\Pacific
Standard Time) attempt failed - The system cannot find
the file specified.
2003-11-08 11:46:44.049 foo.exe[-470601] Unable to
obtain time zone `Pacific Standard Time'...
<NSException: 8c09a8> NAME:GSTimeZoneFileException
REASON:File is too small
2003-11-08 11:46:44.049 foo.exe[-470601] Using time
zone with absolute offset 0.
2003-11-08 11:46:43.829 foo.exe[-470601]
NSHomeDirectoryForUser(default) failed
2003-11-08 11:46:44.049 foo.exe[-470601] Could not get
user root. Using NSOpenStepRootDirectory()
2003-11-08 11:46:44.109 foo.exe[-470601]
NSHomeDirectoryForUser(default) failed
C:\MSYS\1.0.10\home\default\shared_obj\foo.exe:
Uncaught exception NSInvalidArgumentException, reason:
Tried to add nil to array
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
user_home.c.diff
Description: user_home.c.diff
NSUser.m.diff
Description: NSUser.m.diff
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- NSUserName() returns wrong user and..,
Matt Rice <=