summaryrefslogtreecommitdiffstats
path: root/channels.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2023-11-15 22:51:49 +0000
committerDamien Miller <djm@mindrot.org>2023-11-16 09:53:42 +1100
commit050c335c8da43741ed0df2570ebfbd5d1dfd0a31 (patch)
tree825e2a081e5716f56398ceaf8c5c30a1d3840426 /channels.c
parent676377ce67807a24e08a54cd60ec832946cc6cae (diff)
upstream: when deciding whether to enable keystroke timing
obfuscation, only consider enabling it when a channel with a tty is open. Avoids turning on the obfucation when X11 forwarding only is in use, which slows it right down. Reported by Roger Marsh OpenBSD-Commit-ID: c292f738db410f729190f92de100c39ec931a4f1
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index 598ff322..38135e5a 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.433 2023/09/04 00:01:46 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.434 2023/11/15 22:51:49 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -898,6 +898,23 @@ channel_still_open(struct ssh *ssh)
return 0;
}
+/* Returns true if a channel with a TTY is open. */
+int
+channel_tty_open(struct ssh *ssh)
+{
+ u_int i;
+ Channel *c;
+
+ for (i = 0; i < ssh->chanctxt->channels_alloc; i++) {
+ c = ssh->chanctxt->channels[i];
+ if (c == NULL || c->type != SSH_CHANNEL_OPEN)
+ continue;
+ if (c->client_tty)
+ return 1;
+ }
+ return 0;
+}
+
/* Returns the id of an open channel suitable for keepaliving */
int
channel_find_open(struct ssh *ssh)