aboutsummaryrefslogtreecommitdiff
path: root/networking/telnet.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-09-13 13:00:49 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-09-13 13:00:49 +0200
commitaca464ddac4b86211f138203c4a1d1e3c69a2230 (patch)
treeaf8f65a58178d112d902f856ad081af7ca7d3e71 /networking/telnet.c
parent6d463de46b418e6c4c8d1397033608f78b33ab21 (diff)
downloadbusybox-w32-aca464ddac4b86211f138203c4a1d1e3c69a2230.tar.gz
busybox-w32-aca464ddac4b86211f138203c4a1d1e3c69a2230.tar.bz2
busybox-w32-aca464ddac4b86211f138203c4a1d1e3c69a2230.zip
telnet: convert CR -> CR LF, not CR -> CR NUL when sending data to server
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/telnet.c')
-rw-r--r--networking/telnet.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index e8e51dce4..7081a6a41 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -186,22 +186,6 @@ static void con_escape(void)
186 186
187static void handle_net_output(int len) 187static void handle_net_output(int len)
188{ 188{
189 /* here we could do smart tricks how to handle 0xFF:s in output
190 * stream like writing twice every sequence of FF:s (thus doing
191 * many write()s. But I think interactive telnet application does
192 * not need to be 100% 8-bit clean, so changing every 0xff:s to
193 * 0x7f:s
194 *
195 * 2002-mar-21, Przemyslaw Czerpak (druzus@polbox.com)
196 * I don't agree.
197 * first - I cannot use programs like sz/rz
198 * second - the 0x0D is sent as one character and if the next
199 * char is 0x0A then it's eaten by a server side.
200 * third - why do you have to make 'many write()s'?
201 * I don't understand.
202 * So I implemented it. It's really useful for me. I hope that
203 * other people will find it interesting too.
204 */
205 byte outbuf[2 * DATABUFSIZE]; 189 byte outbuf[2 * DATABUFSIZE];
206 byte *p = (byte*)G.buf; 190 byte *p = (byte*)G.buf;
207 int j = 0; 191 int j = 0;
@@ -216,7 +200,11 @@ static void handle_net_output(int len)
216 if (c == IAC) 200 if (c == IAC)
217 outbuf[j++] = c; /* IAC -> IAC IAC */ 201 outbuf[j++] = c; /* IAC -> IAC IAC */
218 else if (c == '\r') 202 else if (c == '\r')
219 outbuf[j++] = '\0'; /* CR -> CR NUL */ 203 /* See RFC 1123 3.3.1 Telnet End-of-Line Convention.
204 * Using CR LF instead of other allowed possibilities
205 * like CR NUL - easier to talk to HTTP/SMTP servers.
206 */
207 outbuf[j++] = '\n'; /* CR -> CR LF */
220 } 208 }
221 if (j > 0) 209 if (j > 0)
222 full_write(netfd, outbuf, j); 210 full_write(netfd, outbuf, j);