From 11786890112f39858b82ce54b5ca70bf4ba9e5f7 Mon Sep 17 00:00:00 2001 From: quamrulmina Date: Sun, 25 Oct 2015 23:54:56 -0500 Subject: [PATCH] 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. --- session.c | 8 +++++++- sshpty.c | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/session.c b/session.c index c884818..926e68f 100644 --- a/session.c +++ b/session.c @@ -610,8 +610,14 @@ do_exec_no_pty(Session *s, const char *command) //FreeConsole(); //AllocConsole(); MakeNewConsole(); + prot_scr_width = s->col; + prot_scr_height = s->row; + extern HANDLE hConsole ; + hConsole = GetStdHandle (STD_OUTPUT_HANDLE); + ConSetScreenSize( s->col, s->row ); + s->ptyfd = hConsole ; // the pty is the Windows console output handle in our Win32 port - wfdtocmd = GetStdHandle (STD_INPUT_HANDLE) ; + wfdtocmd = GetStdHandle (STD_INPUT_HANDLE) ; // we use this console handle to feed input to Windows shell cmd.exe sockin[1] = allocate_sfd((int)wfdtocmd); // put the std input handle in our global general handle table //if (sockin[1] >= 0) // sfd_set_to_console(sockin[1]); // mark it as Console type diff --git a/sshpty.c b/sshpty.c index 2fba470..8f8b5d6 100644 --- a/sshpty.c +++ b/sshpty.c @@ -211,6 +211,10 @@ pty_change_window_size(int ptyfd, u_int row, u_int col, w.ws_xpixel = xpixel; w.ws_ypixel = ypixel; (void) ioctl(ptyfd, TIOCSWINSZ, &w); +#else + extern HANDLE hConsole ; + hConsole = ptyfd; + ConSetScreenSize( col, row ); #endif }