• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[Long] Re: Getting the User/Owner of another process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Long] Re: Getting the User/Owner of another process


  • Subject: [Long] Re: Getting the User/Owner of another process
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Tue, 30 Sep 2003 18:05:25 +0100

On Tuesday, September 30, 2003, at 05:41 pm, John Farmer wrote:

It is a driver for a network card. Here is the scenario:

[snip]

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.

Perhaps I'm missing something, but you wouldn't normally have per-user preferences for a network card anyway... the usual approach would be to have a single plist, owned by the admin group, then only allow users to alter it after authenticating through Authorization Services.

It doesn't really make sense having per-user settings for a network device, since the network stack is shared by all currently active users (even those using remote terminal sessions); if I log-in over ssh, whose settings do you apply? And what happens if I was logged-in (so my preferences were the last set you saw), then went somewhere else and logged-in over SSH *through* your network card, then someone else comes along and logs in to the GUI?

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.

You are misunderstanding what the documentation says; the "current user" refers to the UID of the current process. It isn't necessarily even the owner of the process (although it is likely to be), and it certainly isn't anything to do with whoever currently owns the main display.

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.

One approach that you could use is to use a Login Item to communicate the information to your driver. That still won't work properly with the multi-user support in Panther, though, because the login item will be run once per session and not every time a user switch takes place.

I would still advise against implementing per-user preferences for your network card, however; the only possible exception is for wireless LAN, where it might make sense to have per-user keys as well as per-system keys... but before it made sense to do that on Mac OS X, Apple would have to implement a mechanism to prevent applications from using networks that their user did not have keys for (otherwise two users could log-in, one with access and one without, and the one without could then proceed to hack on the network that had been activated by the user with a valid key). AFAIK that mechanism doesn't exist today.

Kind regards,

Alastair.
_______________________________________________
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.

References: 
 >Re: Getting the User/Owner of another process (From: "John Farmer" <email@hidden>)

  • Prev by Date: Re: Getting the User/Owner of another process
  • Next by Date: Re: Getting the User/Owner of another process
  • Previous by thread: Re: Getting the User/Owner of another process
  • Next by thread: Re: Getting the User/Owner of another process
  • Index(es):
    • Date
    • Thread