mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 05:55:41 +02:00
sshd sets ssh client tty mode to original state after a tty session has ended
this is a needed step for our sshd in tty mode as we ask clients to send us CRLF as command terminator. But we must reset the mode when the tty session ends so that sftp running after it does not encounter CRLF mode. Linux openssh sftp client otherwise would show two lines for each command typed when run after an ssh session to our server.
This commit is contained in:
parent
5b34ab66d8
commit
cbdfedff94
18
nchan.c
18
nchan.c
@ -187,8 +187,24 @@ chan_ibuf_empty(Channel *c)
|
||||
switch (c->istate) {
|
||||
case CHAN_INPUT_WAIT_DRAIN:
|
||||
if (compat20) {
|
||||
if (!(c->flags & (CHAN_CLOSE_SENT|CHAN_LOCAL)))
|
||||
if (!(c->flags & (CHAN_CLOSE_SENT | CHAN_LOCAL))) {
|
||||
#ifdef WIN32_FIXME
|
||||
// reset the other side if tty to be how it was before
|
||||
if (c->isatty) {
|
||||
char *inittermseq =
|
||||
"\033[?7h" // end-of-line autowrap ON mode
|
||||
"\033[20l"; // force NewLineMode off
|
||||
|
||||
buffer_append(&c->input, inittermseq, strlen(inittermseq));
|
||||
int state = c->istate;
|
||||
c->istate = CHAN_INPUT_WAIT_DRAIN;
|
||||
channel_output_poll();
|
||||
packet_write_poll(); // packet_write_wait();
|
||||
c->istate = state;
|
||||
}
|
||||
#endif
|
||||
chan_send_eof2(c);
|
||||
}
|
||||
chan_set_istate(c, CHAN_INPUT_CLOSED);
|
||||
} else {
|
||||
chan_send_ieof1(c);
|
||||
|
@ -880,13 +880,6 @@ collect_children(void)
|
||||
|
||||
process = s->pid;
|
||||
|
||||
// send the other side terminal to be how it was before if it was tty
|
||||
if ( (!s -> is_subsystem) && (s ->ttyfd != -1)) {
|
||||
char *inittermseq = "\033[20l\033[?7h\0" ; // no LFtoCRLF no AUTOWRAPON
|
||||
Channel *c=channel_by_id ( s->chanid );
|
||||
buffer_append(&c->input, inittermseq, strlen(inittermseq));
|
||||
packet_write_poll();
|
||||
}
|
||||
session_close_by_pid(s->pid, status);
|
||||
|
||||
if (s->pid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user