diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-12-21 02:19:13 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-12-21 13:22:07 +1100 |
commit | 40be78f503277bd91c958fa25ea9ef918a2ffd3d (patch) | |
tree | b17303fad21f97437b44cf3264a03abfd503ebdf /clientloop.c | |
parent | 416f15372bfb5be1709a0ad1d00ef5d8ebfb9e0e (diff) |
upstream: Allow forwarding a different agent socket to the path
specified by $SSH_AUTH_SOCK, by extending the existing ForwardAgent option to
accepting an explicit path or the name of an environment variable in addition
to yes/no.
Patch by Eric Chiang, manpage by me; ok markus@
OpenBSD-Commit-ID: 98f2ed80bf34ea54d8b2ddd19ac14ebbf40e9265
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/clientloop.c b/clientloop.c index 880abfda2..8f0332df4 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.329 2019/11/25 00:51:37 djm Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.330 2019/12/21 02:19:13 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -135,6 +135,12 @@ extern int muxserver_sock; /* XXX use mux_client_cleanup() instead */ | |||
135 | extern char *host; | 135 | extern char *host; |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * If this field is not NULL, the ForwardAgent socket is this path and different | ||
139 | * instead of SSH_AUTH_SOCK. | ||
140 | */ | ||
141 | extern char *forward_agent_sock_path; | ||
142 | |||
143 | /* | ||
138 | * Flag to indicate that we have received a window change signal which has | 144 | * Flag to indicate that we have received a window change signal which has |
139 | * not yet been processed. This will cause a message indicating the new | 145 | * not yet been processed. This will cause a message indicating the new |
140 | * window size to be sent to the server a little later. This is volatile | 146 | * window size to be sent to the server a little later. This is volatile |
@@ -1618,7 +1624,12 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan) | |||
1618 | "malicious server."); | 1624 | "malicious server."); |
1619 | return NULL; | 1625 | return NULL; |
1620 | } | 1626 | } |
1621 | if ((r = ssh_get_authentication_socket(&sock)) != 0) { | 1627 | if (forward_agent_sock_path == NULL) { |
1628 | r = ssh_get_authentication_socket(&sock); | ||
1629 | } else { | ||
1630 | r = ssh_get_authentication_socket_path(forward_agent_sock_path, &sock); | ||
1631 | } | ||
1632 | if (r != 0) { | ||
1622 | if (r != SSH_ERR_AGENT_NOT_PRESENT) | 1633 | if (r != SSH_ERR_AGENT_NOT_PRESENT) |
1623 | debug("%s: ssh_get_authentication_socket: %s", | 1634 | debug("%s: ssh_get_authentication_socket: %s", |
1624 | __func__, ssh_err(r)); | 1635 | __func__, ssh_err(r)); |