(having previously created the .conf and .plist files). Both methods
work flawlessly (well, launchctl gives the mysterious "Workaround
Bonjour: Unknown error: 0" message, but it works). I would like to
perform the above operations from inside my code. I have read
"Performing Privileged Operations With Authorization Services" in
Apple's documentation, and I have browsed through AuthSample and
MoreAuthSample's code. As a test, I have taken AuthSample code and
changed the performOperation() function in authtool.c by adding the
following code:
/* XXX perform the actual operation here */
pid_t pid;
switch(pid = fork()) {
case 0: /* Child */ {
execl("/opt/local/sbin/openvpn2", "openvpn2", "--daemon",
"--config", "/Users/me/Library/openvpn/openvpn.conf", 0);
}
case -1: /* an error occured */
return kMyAuthorizedCommandInternalError;
default: /* Parent */
break;
}
The latter method simply does not work. In the console, I get several
messages like this:
net.openvpn: exited abnormally: Broken pipe
net.openvpn: respawning too quickly! throttling
Using the former method, the process starts (as root, correctly), but
it does not work. Browsing the logs, it seems that openvpn
initialization chokes somewhere, and the routing tables are left
incomplete (I get one tap0 entry, while I get three when I run
openvpn from the shell).
My questions:
1) why do the commands from the shell and from the program behave
differently? Is there any (possibly trivial) oversight in my code?
2) Is launchd to be preferred over other methods in this case? And is
it the way to go in general?
Thanks in advance for your patience
Nicola
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden