1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Fix copymode when hlimit mismatches the client side

This commit is contained in:
Nicolas Viennot 2013-06-26 00:59:58 -04:00
parent 6b31869600
commit 278b20f506
2 changed files with 11 additions and 6 deletions

View File

@ -99,12 +99,9 @@ static void unpack_array(struct tmate_unpacker *uk,
static void tmate_header(struct tmate_unpacker *uk)
{
char hostname[128];
int protocol = unpack_int(uk);
tmate_client.protocol = unpack_int(uk);
if (protocol != 1)
decoder_error();
tmate_debug("new master, protocol version: %d", protocol);
tmate_debug("new master, protocol version: %d", tmate_client.protocol);
if (gethostname(hostname, sizeof(hostname)) < 0)
tmate_fatal("cannot get hostname");
@ -356,7 +353,12 @@ static void tmate_sync_copy_mode(struct tmate_unpacker *uk)
if (sel_uk.argc) {
data->screen.sel.flag = 1;
data->selx = unpack_int(&sel_uk);
data->sely = unpack_int(&sel_uk);
if (tmate_client.protocol >= 2) {
data->sely = -unpack_int(&sel_uk) + screen_hsize(data->backing)
+ screen_size_y(data->backing)
- 1;
} else
data->sely = unpack_int(&sel_uk);
data->rectflag = unpack_int(&sel_uk);
} else
data->screen.sel.flag = 0;

View File

@ -99,6 +99,9 @@ struct tmate_ssh_client {
struct event ev_ssh;
struct event ev_keepalive_timer;
/* only for tmux client */
int protocol;
/* only for client-pty */
int pty;
struct event ev_pty;