Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AuthorizationExecuteWithPrivileges error -60008



Searching for "-60008" at apple.com leads me to this list; if there's a better forum, please let me know what it is.

I have a Carbon application that executes about half a dozen tools with elevated privileges, using AuthorizationExecuteWithPrivileges.

One of those calls, intermittently, and only on Leopard, fails to run the tool, instead returning -60008, "An unrecognized internal error occurred." No console message appears.

The call consistently worked on Tiger (or at least I had no complaints), and comparing it to known-good calls and setups shows no obvious differences.

My reports say that the call does work when my application is re-launched and the AuthorizationExecuteWithPrivileges is attempted again.

I am out of ideas, and of course the "internal error" dampens my hopes that there is something I can do. I'd appreciate any advice on how to cure or debug this problem.

I'm appending the raw code to this message, in case it helps.

Thanks for your attention,

— F

====================================
bool
X_NetConfigurator :: SetClient(CFDictionaryRef )
{
OSStatus error = noErr;
CFURLRef prefsURL = gApplication->PreferenceFileURL();
#if DEBUG
CFShow(prefsURL);
// Contents as expected
#endif

UInt8 * prefsFilePath = (UInt8 *) std::malloc(512);
if (!prefsFilePath || !CFURLGetFileSystemRepresentation(prefsURL, true, prefsFilePath, 512))
error = -1;


#if DEBUG
CFStringRef loggingStr = CFStringCreateWithFormat(NULL, NULL, CFSTR("Error after get-prefs-path = %d\n"), error);
// ERROR is 0 (noErr)
CFShow(loggingStr);
CFRelease(loggingStr);
#endif


if (!error) {
AuthorizationItem rightSought = { kAuthorizationRightExecute,
sPttBuffLen-1, sPathToTool, 0 };
AuthorizationRights rightSet = { 1, &rightSought };

error = AuthorizationCopyRights(gApplication->Authorization(), &rightSet, NULL,
kAuthorizationFlagPreAuthorize
| kAuthorizationFlagExtendRights
| kAuthorizationFlagInteractionAllowed,
NULL);
#if DEBUG
loggingStr = CFStringCreateWithFormat(NULL, NULL, CFSTR("Error after AuthorizationCopyRights = %d\n"), error);
// ERROR is 0 (noErr)
CFShow(loggingStr);
CFRelease(loggingStr);
#endif
}


if (! error) {
UInt8 * argVList[2];
argVList[0] = prefsFilePath;
argVList[1] = NULL;
error = AuthorizationExecuteWithPrivileges(gApplication->Authorization(), sPathToTool, 0, (char **) argVList, NULL);
#if DEBUG
loggingStr = CFStringCreateWithFormat(NULL, NULL, CFSTR("Error after AuthorizationExecuteWithPrivileges = %d\n"), error);
// ERROR is shown as -60008
CFShow(loggingStr);
CFRelease(loggingStr);
#endif
}


if (prefsFilePath)
std::free(prefsFilePath);

return (error == noErr);
}



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Apple-cdsa mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/apple-cdsa/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.