1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Telnet: remove tabs from Event Log entries.

While re-testing the other backends, I noticed that they work really
badly in the GTK event log, which apparently interprets tabs as
meaning 'next table column', and assumes that any line not containing
a tab must be entirely in the leftmost column. So all the Telnet
negotiations are miles off to the right, beyond the longest other line
in the entire log.

Replaced with a bit more verbiage.
This commit is contained in:
Simon Tatham 2021-09-13 13:13:07 +01:00
parent 0b099b6a6f
commit 64f192093a

View File

@ -218,7 +218,7 @@ static void log_option(Telnet *telnet, const char *sender, int cmd, int option)
* trigraph - a double question mark followed by > maps to a * trigraph - a double question mark followed by > maps to a
* closing brace character! * closing brace character!
*/ */
logeventf(telnet->logctx, "%s:\t%s %s", sender, logeventf(telnet->logctx, "%s negotiation: %s %s", sender,
(cmd == WILL ? "WILL" : cmd == WONT ? "WONT" : (cmd == WILL ? "WILL" : cmd == WONT ? "WONT" :
cmd == DO ? "DO" : cmd == DONT ? "DONT" : "<?""?>"), cmd == DO ? "DO" : cmd == DONT ? "DONT" : "<?""?>"),
telopt(option)); telopt(option));
@ -374,11 +374,13 @@ static void process_subneg(Telnet *telnet)
b[n] = IAC; b[n] = IAC;
b[n + 1] = SE; b[n + 1] = SE;
telnet->bufsize = sk_write(telnet->s, b, n + 2); telnet->bufsize = sk_write(telnet->s, b, n + 2);
logevent(telnet->logctx, "server:\tSB TSPEED SEND"); logevent(telnet->logctx, "server subnegotiation: SB TSPEED SEND");
logeventf(telnet->logctx, "client:\tSB TSPEED IS %s", termspeed); logeventf(telnet->logctx,
"client subnegotiation: SB TSPEED IS %s", termspeed);
sfree(b); sfree(b);
} else } else
logevent(telnet->logctx, "server:\tSB TSPEED <something weird>"); logevent(telnet->logctx,
"server subnegotiation: SB TSPEED <something weird>");
break; break;
case TELOPT_TTYPE: case TELOPT_TTYPE:
if (telnet->sb_buf->len == 1 && telnet->sb_buf->u[0] == TELQUAL_SEND) { if (telnet->sb_buf->len == 1 && telnet->sb_buf->u[0] == TELQUAL_SEND) {
@ -396,11 +398,14 @@ static void process_subneg(Telnet *telnet)
b[n + 5] = SE; b[n + 5] = SE;
telnet->bufsize = sk_write(telnet->s, b, n + 6); telnet->bufsize = sk_write(telnet->s, b, n + 6);
b[n + 4] = 0; b[n + 4] = 0;
logevent(telnet->logctx, "server:\tSB TTYPE SEND"); logevent(telnet->logctx,
logeventf(telnet->logctx, "client:\tSB TTYPE IS %s", b + 4); "server subnegotiation: SB TTYPE SEND");
logeventf(telnet->logctx,
"client subnegotiation: SB TTYPE IS %s", b + 4);
sfree(b); sfree(b);
} else } else
logevent(telnet->logctx, "server:\tSB TTYPE <something weird>\r\n"); logevent(telnet->logctx,
"server subnegotiation: SB TTYPE <something weird>\r\n");
break; break;
case TELOPT_OLD_ENVIRON: case TELOPT_OLD_ENVIRON:
case TELOPT_NEW_ENVIRON: case TELOPT_NEW_ENVIRON:
@ -408,7 +413,7 @@ static void process_subneg(Telnet *telnet)
q = p + telnet->sb_buf->len; q = p + telnet->sb_buf->len;
if (p < q && *p == TELQUAL_SEND) { if (p < q && *p == TELQUAL_SEND) {
p++; p++;
logeventf(telnet->logctx, "server:\tSB %s SEND", logeventf(telnet->logctx, "server subnegotiation: SB %s SEND",
telopt(telnet->sb_opt)); telopt(telnet->sb_opt));
if (telnet->sb_opt == TELOPT_OLD_ENVIRON) { if (telnet->sb_opt == TELOPT_OLD_ENVIRON) {
if (conf_get_bool(telnet->conf, CONF_rfc_environ)) { if (conf_get_bool(telnet->conf, CONF_rfc_environ)) {
@ -482,20 +487,21 @@ static void process_subneg(Telnet *telnet)
b[n++] = SE; b[n++] = SE;
telnet->bufsize = sk_write(telnet->s, b, n); telnet->bufsize = sk_write(telnet->s, b, n);
if (n == 6) { if (n == 6) {
logeventf(telnet->logctx, "client:\tSB %s IS <nothing>", logeventf(telnet->logctx,
"client subnegotiation: SB %s IS <nothing>",
telopt(telnet->sb_opt)); telopt(telnet->sb_opt));
} else { } else {
logeventf(telnet->logctx, "client:\tSB %s IS:", logeventf(telnet->logctx, "client subnegotiation: SB %s IS:",
telopt(telnet->sb_opt)); telopt(telnet->sb_opt));
for (eval = conf_get_str_strs(telnet->conf, CONF_environmt, for (eval = conf_get_str_strs(telnet->conf, CONF_environmt,
NULL, &ekey); NULL, &ekey);
eval != NULL; eval != NULL;
eval = conf_get_str_strs(telnet->conf, CONF_environmt, eval = conf_get_str_strs(telnet->conf, CONF_environmt,
ekey, &ekey)) { ekey, &ekey)) {
logeventf(telnet->logctx, "\t%s=%s", ekey, eval); logeventf(telnet->logctx, " %s=%s", ekey, eval);
} }
if (user) if (user)
logeventf(telnet->logctx, "\tUSER=%s", user); logeventf(telnet->logctx, " USER=%s", user);
} }
sfree(b); sfree(b);
sfree(user); sfree(user);
@ -882,7 +888,7 @@ static void telnet_size(Backend *be, int width, int height)
b[n++] = IAC; b[n++] = IAC;
b[n++] = SE; b[n++] = SE;
telnet->bufsize = sk_write(telnet->s, b, n); telnet->bufsize = sk_write(telnet->s, b, n);
logeventf(telnet->logctx, "client:\tSB NAWS %d,%d", logeventf(telnet->logctx, "client subnegotiation: SB NAWS %d,%d",
telnet->term_width, telnet->term_height); telnet->term_width, telnet->term_height);
} }