mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 14:04:59 +02:00
ssh.exe client sends current window size and TERM value when pty-req is made
This was not coded before for Win32 port. Remote sshd server is now aware of our client's screen size and VT/ANSI TERM emulation.
This commit is contained in:
parent
f1d8b2e72d
commit
de4ae13f76
26
channels.c
26
channels.c
@ -3913,10 +3913,11 @@ channel_connect_to_path(const char *path, char *ctype, char *rname)
|
|||||||
return connect_to(path, PORT_STREAMLOCAL, ctype, rname);
|
return connect_to(path, PORT_STREAMLOCAL, ctype, rname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WIN32_FIXME
|
||||||
void
|
void
|
||||||
channel_send_window_changes(void)
|
channel_send_window_changes(void)
|
||||||
{
|
{
|
||||||
#ifndef WIN32_FIXME
|
|
||||||
u_int i;
|
u_int i;
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
@ -3933,9 +3934,30 @@ channel_send_window_changes(void)
|
|||||||
packet_put_int((u_int)ws.ws_ypixel);
|
packet_put_int((u_int)ws.ws_ypixel);
|
||||||
packet_send();
|
packet_send();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else // WIN32_FIXME
|
||||||
|
void
|
||||||
|
channel_send_window_changes(int col, int row, int xpixel, int ypixel)
|
||||||
|
{
|
||||||
|
u_int i;
|
||||||
|
struct winsize ws;
|
||||||
|
|
||||||
|
for (i = 0; i < channels_alloc; i++) {
|
||||||
|
if (channels[i] == NULL || !channels[i]->client_tty ||
|
||||||
|
channels[i]->type != SSH_CHANNEL_OPEN)
|
||||||
|
continue;
|
||||||
|
channel_request_start(i, "window-change", 0);
|
||||||
|
packet_put_int((u_int)col);
|
||||||
|
packet_put_int((u_int)row);
|
||||||
|
packet_put_int((u_int)xpixel);
|
||||||
|
packet_put_int((u_int)ypixel);
|
||||||
|
packet_send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* -- X11 forwarding */
|
/* -- X11 forwarding */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -226,7 +226,12 @@ void channel_register_status_confirm(int, channel_confirm_cb *,
|
|||||||
channel_confirm_abandon_cb *, void *);
|
channel_confirm_abandon_cb *, void *);
|
||||||
void channel_cancel_cleanup(int);
|
void channel_cancel_cleanup(int);
|
||||||
int channel_close_fd(int *);
|
int channel_close_fd(int *);
|
||||||
|
#ifndef WIN32_FIXME
|
||||||
void channel_send_window_changes(void);
|
void channel_send_window_changes(void);
|
||||||
|
#else
|
||||||
|
void channel_send_window_changes(int, int, int, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* protocol handler */
|
/* protocol handler */
|
||||||
|
|
||||||
|
35
clientloop.c
35
clientloop.c
@ -119,6 +119,12 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define isatty(a) WSHELPisatty(a)
|
#define isatty(a) WSHELPisatty(a)
|
||||||
|
|
||||||
|
// Windows Console screen size change related
|
||||||
|
extern int ScreenX;
|
||||||
|
extern int ScrollBottom;
|
||||||
|
int win_received_window_change_signal = 1;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* import options */
|
/* import options */
|
||||||
@ -563,6 +569,25 @@ client_check_window_change(void)
|
|||||||
packet_put_int((u_int)ws.ws_ypixel);
|
packet_put_int((u_int)ws.ws_ypixel);
|
||||||
packet_send();
|
packet_send();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (! win_received_window_change_signal)
|
||||||
|
return;
|
||||||
|
/** XXX race */
|
||||||
|
win_received_window_change_signal = 0;
|
||||||
|
|
||||||
|
debug2("client_check_window_change: changed");
|
||||||
|
|
||||||
|
if (compat20) {
|
||||||
|
channel_send_window_changes(ScreenX, ScrollBottom, 640, 480);
|
||||||
|
} else {
|
||||||
|
packet_start(SSH_CMSG_WINDOW_SIZE);
|
||||||
|
packet_put_int((u_int)ScreenX);
|
||||||
|
packet_put_int((u_int)ScrollBottom);
|
||||||
|
packet_put_int((u_int)640);
|
||||||
|
packet_put_int((u_int)480);
|
||||||
|
packet_send();
|
||||||
|
}
|
||||||
#endif /* !WIN32_FIXME */
|
#endif /* !WIN32_FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2571,11 +2596,11 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
|
|||||||
tty_make_modes(-1, tiop);
|
tty_make_modes(-1, tiop);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
packet_put_cstring(term != NULL ? term : "");
|
packet_put_cstring(term != NULL ? term : "vt220");
|
||||||
packet_put_int((u_int) 80 /*ws.ws_col*/);
|
packet_put_int((u_int) ScreenX);
|
||||||
packet_put_int((u_int) 25 /*ws.ws_row*/);
|
packet_put_int((u_int) ScrollBottom);
|
||||||
packet_put_int((u_int) 640 /*ws.ws_xpixel*/);
|
packet_put_int((u_int) 640);
|
||||||
packet_put_int((u_int) 480 /*ws.ws_ypixel*/);
|
packet_put_int((u_int) 480);
|
||||||
tty_make_modes(-1, NULL);
|
tty_make_modes(-1, NULL);
|
||||||
#endif /* else !WIN32_FIXME */
|
#endif /* else !WIN32_FIXME */
|
||||||
packet_send();
|
packet_send();
|
||||||
|
11
ssh.c
11
ssh.c
@ -580,6 +580,7 @@ set_addrinfo_port(struct addrinfo *addrs, int port)
|
|||||||
/*
|
/*
|
||||||
* Main program for the ssh client.
|
* Main program for the ssh client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int ac, char **av)
|
main(int ac, char **av)
|
||||||
{
|
{
|
||||||
@ -606,9 +607,6 @@ main(int ac, char **av)
|
|||||||
* parent server is stopped.
|
* parent server is stopped.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AllocConsole();
|
|
||||||
ConInit( STD_OUTPUT_HANDLE, TRUE );
|
|
||||||
|
|
||||||
SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE);
|
SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1502,6 +1500,13 @@ main(int ac, char **av)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32_FIXME
|
||||||
|
if (tty_flag) {
|
||||||
|
//AllocConsole();
|
||||||
|
ConInit( STD_OUTPUT_HANDLE, TRUE );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
exit_status = compat20 ? ssh_session2() : ssh_session();
|
exit_status = compat20 ? ssh_session2() : ssh_session();
|
||||||
packet_close();
|
packet_close();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user