X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/ea13930276965c17b866c28b229e4fb9829d6272..86b6dfea7d552f4740031ba7841d7b7ceedcc1d0:/usr/src/libexec/telnetd/telnetd.c diff --git a/usr/src/libexec/telnetd/telnetd.c b/usr/src/libexec/telnetd/telnetd.c index 2f07a875d5..c649a6896a 100644 --- a/usr/src/libexec/telnetd/telnetd.c +++ b/usr/src/libexec/telnetd/telnetd.c @@ -22,7 +22,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)telnetd.c 5.38 (Berkeley) %G%"; +static char sccsid[] = "@(#)telnetd.c 5.39 (Berkeley) %G%"; #endif /* not lint */ #include "telnetd.h" @@ -368,8 +368,6 @@ int f, p; * Rather than doing them slowly, one at a time, do them all * at once. */ - if (!myopts[TELOPT_ECHO]) - dooption(TELOPT_ECHO); if (!myopts[TELOPT_SGA]) dooption(TELOPT_SGA); /* @@ -415,6 +413,27 @@ int f, p; while (hiswants[TELOPT_NAWS] != hisopts[TELOPT_NAWS]) ttloop(); + /* + * On the off chance that the telnet client is broken and does not + * respond to the DO ECHO we sent, (after all, we did send the + * DO NAWS negotiation after the DO ECHO, and we won't get here + * until a response to the DO NAWS comes back) simulate the + * receipt of a will echo. This will also send a WONT ECHO + * to the client, since we assume that the client failed to + * respond because it believes that it is already in DO ECHO + * mode, which we do not want. + */ + if (hiswants[TELOPT_ECHO] == OPT_YES) + willoption(TELOPT_ECHO, 0); + + /* + * Finally, to clean things up, we turn on our echo. This + * will break stupid 4.2 telnets out of local terminal echo. + */ + + if (!myopts[TELOPT_ECHO]) + dooption(TELOPT_ECHO); + /* * Turn on packet mode, and default to line at at time mode. */