jcs
/subtext
/amendments
/257
telnet: Limit NAWS update logging
A user frequently making adjustments to their terminal window can
flood us with NAWS commands, we don't need to log every one of them.
jcs made amendment 257 over 2 years ago
--- telnet.c Fri Jan 1 12:55:44 1904
+++ telnet.c Sat Sep 24 00:13:34 2022
@@ -103,6 +103,7 @@ struct telnet_node {
short iac_state;
unsigned char iac_sb[128];
short sb_len;
+ unsigned short naws_count;
/* docs say 4*MTU+1024, but MTU will probably be <1500 */
unsigned char tcp_buf[(4 * 1500) + 1024];
bool from_trusted_proxy;
@@ -529,8 +530,10 @@ telnet_input(struct session *session)
if (node->iac_sb[sboff] == 255)
sboff++;
session->terminal_lines |= node->iac_sb[sboff++];
- session_logf_buffered(session, "IAC NAWS %d, %d",
- session->terminal_columns, session->terminal_lines);
+ if (node->naws_count++ < 20)
+ session_logf_buffered(session, "IAC NAWS %d, %d",
+ session->terminal_columns,
+ session->terminal_lines);
break;
case IAC_TTYPE:
/* IAC SB TTYPE IS XTERM IAC SE */