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.
This commit is contained in:
quamrulmina 2015-10-25 23:54:56 -05:00
parent b56534c4a6
commit 1178689011
2 changed files with 11 additions and 1 deletions

View File

@ -610,8 +610,14 @@ do_exec_no_pty(Session *s, const char *command)
//FreeConsole(); //FreeConsole();
//AllocConsole(); //AllocConsole();
MakeNewConsole(); 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 sockin[1] = allocate_sfd((int)wfdtocmd); // put the std input handle in our global general handle table
//if (sockin[1] >= 0) //if (sockin[1] >= 0)
// sfd_set_to_console(sockin[1]); // mark it as Console type // sfd_set_to_console(sockin[1]); // mark it as Console type

View File

@ -211,6 +211,10 @@ pty_change_window_size(int ptyfd, u_int row, u_int col,
w.ws_xpixel = xpixel; w.ws_xpixel = xpixel;
w.ws_ypixel = ypixel; w.ws_ypixel = ypixel;
(void) ioctl(ptyfd, TIOCSWINSZ, &w); (void) ioctl(ptyfd, TIOCSWINSZ, &w);
#else
extern HANDLE hConsole ;
hConsole = ptyfd;
ConSetScreenSize( col, row );
#endif #endif
} }