Skip navigation.
 
mlRe: AuthorizationExecuteWithPrivileges question
FROM : Mark Douma
DATE : Thu Oct 14 21:06:30 2004

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

> On Thu, 14 Oct 2004 13:45:50 -0400, Mark Douma <<email_removed>> 
> 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_removed>
http://homepage.mac.com/mdouma46/
------------------------------------------------------------------------
---

Related mailsAuthorDate
mlAuthorizationExecuteWithPrivileges question Mark Douma Oct 14, 19:45
mlRe: AuthorizationExecuteWithPrivileges question James Dessart Oct 14, 19:56
mlRe: AuthorizationExecuteWithPrivileges question Mark Douma Oct 14, 21:06
mlRe: AuthorizationExecuteWithPrivileges question James Dessart Oct 14, 21:10
mlRe: AuthorizationExecuteWithPrivileges question Mark Douma Oct 14, 22:57