Re: MoreAuthSample
Re: MoreAuthSample
- Subject: Re: MoreAuthSample
- From: Tomas Zahradnicky <email@hidden>
- Date: Mon, 27 Jan 2003 12:34:27 +0100
Hello Quinn,
your sample looks great. However I have few comments.
Shouldn't one close stdin and stdout prior dup2-ing something into
their numbers (MoreSecExecuteRequestInHelperTool)?
MoreSecurity.c : 1578
and second question. wouldn't better be to call vfork instead of
fork? that need not to copy the whole address space and if you're
willing to use exec, then it would be better.
third thing. MoreSecurity.c : 463 & 533 & ..., there's
assert(fdIn >= 0);
assert(fdOut >= 0);
but zero is valid file descriptor. I suggest testing it either
against -1 (invalid fd) or against > 0. what if you do:
close(0);
fdIn = dup2(1,0);
then you had stdout with fd = 0 :-)
also, calls to UNIX read/write can get interrupted with signals such
as alarm. There should probably be test for EINTR to happen and retry
it rather then returning an error.
CopyDictionaryFromDescriptor & WriteDictionaryToDescriptor functions
will crash on free if dictBuffer failed... or is valid to call
free(NULL)?.. this shows more times in the file...
-Tomas
--
# Tomas Zahradnicky, Jr
# The Czech Technical University
# Dept of Computer Science, FEE-CTU Prague
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.