diff options
-rw-r--r-- | eBones/libexec/telnetd/termstat.c | 47 | ||||
-rw-r--r-- | secure/libexec/telnetd/termstat.c | 47 |
2 files changed, 56 insertions, 38 deletions
diff --git a/eBones/libexec/telnetd/termstat.c b/eBones/libexec/telnetd/termstat.c index ebc843a..f499137 100644 --- a/eBones/libexec/telnetd/termstat.c +++ b/eBones/libexec/telnetd/termstat.c @@ -144,25 +144,6 @@ localstat() #endif /* defined(CRAY2) && defined(UNICOS5) */ /* - * Check for state of BINARY options. - */ - if (tty_isbinaryin()) { - if (his_want_state_is_wont(TELOPT_BINARY)) - send_do(TELOPT_BINARY, 1); - } else { - if (his_want_state_is_will(TELOPT_BINARY)) - send_dont(TELOPT_BINARY, 1); - } - - if (tty_isbinaryout()) { - if (my_want_state_is_wont(TELOPT_BINARY)) - send_will(TELOPT_BINARY, 1); - } else { - if (my_want_state_is_will(TELOPT_BINARY)) - send_wont(TELOPT_BINARY, 1); - } - - /* * Check for changes to flow control if client supports it. */ flowstat(); @@ -181,6 +162,34 @@ localstat() tty_setlinemode(uselinemode); } + if (uselinemode) { + /* + * Check for state of BINARY options. + * + * We only need to do the binary dance if we are actually going + * to use linemode. As this confuses some telnet clients + * that don't support linemode, and doesn't gain us + * anything, we don't do it unless we're doing linemode. + * -Crh (henrich@msu.edu) + */ + + if (tty_isbinaryin()) { + if (his_want_state_is_wont(TELOPT_BINARY)) + send_do(TELOPT_BINARY, 1); + } else { + if (his_want_state_is_will(TELOPT_BINARY)) + send_dont(TELOPT_BINARY, 1); + } + + if (tty_isbinaryout()) { + if (my_want_state_is_wont(TELOPT_BINARY)) + send_will(TELOPT_BINARY, 1); + } else { + if (my_want_state_is_will(TELOPT_BINARY)) + send_wont(TELOPT_BINARY, 1); + } + } + #ifdef ENCRYPTION /* * If the terminal is not echoing, but editing is enabled, diff --git a/secure/libexec/telnetd/termstat.c b/secure/libexec/telnetd/termstat.c index ebc843a..f499137 100644 --- a/secure/libexec/telnetd/termstat.c +++ b/secure/libexec/telnetd/termstat.c @@ -144,25 +144,6 @@ localstat() #endif /* defined(CRAY2) && defined(UNICOS5) */ /* - * Check for state of BINARY options. - */ - if (tty_isbinaryin()) { - if (his_want_state_is_wont(TELOPT_BINARY)) - send_do(TELOPT_BINARY, 1); - } else { - if (his_want_state_is_will(TELOPT_BINARY)) - send_dont(TELOPT_BINARY, 1); - } - - if (tty_isbinaryout()) { - if (my_want_state_is_wont(TELOPT_BINARY)) - send_will(TELOPT_BINARY, 1); - } else { - if (my_want_state_is_will(TELOPT_BINARY)) - send_wont(TELOPT_BINARY, 1); - } - - /* * Check for changes to flow control if client supports it. */ flowstat(); @@ -181,6 +162,34 @@ localstat() tty_setlinemode(uselinemode); } + if (uselinemode) { + /* + * Check for state of BINARY options. + * + * We only need to do the binary dance if we are actually going + * to use linemode. As this confuses some telnet clients + * that don't support linemode, and doesn't gain us + * anything, we don't do it unless we're doing linemode. + * -Crh (henrich@msu.edu) + */ + + if (tty_isbinaryin()) { + if (his_want_state_is_wont(TELOPT_BINARY)) + send_do(TELOPT_BINARY, 1); + } else { + if (his_want_state_is_will(TELOPT_BINARY)) + send_dont(TELOPT_BINARY, 1); + } + + if (tty_isbinaryout()) { + if (my_want_state_is_wont(TELOPT_BINARY)) + send_will(TELOPT_BINARY, 1); + } else { + if (my_want_state_is_will(TELOPT_BINARY)) + send_wont(TELOPT_BINARY, 1); + } + } + #ifdef ENCRYPTION /* * If the terminal is not echoing, but editing is enabled, |