Skip to content

Commit 1178689

Browse files
committed
sshd pty console screen size set to what ssh client requests
Initial remote console screen size set correctly in sshd interactive session to the value we received from the ssh client in the pty-req request.
1 parent b56534c commit 1178689

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

session.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,14 @@ do_exec_no_pty(Session *s, const char *command)
610610
//FreeConsole();
611611
//AllocConsole();
612612
MakeNewConsole();
613-
614-
wfdtocmd = GetStdHandle (STD_INPUT_HANDLE) ;
613+
prot_scr_width = s->col;
614+
prot_scr_height = s->row;
615+
extern HANDLE hConsole ;
616+
hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
617+
ConSetScreenSize( s->col, s->row );
618+
s->ptyfd = hConsole ; // the pty is the Windows console output handle in our Win32 port
619+
620+
wfdtocmd = GetStdHandle (STD_INPUT_HANDLE) ; // we use this console handle to feed input to Windows shell cmd.exe
615621
sockin[1] = allocate_sfd((int)wfdtocmd); // put the std input handle in our global general handle table
616622
//if (sockin[1] >= 0)
617623
// sfd_set_to_console(sockin[1]); // mark it as Console type

sshpty.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ pty_change_window_size(int ptyfd, u_int row, u_int col,
211211
w.ws_xpixel = xpixel;
212212
w.ws_ypixel = ypixel;
213213
(void) ioctl(ptyfd, TIOCSWINSZ, &w);
214+
#else
215+
extern HANDLE hConsole ;
216+
hConsole = ptyfd;
217+
ConSetScreenSize( col, row );
214218
#endif
215219
}
216220

0 commit comments

Comments
 (0)