version 1.261, 2014/07/15 15:54:14 |
version 1.262, 2015/01/14 20:05:27 |
|
|
#include "match.h" |
#include "match.h" |
#include "msg.h" |
#include "msg.h" |
#include "roaming.h" |
#include "roaming.h" |
|
#include "ssherr.h" |
|
|
/* import options */ |
/* import options */ |
extern Options options; |
extern Options options; |
|
|
client_input_agent_open(int type, u_int32_t seq, void *ctxt) |
client_input_agent_open(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Channel *c = NULL; |
Channel *c = NULL; |
int remote_id, sock; |
int r, remote_id, sock; |
|
|
/* Read the remote channel number from the message. */ |
/* Read the remote channel number from the message. */ |
remote_id = packet_get_int(); |
remote_id = packet_get_int(); |
|
|
* Get a connection to the local authentication agent (this may again |
* Get a connection to the local authentication agent (this may again |
* get forwarded). |
* get forwarded). |
*/ |
*/ |
sock = ssh_get_authentication_socket(); |
if ((r = ssh_get_authentication_socket(&sock)) != 0 && |
|
r != SSH_ERR_AGENT_NOT_PRESENT) |
|
debug("%s: ssh_get_authentication_socket: %s", |
|
__func__, ssh_err(r)); |
|
|
|
|
/* |
/* |
* If we could not connect the agent, send an error message back to |
* If we could not connect the agent, send an error message back to |
* the server. This should never happen unless the agent dies, |
* the server. This should never happen unless the agent dies, |
|
|
client_request_agent(const char *request_type, int rchan) |
client_request_agent(const char *request_type, int rchan) |
{ |
{ |
Channel *c = NULL; |
Channel *c = NULL; |
int sock; |
int r, sock; |
|
|
if (!options.forward_agent) { |
if (!options.forward_agent) { |
error("Warning: ssh server tried agent forwarding."); |
error("Warning: ssh server tried agent forwarding."); |
|
|
"malicious server."); |
"malicious server."); |
return NULL; |
return NULL; |
} |
} |
sock = ssh_get_authentication_socket(); |
if ((r = ssh_get_authentication_socket(&sock)) != 0) { |
if (sock < 0) |
if (r != SSH_ERR_AGENT_NOT_PRESENT) |
|
debug("%s: ssh_get_authentication_socket: %s", |
|
__func__, ssh_err(r)); |
return NULL; |
return NULL; |
|
} |
c = channel_new("authentication agent connection", |
c = channel_new("authentication agent connection", |
SSH_CHANNEL_OPEN, sock, sock, -1, |
SSH_CHANNEL_OPEN, sock, sock, -1, |
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, |
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, |