Re: Problem within a MoreSecurity helper tool
Re: Problem within a MoreSecurity helper tool
- Subject: Re: Problem within a MoreSecurity helper tool
- From: Quinn <email@hidden>
- Date: Fri, 23 Apr 2004 17:52:50 +0100
At 13:43 +0200 23/4/04, John Andersson wrote:
I didnt manage to get my debugger to stop at that breakpoint, but I
printed each error to "stderr", and found out that -108 is coming
from:
// Read the response back from the child.
if (err == noErr) {
err = CopyDictionaryFromDescriptor(fdParent, response);
}
It's very likely that something (your code or the tool you're
sublaunching) is printing something to stdout which is confusing
MoreSecurity. MoreSecurity expects to own the stdin and stdout
between the application and the helper tool. If the helper tool
prints anything unexpected to stdout, bad things happen.
CopyDictionaryFromDescriptor is used to read the response back from
the helper tool. The protocol is very simple: it's four bytes of
length followed by a flattened CFDictionary. If you look at the
code, you'll see that it has a check for dictionaries that are way
too large and it returns memFullErr in that case. It's likely that
this way too large number is because your tool is printing some text:
four ASCII characters translates to a very large CFIndex (-:
Furthermore, my guess is that this is because you're sublaunching a
tool and that tool is printing to stdout. You need to fix this. The
best solution depends on whether you need to see the results from the
sublaunched tool. If you don't need to see the result, you should
wire up the tool's stdout to /dev/null. That is, just after the
fork, in the child, close stdout and open /dev/null.
If you do need to see the result, you should create a UNIX domain
socket and wire up the tool to that. This is exactly what
MoreSecurity does when the app launches the helper tool, so you can
use it for sample code.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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.