Skip to content

Commit 9f26b75

Browse files
committed
sshd sets the client terminal mode to original after an interactive session ends
This is needed so that sftp running after a ssh session from a Linux client does not see two lines for each line typed. CRLF is set by win32 sshd server but we have to set mode to the previous way in the client when an interactive session has ended.
1 parent c051e06 commit 9f26b75

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

serverloop.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,13 @@ collect_children(void)
880880

881881
process = s->pid;
882882

883+
// send the other side terminal to be how it was before if it was tty
884+
if ( (!s -> is_subsystem) && (s ->ttyfd != -1)) {
885+
char *inittermseq = "\033[20l\033[?7h\0" ; // no LFtoCRLF no AUTOWRAPON
886+
Channel *c=channel_by_id ( s->chanid );
887+
buffer_append(&c->input, inittermseq, strlen(inittermseq));
888+
channel_output_poll();
889+
}
883890
session_close_by_pid(s->pid, status);
884891

885892
CloseHandle(process);

0 commit comments

Comments
 (0)