|
Lines 1570-1576
static Channel *
Link Here
|
| 1570 |
client_request_agent(struct ssh *ssh, const char *request_type, int rchan) |
1570 |
client_request_agent(struct ssh *ssh, const char *request_type, int rchan) |
| 1571 |
{ |
1571 |
{ |
| 1572 |
Channel *c = NULL; |
1572 |
Channel *c = NULL; |
| 1573 |
int r, sock; |
1573 |
int r, sock = -1; |
| 1574 |
|
1574 |
|
| 1575 |
if (!options.forward_agent) { |
1575 |
if (!options.forward_agent) { |
| 1576 |
error("Warning: ssh server tried agent forwarding."); |
1576 |
error("Warning: ssh server tried agent forwarding."); |
|
Lines 1578-1589
client_request_agent(struct ssh *ssh, const char *request_type, int rchan)
Link Here
|
| 1578 |
"malicious server."); |
1578 |
"malicious server."); |
| 1579 |
return NULL; |
1579 |
return NULL; |
| 1580 |
} |
1580 |
} |
| 1581 |
if ((r = ssh_get_authentication_socket(&sock)) != 0) { |
1581 |
|
|
|
1582 |
/* Try forwarding-only agent socket first */ |
| 1583 |
if ((r = ssh_get_forwarding_authentication_socket(&sock)) != 0) { |
| 1584 |
if (r != SSH_ERR_AGENT_NOT_PRESENT) { |
| 1585 |
debug("%s: ssh_get_forwarding_authentication_socket: " |
| 1586 |
"%s", __func__, ssh_err(r)); |
| 1587 |
return NULL; |
| 1588 |
} |
| 1589 |
debug2("%s: forwarding-only socket not found", __func__); |
| 1590 |
} else |
| 1591 |
debug2("%s: using forwarding-only socket", __func__); |
| 1592 |
|
| 1593 |
/* Fallback to generic agent socket otherwise */ |
| 1594 |
if (sock == -1 && (r = ssh_get_authentication_socket(&sock)) != 0) { |
| 1582 |
if (r != SSH_ERR_AGENT_NOT_PRESENT) |
1595 |
if (r != SSH_ERR_AGENT_NOT_PRESENT) |
| 1583 |
debug("%s: ssh_get_authentication_socket: %s", |
1596 |
debug("%s: ssh_get_authentication_socket: %s", |
| 1584 |
__func__, ssh_err(r)); |
1597 |
__func__, ssh_err(r)); |
| 1585 |
return NULL; |
1598 |
return NULL; |
| 1586 |
} |
1599 |
} else |
|
|
1600 |
debug2("%s: using generic agent socket", __func__); |
| 1601 |
|
| 1587 |
c = channel_new(ssh, "authentication agent connection", |
1602 |
c = channel_new(ssh, "authentication agent connection", |
| 1588 |
SSH_CHANNEL_OPEN, sock, sock, -1, |
1603 |
SSH_CHANNEL_OPEN, sock, sock, -1, |
| 1589 |
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, |
1604 |
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, |