diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/clientloop.c b/clientloop.c index 397c96532..2137a81ce 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.261 2014/07/15 15:54:14 millert Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.262 2015/01/14 20:05:27 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 |
@@ -110,6 +110,7 @@ | |||
110 | #include "match.h" | 110 | #include "match.h" |
111 | #include "msg.h" | 111 | #include "msg.h" |
112 | #include "roaming.h" | 112 | #include "roaming.h" |
113 | #include "ssherr.h" | ||
113 | 114 | ||
114 | /* import options */ | 115 | /* import options */ |
115 | extern Options options; | 116 | extern Options options; |
@@ -1782,7 +1783,7 @@ static void | |||
1782 | client_input_agent_open(int type, u_int32_t seq, void *ctxt) | 1783 | client_input_agent_open(int type, u_int32_t seq, void *ctxt) |
1783 | { | 1784 | { |
1784 | Channel *c = NULL; | 1785 | Channel *c = NULL; |
1785 | int remote_id, sock; | 1786 | int r, remote_id, sock; |
1786 | 1787 | ||
1787 | /* Read the remote channel number from the message. */ | 1788 | /* Read the remote channel number from the message. */ |
1788 | remote_id = packet_get_int(); | 1789 | remote_id = packet_get_int(); |
@@ -1792,7 +1793,11 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt) | |||
1792 | * Get a connection to the local authentication agent (this may again | 1793 | * Get a connection to the local authentication agent (this may again |
1793 | * get forwarded). | 1794 | * get forwarded). |
1794 | */ | 1795 | */ |
1795 | sock = ssh_get_authentication_socket(); | 1796 | if ((r = ssh_get_authentication_socket(&sock)) != 0 && |
1797 | r != SSH_ERR_AGENT_NOT_PRESENT) | ||
1798 | debug("%s: ssh_get_authentication_socket: %s", | ||
1799 | __func__, ssh_err(r)); | ||
1800 | |||
1796 | 1801 | ||
1797 | /* | 1802 | /* |
1798 | * If we could not connect the agent, send an error message back to | 1803 | * If we could not connect the agent, send an error message back to |
@@ -1910,7 +1915,7 @@ static Channel * | |||
1910 | client_request_agent(const char *request_type, int rchan) | 1915 | client_request_agent(const char *request_type, int rchan) |
1911 | { | 1916 | { |
1912 | Channel *c = NULL; | 1917 | Channel *c = NULL; |
1913 | int sock; | 1918 | int r, sock; |
1914 | 1919 | ||
1915 | if (!options.forward_agent) { | 1920 | if (!options.forward_agent) { |
1916 | error("Warning: ssh server tried agent forwarding."); | 1921 | error("Warning: ssh server tried agent forwarding."); |
@@ -1918,9 +1923,12 @@ client_request_agent(const char *request_type, int rchan) | |||
1918 | "malicious server."); | 1923 | "malicious server."); |
1919 | return NULL; | 1924 | return NULL; |
1920 | } | 1925 | } |
1921 | sock = ssh_get_authentication_socket(); | 1926 | if ((r = ssh_get_authentication_socket(&sock)) != 0) { |
1922 | if (sock < 0) | 1927 | if (r != SSH_ERR_AGENT_NOT_PRESENT) |
1928 | debug("%s: ssh_get_authentication_socket: %s", | ||
1929 | __func__, ssh_err(r)); | ||
1923 | return NULL; | 1930 | return NULL; |
1931 | } | ||
1924 | c = channel_new("authentication agent connection", | 1932 | c = channel_new("authentication agent connection", |
1925 | SSH_CHANNEL_OPEN, sock, sock, -1, | 1933 | SSH_CHANNEL_OPEN, sock, sock, -1, |
1926 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, | 1934 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, |