Security framework leaving zombies
Security framework leaving zombies
- Subject: Security framework leaving zombies
- From: "Mike Vannorsdel" <email@hidden>
- Date: Wed, 23 May 2001 06:42:13 -0600
I'm using the security framework to execute shell applications with root
privileges. But every shell application I execute is left as a zombie
process. The zombies remain even after the authorizationRef is freed.
The zombies won't disappear until my application is deallocated. What's
causing this and how can I avoid it? Here's the basic form of my code:
AuthorizationRights rights;
AuthorizationFlags flags;
OSStatus err;
BOOL authorized=NO;
AuthorizationItem items[1];
char commandPath[]="/bin/chmod";
AuthorizationRef authorizationRef=NULL;
items[0].name=kAuthorizationRightExecute;
items[0].value=commandPath;
items[0].valueLength=strlen(commandPath);
items[0].flags=0;
rights.count=1;
rights.items=items;
flags=kAuthorizationFlagInteractionAllowed|kAuthorizationFlagExtendRights;
err=AuthorizationCreate(&rights, kAuthorizationEmptyEnvironment,
flags, &authorizationRef);
err=AuthorizationCopyRights(authorizationRef,&rights,
kAuthorizationEmptyEnvironment, flags, NULL);
authorized=(errAuthorizationSuccess==err);
if(authorized)
{
char * cargs[3];
FILE * output;
...
...
err=AuthorizationExecuteWithPrivileges(authorizationRef,
"/bin/chmod", 0, cargs, &output);
...
...
}
AuthorizationFree(authorizationRef,
kAuthorizationFlagDestroyRights);