Hi everybody, I'm having problems in understanding how to authorize my program to perform privileged tasks.
I read the apple documentation and wrote this piece of code:
AuthorizationRef myAuthorizationRef;
OSStatus myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef);
AuthorizationItem myItem;
myItem.name = "com.Me.myApp.test";
myItem.valueLength = 0;
myItem.value = NULL;
myItem.flags = 0;
AuthorizationRights myRights;
myRights.count = 1;
myRights.items = &myItem;
AuthorizationFlags myFlags = kAuthorizationFlagDefaults |
kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights;
myStatus = AuthorizationCopyRights (myAuthorizationRef, &myRights, kAuthorizationEmptyEnvironment, myFlags, NULL);
after calling AuthorizationCopyRights I should be able to perform privileged tasks, right? Is there still something I've got to do?