Re: Error message: NOT super-user
Re: Error message: NOT super-user
- Subject: Re: Error message: NOT super-user
- From: Alastair Houghton <email@hidden>
- Date: Sat, 8 Sep 2007 22:08:24 +0100
On 8 Sep 2007, at 21:28, Ricardo Diaz wrote:
Yeah I don't care, how can I run it with root privileges?
You could use a helper tool. Look at the docs for the Authorization
framework. If you *do* do that, then make sure that your tool checks
for a right; otherwise it might allow an unprivileged user to shut
down the system abruptly, which would be a *huge* security hole.
But why not save yourself the trouble and send the relevant Apple
Events instead? This is particularly important if there might be GUI
programs running, since they rarely contain code to handle the abrupt
Unix-y type of shut down that you'll get from using the command you
mentioned.
It's quite easy; you just send a kAEShowShutdownDialog event (with
event class kCoreEventClass) to the process with ProcessSerialNumber
{ 0, kSystemProcess }.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden