agent: Implement --supervised command (for systemd, etc).
* agent/gpg-agent.c (get_socket_path): New function for POSIX systems to return the path for a provided unix-domain socket. (map_supervised_sockets): New function to inspect $LISTEN_FDS and $LISTEN_FDNAMES and map them to the specific functionality offered by the agent. (main): Add --supervised command. When used, listen on already-open file descriptors instead of opening our own. * doc/gpg-agent.texi: Document --supervised option.
"gpg-agent --supervised" is a way to invoke gpg-agent such that a
system supervisor like systemd can provide socket-activated startup,
log management, and scheduled shutdown.
When running in this mode, gpg-agent:
- Does not open its own listening socket; rather, it expects to be given a listening socket on incoming file descriptors.
- Does not detach from the invoking process, staying in the foreground instead. Unless otherwise specified, logs are sent to stderr.
- Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>