1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-14 04:18:54 +03:00

packets: Fix ssh_send_keepalive()

ssh_send_keepalive() should use global_request() to properly configure
the state machine for packet filtering.

Signed-off-by: Nicolas Viennot <nicolas@viennot.biz>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Nicolas Viennot
2018-11-18 20:54:13 -05:00
committed by Andreas Schneider
parent bb5d46c190
commit 59ada799d7
3 changed files with 14 additions and 27 deletions

View File

@@ -1253,30 +1253,10 @@ int ssh_execute_message_callbacks(ssh_session session){
int ssh_send_keepalive(ssh_session session)
{
int rc;
/* Client denies the request, so the error code is not meaningful */
(void)ssh_global_request(session, "keepalive@openssh.com", NULL, 1);
rc = ssh_buffer_pack(session->out_buffer,
"bsb",
SSH2_MSG_GLOBAL_REQUEST,
"keepalive@openssh.com",
1);
if (rc != SSH_OK) {
goto err;
}
if (ssh_packet_send(session) == SSH_ERROR) {
goto err;
}
ssh_handle_packets(session, SSH_TIMEOUT_NONBLOCKING);
SSH_LOG(SSH_LOG_PACKET, "Sent a keepalive");
return SSH_OK;
err:
ssh_set_error_oom(session);
ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
return SSH_OK;
}
/** @} */