version 1.127, 2021/01/26 00:46:17 |
version 1.128, 2021/12/19 22:08:48 |
|
|
sshbuf_free(msg); |
sshbuf_free(msg); |
return r; |
return r; |
} |
} |
|
|
|
/* Binds a session ID to a hostkey via the initial KEX signature. */ |
|
int |
|
ssh_agent_bind_hostkey(int sock, const struct sshkey *key, |
|
const struct sshbuf *session_id, const struct sshbuf *signature, |
|
int forwarding) |
|
{ |
|
struct sshbuf *msg; |
|
int r; |
|
|
|
if (key == NULL || session_id == NULL || signature == NULL) |
|
return SSH_ERR_INVALID_ARGUMENT; |
|
if ((msg = sshbuf_new()) == NULL) |
|
return SSH_ERR_ALLOC_FAIL; |
|
if ((r = sshbuf_put_u8(msg, SSH_AGENTC_EXTENSION)) != 0 || |
|
(r = sshbuf_put_cstring(msg, "session-bind@openssh.com")) != 0 || |
|
(r = sshkey_puts(key, msg)) != 0 || |
|
(r = sshbuf_put_stringb(msg, session_id)) != 0 || |
|
(r = sshbuf_put_stringb(msg, signature)) != 0 || |
|
(r = sshbuf_put_u8(msg, forwarding ? 1 : 0)) != 0) |
|
goto out; |
|
if ((r = ssh_request_reply_decode(sock, msg)) != 0) |
|
goto out; |
|
/* success */ |
|
r = 0; |
|
out: |
|
sshbuf_free(msg); |
|
return r; |
|
} |