• 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: Authorization Services error when invoking tool from Cocoa framework
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Authorization Services error when invoking tool from Cocoa framework


  • Subject: Re: Authorization Services error when invoking tool from Cocoa framework
  • From: Fritz Anderson <email@hidden>
  • Date: Thu, 2 Dec 2004 20:23:16 -0600

It may be that the reason the helper can't receive any authorizations is that the authorization object you pass contains no authorizations. You don't specify a rights set in AuthorizationCreate(), nor do you add to the (empty) rights set with AuthorizationCopyRights(). Try AuthorizationCreate() with kAuthorizationRightExecute on /usr/libexec/makewhatis, add flags for kAuthorizationFlagPreAuthorize and kAuthorizationFlagInteractionAllowed, and see what that does.

Just a guess.

	-- F

On 2 Dec 2004, at 1:24 PM, David Reed wrote:

What I need to do, essentially, is just run the command 'sudo /usr/libexec/makewhatis $MANPATH' (with a possibly user-specified manpath) and get notification when the command terminates.

Following Apple's sample code and Authorization docs, I have factored my application to produce a helper tool which runs as root, invokes makewhatis and waits for it to terminate, and then notifies the main app via Distributed Notifications. All fine and dandy, except for one problem. I send the AuthorizationRef created in the main app (actually, the engine framework that does the work) to the helper tool via AuthorizationMakeExternalForm. However, the function AuthorizationCreateFromExternalForm, called in the helper, always returns error -60002, errAuthorizationInvalidRef. This does not make sense to me, based on the documentation of this constant, and I can't work out what I am doing wrong.

// In engine framework. Note: I've tried with and without PreAuthorize without success.
if (AuthorizationCreate(NULL,
kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults,
&authRef) == errAuthorizationSuccess) {
AuthorizationExternalForm externalForm;

if (AuthorizationMakeExternalForm(authRef, &externalForm) == errAuthorizationSuccess) {


//... create and launch NSTask with 'input', an NSPipe, as standard input

write([[input fileHandleForWriting] fileDescriptor], &externalForm, sizeof(externalForm));


 --
Fritz Anderson
Consulting Programmer				Chicago, Illinois
http://resume.manoverboard.org/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Authorization Services error when invoking tool from Cocoa framework (From: David Reed <email@hidden>)

  • Prev by Date: Re: Netiquette with private letters (was: Request: Set reply-to to ML)
  • Next by Date: Need help with initializing Menu check boxes
  • Previous by thread: Authorization Services error when invoking tool from Cocoa framework
  • Next by thread: NSTimer Question (Crash when it fires)
  • Index(es):
    • Date
    • Thread