From a1f8b0993fb8385c46e7b1644159d05c8dbda5ae Mon Sep 17 00:00:00 2001 From: Jeremy Norris Date: Tue, 23 Jul 2024 10:33:39 -0500 Subject: [PATCH] #604 Fix possible rekeying timeouts. --- ChangeLog.md | 1 + src/main/java/com/jcraft/jsch/Session.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c9ca552e..27adf487 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,6 @@ * [0.2.19](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.19) * Enforce DHGEX prime modulus bit length meets configured constraints. + * #604 Fix possible rekeying timeouts. * [0.2.18](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.18) * Handle negated patterns according to ssh_config(5) by @bmiddaugh in https://github.com/mwiede/jsch/pull/565 * [0.2.17](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.17) diff --git a/src/main/java/com/jcraft/jsch/Session.java b/src/main/java/com/jcraft/jsch/Session.java index 8c348b44..22a0c103 100644 --- a/src/main/java/com/jcraft/jsch/Session.java +++ b/src/main/java/com/jcraft/jsch/Session.java @@ -159,7 +159,7 @@ public class Session { protected boolean daemon_thread = false; - private long kex_start_time = 0L; + private volatile long kex_start_time = 0L; int max_auth_tries = 6; int auth_failures = 0; @@ -843,8 +843,8 @@ private void send_kexinit() throws Exception { } } - in_kex = true; kex_start_time = System.currentTimeMillis(); + in_kex = true; // byte SSH_MSG_KEXINIT(20) // byte[16] cookie (random bytes)