]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: when sending ObscureKeystrokeTiming chaff packets, we
authordjm@openbsd.org <djm@openbsd.org>
Mon, 1 Jul 2024 04:31:17 +0000 (04:31 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 1 Jul 2024 04:32:45 +0000 (14:32 +1000)
can't rely on channel_did_enqueue to tell that there is data to send. This
flag indicates that the channels code enqueued a packet on _this_ ppoll()
iteration, not that data was enqueued in _any_ ppoll() iteration in the
timeslice. ok markus@

OpenBSD-Commit-ID: 009b74fd2769b36b5284a0188ade182f00564136

clientloop.c

index 0b6f3c9be02a7916ca7906a8b997ce789a94a174..8ed8b1c3449d0f4733e571b7f11648f47d274fd4 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.407 2024/05/17 06:42:04 jsg Exp $ */
+/* $OpenBSD: clientloop.c,v 1.408 2024/07/01 04:31:17 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -607,8 +607,9 @@ obfuscate_keystroke_timing(struct ssh *ssh, struct timespec *timeout,
                if (timespeccmp(&now, &chaff_until, >=)) {
                        /* Stop if there have been no keystrokes for a while */
                        stop_reason = "chaff time expired";
-               } else if (timespeccmp(&now, &next_interval, >=)) {
-                       /* Otherwise if we were due to send, then send chaff */
+               } else if (timespeccmp(&now, &next_interval, >=) &&
+                   !ssh_packet_have_data_to_write(ssh)) {
+                       /* If due to send but have no data, then send chaff */
                        if (send_chaff(ssh))
                                nchaff++;
                }