diff options
author | Nicolas Viennot <nicolas@viennot.biz> | 2018-11-18 20:54:13 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-20 07:55:08 +0100 |
commit | 59ada799d765a828ef48897221579d56012bd240 (patch) | |
tree | cc3205580d9af548e83ad9d806450aeefe8b4699 /src/server.c | |
parent | bb5d46c190378cd089d9fc9a1f39ffa4680c5533 (diff) | |
download | libssh-59ada799d765a828ef48897221579d56012bd240.tar.gz libssh-59ada799d765a828ef48897221579d56012bd240.tar.xz libssh-59ada799d765a828ef48897221579d56012bd240.zip |
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>
Diffstat (limited to 'src/server.c')
-rw-r--r-- | src/server.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/server.c b/src/server.c index 84cc4f7a..b998c9cb 100644 --- a/src/server.c +++ b/src/server.c @@ -1253,30 +1253,10 @@ int ssh_execute_message_callbacks(ssh_session session){ int ssh_send_keepalive(ssh_session session) { - int rc; - - 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); + /* Client denies the request, so the error code is not meaningful */ + (void)ssh_global_request(session, "keepalive@openssh.com", NULL, 1); - 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; } /** @} */ |