From 999368420583263207d669165946e217c556af76 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Wed, 31 May 2017 19:47:09 -0400 Subject: [PATCH] GUACAMOLE-203: Warn user if they try to enter keepalive value < 2 seconds. --- src/protocols/ssh/settings.c | 3 +++ src/protocols/ssh/ssh.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c index 8843923b..98594153 100644 --- a/src/protocols/ssh/settings.c +++ b/src/protocols/ssh/settings.c @@ -291,6 +291,9 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user, settings->server_alive_interval = guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv, IDX_SERVER_ALIVE_INTERVAL, 0); + if (settings->server_alive_interval == 1) + guac_user_log(user, GUAC_LOG_WARNING, "Minimum keepalive interval " + " for libssh2 is 2 seconds."); /* Parsing was successful */ return settings; diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c index a1b3d93c..2504df92 100644 --- a/src/protocols/ssh/ssh.c +++ b/src/protocols/ssh/ssh.c @@ -225,7 +225,7 @@ void* ssh_client_thread(void* data) { } /* Set keepalive configuration for session */ - if (settings->server_alive_interval > 1) + if (settings->server_alive_interval > 0) libssh2_keepalive_config(ssh_client->session->session, 1, settings->server_alive_interval); pthread_mutex_init(&ssh_client->term_channel_lock, NULL); @@ -339,7 +339,7 @@ void* ssh_client_thread(void* data) { } /* Send keepalive at configured interval */ - if (settings->server_alive_interval > 1) { + if (settings->server_alive_interval > 0) { int timeout = 0; if(libssh2_keepalive_send(ssh_client->session->session, &timeout) > 0) break;