From 83114b636f65a761b6f4d22edb140a99c0bdabd0 Mon Sep 17 00:00:00 2001 From: Gauravsingh Sisodia Date: Fri, 8 Aug 2025 11:48:38 +0000 Subject: [PATCH] fix: move ssh_gssapi_check_client_config() from ssh_options_set to ssh_options_apply Signed-off-by: Gauravsingh Sisodia Reviewed-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/options.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/options.c b/src/options.c index 7bb9ed45..f1425760 100644 --- a/src/options.c +++ b/src/options.c @@ -1262,13 +1262,7 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type, return -1; } else { bool *x = (bool *)value; - rc = ssh_gssapi_check_client_config(session); - if (rc == SSH_OK) { - session->opts.gssapi_key_exchange = *x; - } else { - SSH_LOG(SSH_LOG_WARN, "Disabled GSSAPI key exchange"); - session->opts.gssapi_key_exchange = false; - } + session->opts.gssapi_key_exchange = *x; } break; case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS: @@ -2147,6 +2141,16 @@ int ssh_options_apply(ssh_session session) } } +#ifdef WITH_GSSAPI + if (session->opts.gssapi_key_exchange) { + rc = ssh_gssapi_check_client_config(session); + if (rc != SSH_OK) { + SSH_LOG(SSH_LOG_WARN, "Disabled GSSAPI key exchange"); + session->opts.gssapi_key_exchange = false; + } + } +#endif + return 0; }