• 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
Re: When performing privileged operations...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When performing privileged operations...


  • Subject: Re: When performing privileged operations...
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 2 Jul 2002 09:20:34 -0400

See the Xoptimize source (search for Xoptimize on versiontracker.com and download the latest version -- it comes with fully documented source) as a demonstration of AuthorizationExecuteWithPrivileges() was the point of creating the app in the first place.

AuthorizationExecuteWithPrivileges() executes the binary -- in your case 'mfig'-- as a full blown task. That is, it executes it in a similar fashion as if you were at the command line and had typed 'sudo mfig' and provided a password.

Once AuthorizationExecuteWithPrivileges() is called and the task is successfully launched, the function immediately returns. It is up to you to read data spewed forth by the task on stdout (you can't get to stderr, unfortunately -- see Xoptimize, it dealt with that too).

Also, you should use NSBundle's -pathForAuxiliaryExecutable: to retrieve the path to the executable. You will need to have the executable copied into the appropriate directory within the app -- not Resources (I believe there is an appropriate popup selection in the 'copy files' build phase inspector).

b.bum

On Tuesday, July 2, 2002, at 06:50 AM, email@hidden wrote:

Is the authorized operation performed as a separate thread? I am experiencing some interesting behavior where my method for performing the operation returns a result code before the operation itself has completed.
Is that normal, or might I have a bug elsewhere? Following is the method to perform the operation. The method is called and its result code examined. Basically what I am doing, in the case where I am having problems, is copying a file to a new location (that's what the tool called does), and I'd like to open the new file after it is created. Unfortunately, the new file does not exist when I try to open it. That shouldn't be... programatically, the new file is definitely supposed to be opened after it has been created. Apparently, the operation as called from this code below finishes successfully in copying the file, but not until _after_ I need it...

Can anyone give me some pointers?
_______________________________________________
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.

  • Prev by Date: Re: Drag-n-Drop to NSButtonCells in a NSMatrix?
  • Next by Date: Re: Installing a new login item?
  • Previous by thread: When performing privileged operations...
  • Next by thread: Tips for using template C++ classes and Cocoa
  • Index(es):
    • Date
    • Thread