Skip to content

Commit beae06f

Browse files
committed
upstream: don't reuse c->isatty for signalling that the remote channel
has a tty attached as this causes side effects, e.g. in channel_handle_rfd(). bz3872 ok markus@ OpenBSD-Commit-ID: 4cd8a9f641498ca6089442e59bad0fd3dcbe85f8
1 parent 476bab6 commit beae06f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

channels.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: channels.c,v 1.451 2025/09/25 06:33:19 djm Exp $ */
1+
/* $OpenBSD: channels.c,v 1.452 2025/10/07 08:02:32 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <ylo@cs.hut.fi>
44
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -362,7 +362,7 @@ channel_classify(struct ssh *ssh, Channel *c)
362362
{
363363
struct ssh_channels *sc = ssh->chanctxt;
364364
const char *type = c->xctype == NULL ? c->ctype : c->xctype;
365-
const char *classifier = c->isatty ?
365+
const char *classifier = (c->isatty || c->remote_has_tty) ?
366366
sc->bulk_classifier_tty : sc->bulk_classifier_notty;
367367

368368
c->bulk = type != NULL && match_pattern_list(type, classifier, 0) == 1;
@@ -566,7 +566,7 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
566566
void
567567
channel_set_tty(struct ssh *ssh, Channel *c)
568568
{
569-
c->isatty = 1;
569+
c->remote_has_tty = 1;
570570
channel_classify(ssh, c);
571571
}
572572

@@ -1078,7 +1078,8 @@ channel_format_status(const Channel *c)
10781078
c->rfd, c->wfd, c->efd, c->sock, c->ctl_chan,
10791079
c->have_ctl_child_id ? "c" : "nc", c->ctl_child_id,
10801080
c->io_want, c->io_ready,
1081-
c->isatty ? "T" : "", c->bulk ? "B" : "I");
1081+
c->isatty ? "T" : (c->remote_has_tty ? "RT" : ""),
1082+
c->bulk ? "B" : "I");
10821083
return ret;
10831084
}
10841085

channels.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: channels.h,v 1.161 2025/09/25 06:33:19 djm Exp $ */
1+
/* $OpenBSD: channels.h,v 1.162 2025/10/07 08:02:32 djm Exp $ */
22

33
/*
44
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -145,6 +145,7 @@ struct Channel {
145145
int ctl_chan; /* control channel (multiplexed connections) */
146146
uint32_t ctl_child_id; /* child session for mux controllers */
147147
int have_ctl_child_id;/* non-zero if ctl_child_id is valid */
148+
int remote_has_tty; /* remote side has a tty */
148149
int isatty; /* rfd is a tty */
149150
#ifdef _AIX
150151
int wfd_isatty; /* wfd is a tty */

0 commit comments

Comments
 (0)