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: "John Farmer" <email@hidden>
- Date: Tue, 30 Sep 2003 09:41:42 -0700
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.
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."),
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.
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.
Thanks again,
John D. Farmer
----- Original Message -----
From: "David Remahl" <email@hidden>
To: "John Farmer" <email@hidden>
Cc: "Alastair J.Houghton" <email@hidden>;
<email@hidden>
Sent: Tuesday, September 30, 2003 9:17 AM
Subject: Re: Getting the User/Owner of another process
>
On 30 sep 2003, at 17.51, John Farmer wrote:
>
>
> Sorry for the confusion. I am working on 10.2.6, I am not working with
>
> Panther... yet. I have expectations of those same problems you
>
> mentioned,
>
> and more for 10.3. I am writing a Startup Item, Preference Pane, and
>
> Driver
>
> for networking. Since you cannot have mutliple users running
>
> simulaniously
>
> in 10.2, I can rely on getting the User that owns Finder, since there
>
> will
>
> only ever be one user that owns Finder at one time, also according to
>
> the
>
> documentation for NSUserName() and NSFullUserName() these expectations
>
> are
>
> reasonable, because there will only ever be one user logged in.
>
>
Incorrect. I am often logged in both remotely over ssh and locally on a
>
screen. It also happens (in rare cases) that I run several Finders in
>
parallel, one as myself and one as root or some other user. I also
>
routinely quit the Finder to save some memory.
>
>
Your method would fail in some or all of these situations.
>
>
> The way the
>
> driver, pref pane, and startup item work together I need to find a
>
> reliable
>
> way to get the user name when I log in so that the startup item (which
>
> is a
>
> daemon) can set the preferences to the pref pane and the driver.
>
>
>
> Sorry for the confusion, and thanks for the help,
>
>
You're still going about this the wrong way, for sure. What kind of
>
driver is it?
>
>
/ Rgds, David
_______________________________________________
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.