• 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: AuthorizationExecuteWithPrivileges question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AuthorizationExecuteWithPrivileges question


  • Subject: Re: AuthorizationExecuteWithPrivileges question
  • From: Mark Douma <email@hidden>
  • Date: Thu, 14 Oct 2004 15:06:30 -0400


On Oct 14, 2004, at 1:56 PM, James Dessart wrote:

On Thu, 14 Oct 2004 13:45:50 -0400, Mark Douma <email@hidden> wrote:
When executing this code, only the folder specified in args[4] is
actually deleted. None of the files that would correspond to the first
3 paths are deleted. If I remove the *'s, and specify the actual paths
to the base-filenames, such as

execve and friends, which I'm pretty sure
AuthorizationExecuteWithPrivileges uses under the hood, does not do
wildcard expansion. This is done by the shell, and execve doesn't call
the shell, it runs the executable in question. However, if you used
the command name as an argument to the shell, then you could get what
you want.

Hmm, I thought for a minute that I understood what you meant, but maybe not. Well, actually, I think I understand what you mean (maybe?), but I'm not sure how that would translate to code.

I changed the code to this:

------------------------------------------------------------------------ -----------------------------------------------------
FILE* pipe = NULL;
char* args[7];
flags = kAuthorizationFlagDefaults;

args[0] = "/bin/rm";
args[1] = "-rf";
args[2] = "/System/Library/Caches/com.apple.ATS.System*.fcache";
args[3] = "/System/Library/Caches/com.apple.ATSServer.FODB_*System";
args[4] = "/System/Library/Caches/fontTablesAnnex*";
args[5] = "/Library/Caches/com.apple.ATS/";
args[6] = NULL;


status = AuthorizationExecuteWithPrivileges(authRef,"/bin/sh",flags,args,&pipe);

------------------------------------------------------------------------ -----------------------------------------------------

But receive the following error:
/bin/rm: /bin/rm: cannot execute binary file

I guess what I was thinking is that I'd be running the rm command from within the shell, or is that not what you meant? Or that's what you meant, but not what my code means? :-)

Thanks for your help




------------------------------------------------------------------------ ---
Mark Douma
Grand Rapids, MI, USA
email@hidden
http://homepage.mac.com/mdouma46/
------------------------------------------------------------------------ ---

_______________________________________________
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
  • Follow-Ups:
    • Re: AuthorizationExecuteWithPrivileges question
      • From: James Dessart <email@hidden>
References: 
 >AuthorizationExecuteWithPrivileges question (From: Mark Douma <email@hidden>)
 >Re: AuthorizationExecuteWithPrivileges question (From: James Dessart <email@hidden>)

  • Prev by Date: Re: SafariSource (Safari syntax coloring)
  • Next by Date: bug in NSPropertyListSerialization +dataFromPropertyList:format:errorDescription:
  • Previous by thread: Re: AuthorizationExecuteWithPrivileges question
  • Next by thread: Re: AuthorizationExecuteWithPrivileges question
  • Index(es):
    • Date
    • Thread