mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00:00
Protocol versioning, version is checked on identify message.
This commit is contained in:
parent
87b9851f3a
commit
dd41035a4d
4
CHANGES
4
CHANGES
@ -1,5 +1,7 @@
|
|||||||
01 July 2008
|
01 July 2008
|
||||||
|
|
||||||
|
* Protocol versioning. Clients which identify as a different version from the
|
||||||
|
server will be rejected.
|
||||||
* tmux 0.4 released.
|
* tmux 0.4 released.
|
||||||
|
|
||||||
29 June 2008
|
29 June 2008
|
||||||
@ -596,4 +598,4 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.147 2008-07-01 05:43:00 nicm Exp $
|
$Id: CHANGES,v 1.148 2008-07-01 19:47:02 nicm Exp $
|
||||||
|
3
client.c
3
client.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: client.c,v 1.33 2008-06-23 16:58:49 nicm Exp $ */
|
/* $Id: client.c,v 1.34 2008-07-01 19:47:02 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -93,6 +93,7 @@ retry:
|
|||||||
if (isatty(STDIN_FILENO)) {
|
if (isatty(STDIN_FILENO)) {
|
||||||
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
|
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
|
||||||
fatal("ioctl(TIOCGWINSZ)");
|
fatal("ioctl(TIOCGWINSZ)");
|
||||||
|
data.version = PROTOCOL_VERSION;
|
||||||
data.sx = ws.ws_col;
|
data.sx = ws.ws_col;
|
||||||
data.sy = ws.ws_row;
|
data.sy = ws.ws_row;
|
||||||
*data.tty = '\0';
|
*data.tty = '\0';
|
||||||
|
12
server-msg.c
12
server-msg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server-msg.c,v 1.48 2008-06-21 10:19:36 nicm Exp $ */
|
/* $Id: server-msg.c,v 1.49 2008-07-01 19:47:02 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -172,7 +172,15 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c)
|
|||||||
buffer_read(c->in, &data, sizeof data);
|
buffer_read(c->in, &data, sizeof data);
|
||||||
term = cmd_recv_string(c->in);
|
term = cmd_recv_string(c->in);
|
||||||
|
|
||||||
log_debug("identify msg from client: %u,%u", data.sx, data.sy);
|
log_debug("identify msg from client: %u,%u (%d)",
|
||||||
|
data.sx, data.sy, data.version);
|
||||||
|
|
||||||
|
if (data.version != PROTOCOL_VERSION) {
|
||||||
|
#define MSG "protocol version mismatch"
|
||||||
|
server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1);
|
||||||
|
#undef MSG
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
c->sx = data.sx;
|
c->sx = data.sx;
|
||||||
c->sy = data.sy;
|
c->sy = data.sy;
|
||||||
|
7
tmux.h
7
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.172 2008-06-30 05:34:06 nicm Exp $ */
|
/* $Id: tmux.h,v 1.173 2008-07-01 19:47:02 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -19,6 +19,8 @@
|
|||||||
#ifndef TMUX_H
|
#ifndef TMUX_H
|
||||||
#define TMUX_H
|
#define TMUX_H
|
||||||
|
|
||||||
|
#define PROTOCOL_VERSION -1
|
||||||
|
|
||||||
/* Shut up gcc warnings about empty if bodies. */
|
/* Shut up gcc warnings about empty if bodies. */
|
||||||
#define RB_AUGMENT(x) do {} while (0)
|
#define RB_AUGMENT(x) do {} while (0)
|
||||||
|
|
||||||
@ -330,7 +332,7 @@ struct buffer {
|
|||||||
#define TTY_KKEYPADOFF 22
|
#define TTY_KKEYPADOFF 22
|
||||||
#define TTY_KKEYPADON 23
|
#define TTY_KKEYPADON 23
|
||||||
#define TTY_MOUSEON 24
|
#define TTY_MOUSEON 24
|
||||||
#define TTY_MOUSEOFF 25 /* XXX merge allon/off into 1 arg? */
|
#define TTY_MOUSEOFF 25 /* XXX merge all on/off into 1 arg? */
|
||||||
|
|
||||||
/* Message codes. */
|
/* Message codes. */
|
||||||
enum hdrtype {
|
enum hdrtype {
|
||||||
@ -361,6 +363,7 @@ struct msg_command_data {
|
|||||||
|
|
||||||
struct msg_identify_data {
|
struct msg_identify_data {
|
||||||
char tty[TTY_NAME_MAX];
|
char tty[TTY_NAME_MAX];
|
||||||
|
int version;
|
||||||
|
|
||||||
u_int sx;
|
u_int sx;
|
||||||
u_int sy;
|
u_int sy;
|
||||||
|
Loading…
Reference in New Issue
Block a user