add support for identityagent ssh_config option

This commit adds an `agent_socket` field to the session options
and connects the config parser to that option.

`SSH_OPTIONS_IDENTITY_AGENT` is added to allow applications to
set this option for themselves.

agent.c is updated to take the `agent_socket` value in preference
to the `SSH_AUTH_SOCK` environment variable.

Signed-off-by: Wez Furlong <wez@fb.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Wez Furlong
2021-07-20 17:50:44 -07:00
committed by Andreas Schneider
parent 899ec9e519
commit 51a53cc6d4
7 changed files with 35 additions and 3 deletions

View File

@@ -220,7 +220,8 @@ static int agent_connect(ssh_session session) {
if (session->agent->channel != NULL)
return 0;
auth_sock = getenv("SSH_AUTH_SOCK");
auth_sock = session->opts.agent_socket ?
session->opts.agent_socket : getenv("SSH_AUTH_SOCK");
if (auth_sock && *auth_sock) {
if (ssh_socket_unix(session->agent->sock, auth_sock) < 0) {