diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-11 10:51:35 +0200 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-11 10:51:48 +0200 |
commit | 679049a610f7e0e5b1b9c44afc9a62df77023860 (patch) | |
tree | caf13cb16abde66c810a35d1c1d20764eb7f94b5 | |
parent | 5a3bc9d127fdf83f951d638d78fa00c882416609 (diff) | |
download | microcom-679049a610f7e0e5b1b9c44afc9a62df77023860.tar.gz microcom-679049a610f7e0e5b1b9c44afc9a62df77023860.tar.xz |
telnet: Don't quote IAC for DONT and WONT replies
Since commit 48f4fd57802b ("telnet: Quote IAC on sending") ios_printf
quotes IAC characters. For the purpose of negotiating connection parameter
this is wrong however. So use a raw write and rename the function
accordingly.
Fixes: 48f4fd57802b ("telnet: Quote IAC on sending")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | telnet.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -29,7 +29,7 @@ #include "microcom.h" -static int ios_printf(struct ios_ops *ios, const char *format, ...) +static int telnet_printf(struct ios_ops *ios, const char *format, ...) { char buf[20]; int size, written = 0; @@ -49,7 +49,7 @@ static int ios_printf(struct ios_ops *ios, const char *format, ...) } while (written < size) { - ret = ios->write(ios, buf + written, size - written); + ret = write(ios->fd, buf + written, size - written); if (ret < 0) return ret; @@ -343,7 +343,7 @@ static int handle_command(struct ios_ops *ios, unsigned char *buf, int len) } else { /* unknown/unimplemented option -> DONT */ dbg_printf(" -> DONT\n"); - ios_printf(ios, "%c%c%c", IAC, DONT, buf[2]); + telnet_printf(ios, "%c%c%c", IAC, DONT, buf[2]); } return 3; @@ -371,7 +371,7 @@ static int handle_command(struct ios_ops *ios, unsigned char *buf, int len) } else { /* Oh, cannot handle that one, so send a WONT */ dbg_printf(" -> WONT\n"); - ios_printf(ios, "%c%c%c", IAC, WONT, buf[2]); + telnet_printf(ios, "%c%c%c", IAC, WONT, buf[2]); } return 3; |