Re: Problems with authorization (error -60002, errAuthorizationInvalidRef)

  • Sorry for this, I had missed
      OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
                                            kAuthorizationFlagDefaults, &authRef_);

    Thank you
    DG

    ----- Original Message ----
    From: deepak gopal <deengg...>
    To: cocoa dev <cocoa-dev...>
    Sent: Monday, 1 October, 2007 1:57:50 PM
    Subject: Fw: Problems with authorization (error -60002, errAuthorizationInvalidRef)

    3rd attempt, question is, What should I do to resolve the error in the subject???

    ----- Forwarded Message ----
    From: deepak gopal <deengg...>
    To: cocoa dev <cocoa-dev...>
    Sent: Monday, 1 October, 2007 1:00:14 PM
    Subject: Fw: Problems with authorization (error -60002, errAuthorizationInvalidRef)

    Resending it as the first attempt failed.

    ----- Forwarded Message ----
    From: deepak gopal <deengg...>
    To: cocoa dev <cocoa-dev...>
    Sent: Monday, 1 October, 2007 11:29:24 AM
    Subject: Problems with authorization (error -60002, errAuthorizationInvalidRef)

    Hi

    I am trying to get "system.privilege.admin" rights to run a script in my code. To get this authorization I am calling the method below. But I am getting the error -60002, errAuthorizationInvalidRef, why am I
    getting this. The same code works fine in other projects.

    -----------------------------------------------
    #include <Security/Security.h>

    @interface build : NSObject {
      AuthroizatonRef  authRef;
    }

    @implementation build {
    - (BOOL)getAuthorizationRef {

      AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0};
      AuthorizationRights myRights = {1, &myItems};
      AuthorizationFlags flags = kAuthorizationFlagDefaults |

        kAuthorizationFlagInteractionAllowed |
            kAuthorizationFlagPreAuthorize |
            kAuthorizationFlagExtendRights;

      OSStatus status = AuthorizationCopyRights(authRef_, &myRights,
                                      kAuthorizationEmptyEnvironment, flags, NULL);

      if (status != errAuthorizationSuccess) {
        return NO;
      }
      return YES;
    }

    Thank you
    DG

          Why delete messages? Unlimited storage is just a click away.

          5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.

          Flying to Bangalore or Bhopal? Search for tickets at http://in.farechase.yahoo.com

          5, 50, 500, 5000 - Store N number of mails in your inbox. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today