summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-06-11 10:51:35 +0200
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-06-11 10:51:48 +0200
commit679049a610f7e0e5b1b9c44afc9a62df77023860 (patch)
treecaf13cb16abde66c810a35d1c1d20764eb7f94b5
parent5a3bc9d127fdf83f951d638d78fa00c882416609 (diff)
downloadmicrocom-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/telnet.c b/telnet.c
index 0d8c2a3..8a003a7 100644
--- a/telnet.c
+++ b/telnet.c
@@ -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;