summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_ttydisc.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-05-07 17:39:23 +0000
committered <ed@FreeBSD.org>2009-05-07 17:39:23 +0000
commit2f086e8725406aa7ec9199de2e4dead1244672a6 (patch)
tree94994674542b88a2efea1395ef11b07fb83c7ba9 /sys/kern/tty_ttydisc.c
parent49ada8d1726ed32a269dc24072e0fb5573456a12 (diff)
downloadFreeBSD-src-2f086e8725406aa7ec9199de2e4dead1244672a6.zip
FreeBSD-src-2f086e8725406aa7ec9199de2e4dead1244672a6.tar.gz
If we have a regular rint handler, never go into rint_bypass mode.
It turns out if we called cfmakeraw() on a TTY with only a rint handler in place, it could inject data into the TTY, even though it should be redirected. Always take a look at the hooks before looking at the termios flags.
Diffstat (limited to 'sys/kern/tty_ttydisc.c')
-rw-r--r--sys/kern/tty_ttydisc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/tty_ttydisc.c b/sys/kern/tty_ttydisc.c
index 2bb83dd..634b58e 100644
--- a/sys/kern/tty_ttydisc.c
+++ b/sys/kern/tty_ttydisc.c
@@ -560,12 +560,15 @@ ttydisc_optimize(struct tty *tp)
{
tty_lock_assert(tp, MA_OWNED);
- if ((!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) &&
+ if (ttyhook_hashook(tp, rint_bypass)) {
+ tp->t_flags |= TF_BYPASS;
+ } else if (ttyhook_hashook(tp, rint)) {
+ tp->t_flags &= ~TF_BYPASS;
+ } else if (!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) &&
(!CMP_FLAG(i, BRKINT) || CMP_FLAG(i, IGNBRK)) &&
(!CMP_FLAG(i, PARMRK) ||
CMP_FLAG(i, IGNPAR|IGNBRK) == (IGNPAR|IGNBRK)) &&
- !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) ||
- ttyhook_hashook(tp, rint_bypass)) {
+ !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) {
tp->t_flags |= TF_BYPASS;
} else {
tp->t_flags &= ~TF_BYPASS;
OpenPOWER on IntegriCloud