Re: [Q] copy operation and authorization
Re: [Q] copy operation and authorization
- Subject: Re: [Q] copy operation and authorization
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 12 Nov 2009 11:12:41 -0700
On Nov 12, 2009, at 10:44 AM, JongAm Park wrote:
> NSString *PlugInPath = [NSString stringWithString:@"/Library/Application Support/Final Cut Pro System Support/Plugins/test3.valm"];
Apologies for being a little pedantic here, but calling +stringWithString: is almost never necessary and in this case is just cluttering the autorelease pool/garbage collector. You can set NSString pointers to NSString constants with no problems.
> Although it returns "errAuthorizationSuccess" in "authorize" method, when a file is to be copied, it returns "fail" state and the file is not copied.
> Can anyone help me to figure out why?
You cannot escalate the privileges of a running task on Mac OS X. So if a running task does not have root privileges, then it never will.
> Should I use AuthorizationExecuteWithPrivileges() and invoke an external command like "cp"?
> I think it should be possible to copy files with proper privilege with Cocoa calls.
Yes. Apple actually wants you to use AEWP() to run your own helper tool for security reasons, though it's highly unlikely you'll run into problems by doing direct invocations. Check the list archives for details.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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