Replacing the env variable set by SecureSocketWithKey.
Hi, I hope this list is still active. I haven't seen any posts on 2014 yet. I'm currently trying to make gpg-agent launchd-compatible. The plist for my LaunchAgent specifies SecureSocketWithKey for "GPG_AGENT_INFO". This is, correctly, setting GPG_AGENT_INFO to the socket path created by launchd. However, things are getting complicated here. I need GPG_AGENT_INFO to be "sockpath:PID:1". As far as I understood, I can pass environment values to launchd via launch_msg(), passing them as dict entries (launch_data_dict_insert()). This doesn't seem to work for GPG_AGENT_INFO, though, most likely because SecureSocketWithKey is taking control of that env var. I can remove the Socket part from the agent's plist and get a "correct" value in GPG_AGENT_INFO, alas, the UNIX socket is not within launchd's control but created by the gpg-agent daemon. What I'd ultimately like to have is the following: letting launchd handle UNIX socket creation and management (like SecureSocketWithKey, but not have any environment variable set by launchd "yet"), fetch/query the generated sockpath from launchd within gpg-agent and then pass back GPG_AGENT_INFO with a "sane" value gpg-agent expects to launchd, so that it is available session-wide. Defining an empty "<string/>" for SecureSocketWithKey so that launchd creates no env var seems to work fine. I'm having problems retrieving the sockpath, though. Reading launchd's source code, I've gathered from support/launchctl.c that LAUNCH_JOBSOCKETKEY_SECUREWITHKEY is just a wrapper and actually adds a LAUNCH_JOBSOCKETKEY_PATHNAME dict with the secure socket path to the data array. However, I have been unable to query a LAUNCH_JOBSOCKETKEY_PATHNAME from a socket dict returned by launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS); Any idea how I can get this data? Any help is appreciated. :) Best regards, Mihai
* On 06.07.2014 05:21 pm, Mihai Moldovan wrote:
Reading launchd's source code, I've gathered from support/launchctl.c that LAUNCH_JOBSOCKETKEY_SECUREWITHKEY is just a wrapper and actually adds a LAUNCH_JOBSOCKETKEY_PATHNAME dict with the secure socket path to the data array.
However, I have been unable to query a LAUNCH_JOBSOCKETKEY_PATHNAME from a socket dict returned by launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
This said, taking another look at src/core.c:job_export() reveals that for any CheckIn request, only an array of file descriptors is returned for all defined sockets. So whatever I try to do with the returned object, I won't be able to fetch the socket path out of this one. The other code (the "LAUNCH_JOBSOCKETKEY_PATHNAME" part) seems to be launchd-internal and I don't see any way to access this private data. Am I missing something? Mihai
participants (1)
-
Mihai Moldovan