Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Next step after AuthorizationCopyRights?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Next step after AuthorizationCopyRights?



Good evening!

I have an application which I'm trying to get a user to authorize for admin
privs and then within the same process install some files in
/Library/Application\ Support.

I have managed from the examples to modify my application to create a
authorizationRef link with the security server, and use AuthorizationCopyRights
to get the application to prompt the user for an administrator's password.

That's where I've hit a little brick wall.  I can't extend those rights to the
current process so that I can open up a new file descriptor and start writing
out the file I need.

Can anyone help me out with this?  The code compiles and runs fine if you are
already an administrator (since no priveledge extension is needed), but when
running as a non-admin user I get prompted and then the process does not get
privs extended to it.

Code snippet which I thought was supposed to setup and grant those privs I was
looking for:

...

status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
              kAuthorizationFlagDefaults, &authorizationRef);

if (status == errAuthorizationSuccess)
{
     /* Now we can use the AuthorizationRef to deterimine if the user is
     allowed to perform the rights contained in "rightSet". */

     status = AuthorizationCopyRights(authorizationRef, &rightSet,
                   kAuthorizationEmptyEnvironment, flags, authorizedRights);
}

    if (status != errAuthorizationCanceled) {
...


I've been searching the online API reference and the list archives, but have not
come up with a solution.

Help?

Thanks,

Joshua

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

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

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 © 2011 Apple Inc. All rights reserved.