Re: Getting the User/Owner of another process
Re: Getting the User/Owner of another process
- Subject: Re: Getting the User/Owner of another process
- From: Clark Cox <email@hidden>
- Date: Tue, 30 Sep 2003 13:18:02 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday, Sep 30, 2003, at 12:41 US/Eastern, John Farmer wrote:
It is a driver for a network card. Here is the scenario:
The system starts up and during startup the Startup Item runs code to
get
the driver setup. One part of this is that the Startup Item grabs the
last
used information from some preference plists and sends that
information down
to the driver.
Now here is my conundrum: I can't have just one set of preference
plists
because one of our requirements is that each user must have their own
preferences. I can't have just one set of preference plists for all
users
because of security considerations (such as file permissions), on the
OS.
The problem that I see with that is that network settings are
inherently system-wide. If you change any settings that affect how the
machine connects to the Internet, you will affect *all* users logged
into the system, not just the one logged into the GUI. What if they
don't log into the GUI, but instead log in to the command line? what if
you have 5 people all logged in at the same time? etc.
So I have to have each individual user have their own preferences
(located
in /Users/%username%/Library/Preferences/). Because of this when the
Startup Item runs it has to get the preferences into the driver
sometime
during or right after login so the user can start the internet or
access the
network. When the Startup Item calls NSUserName() (which according to
the
documentation and I quote: "Returns the logon name of the current
user."),
It's doing just what it says it will. The "logon name of the current
user" is "root".
returns root (the owner of the process), not the logon name of the
current
user. When I run NSHomeDirectory it gives me the roots home
directory, this
doesn't help me because I need the current User Name to get the path
for the
preferences.
"root" *is* the current user.
Note I do not need to load the preferences before login (as Eric
pointed
out), I can wait until right after login, but the fact still remains
when I
need to get the path for preferences like say:
/Users/johnfarmer/Library/Preferences/... I need to get the user name
for
John Farmer so I can create the path to access the user's plist. I can
however get the user name from the Preference Pane, but I can't have
the
user opening the Preference Pane everytime they login just to startup
the
network.
Long story short: I need to get a user name during or after the login
process so that I can get the user name of the currently logged in
user so I
can load the preferences of the logged in user to access the network.
You can write a small application that gets added to the user's login
items that simply takes note of the current user, and forwards that
data to your driver. But again, do this at your own risk, if any
network card driver on my machine worked in the user-specific way you
describe, I'd delete it, and go return the card for a refund.
- --
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
iEYEARECAAYFAj95us8ACgkQZ+zIIbXiIoOhmACgte/4CRPP2/dZLJ99wf/AC811
YZQAoKShc+2iIC3rJmL3T/Xj/h1B//r+
=EXym
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.