telnetd: better AYT handling

function                                             old     new   delta
telnetd_main                                        1792    1837     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2019-04-04 16:00:23 +02:00
parent 93594b1197
commit c6a8965297

View File

@ -278,9 +278,14 @@ safe_write_to_pty_decode_iac(struct tsession *ts)
goto update_and_return; goto update_and_return;
} }
if (buf[1] == AYT) { if (buf[1] == AYT) {
/* Send back evidence that AYT was seen. */ if (ts->size2 == 0) { /* if nothing buffered yet... */
buf[1] = NOP; /* Send back evidence that AYT was seen */
/*rc =*/ safe_write(ts->sockfd_write, buf, 2); unsigned char *buf2 = TS_BUF2(ts);
buf2[0] = IAC;
buf2[1] = NOP;
ts->wridx2 = 0;
ts->rdidx2 = ts->size2 = 2;
}
rc = 2; rc = 2;
goto update_and_return; goto update_and_return;
} }