diff options
author | djm@openbsd.org <djm@openbsd.org> | 2024-10-14 00:20:06 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2024-10-14 00:21:08 +0200 |
commit | fe6c6330c1a94c7a537efe9069853ce7a275c50a (patch) | |
tree | 7f7abec914a6f623330c6169002f75ffc392f34f /channels.c | |
parent | upstream: remove duplicate misc.h include ok dtucker@ (diff) | |
download | openssh-fe6c6330c1a94c7a537efe9069853ce7a275c50a.tar.xz openssh-fe6c6330c1a94c7a537efe9069853ce7a275c50a.zip |
upstream: don't start the ObscureKeystrokeTiming mitigations if
there has been traffic on a X11 forwarding channel recently.
Should fix X11 forwarding performance problems when this setting is
enabled. Patch from Antonio Larrosa via bz3655
OpenBSD-Commit-ID: 820284a92eb4592fcd3d181a62c1b86b08a4a7ab
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/channels.c b/channels.c index a23fde425..8ebe21c40 100644 --- a/channels.c +++ b/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.439 2024/07/25 22:40:08 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.440 2024/10/13 22:20:06 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -5336,3 +5336,22 @@ x11_request_forwarding_with_spoofing(struct ssh *ssh, int client_session_id, fatal_fr(r, "send x11-req"); free(new_data); } + +/* + * Returns whether an x11 channel was used recently (less than a second ago) + */ +int +x11_channel_used_recently(struct ssh *ssh) { + u_int i; + Channel *c; + time_t lastused = 0; + + for (i = 0; i < ssh->chanctxt->channels_alloc; i++) { + c = ssh->chanctxt->channels[i]; + if (c == NULL || c->ctype == NULL || c->lastused == 0 || + strcmp(c->ctype, "x11-connection") != 0) + continue; + lastused = c->lastused; + } + return lastused != 0 && monotime() > lastused + 1; +} |