aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-12-19 11:30:13 +0000
committerEric Andersen <andersen@codepoet.org>2003-12-19 11:30:13 +0000
commit3752d337b3b8e704f1fe27451d481eae85d64f48 (patch)
tree454c30aa3f9f83ca4ec139a787e3ed5322bba247 /networking
parent89f10bcf3790dabbeae4276fa1e1a6d9e9325d9c (diff)
downloadbusybox-3752d337b3b8e704f1fe27451d481eae85d64f48.tar.gz
Patch from Fillod Stephane:
* While I'm at it, there's also a "telnetd.patch" which maps CRLF to CR, like netkit-telnet does, required by the loosy Windows telnet clients.
Diffstat (limited to 'networking')
-rw-r--r--networking/telnetd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 9a60a9a3c..3d5e8d100 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -1,4 +1,4 @@
-/* $Id: telnetd.c,v 1.8 2003/09/12 11:27:15 bug1 Exp $
+/* $Id: telnetd.c,v 1.9 2003/12/19 11:30:13 andersen Exp $
*
* Simple telnet server
* Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
@@ -116,6 +116,8 @@ static struct tsession *sessions;
FIXME - if we mean to send 0xFF to the terminal then it will be escaped,
what is the escape character? We aren't handling that situation here.
+ CR-LF ->'s CR mapping is also done here, for convenience
+
*/
static char *
remove_iacs(struct tsession *ts, int *pnum_totty) {
@@ -128,7 +130,14 @@ remove_iacs(struct tsession *ts, int *pnum_totty) {
while (ptr < end) {
if (*ptr != IAC) {
+ int c = *ptr;
*totty++ = *ptr++;
+ /* We now map \r\n ==> \r for pragmatic reasons.
+ * Many client implementations send \r\n when
+ * the user hits the CarriageReturn key.
+ */
+ if (c == '\r' && (*ptr == '\n' || *ptr == 0) && ptr < end)
+ ptr++;
}
else {
if ((ptr+2) < end) {