summaryrefslogtreecommitdiffstats
path: root/server-msg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-07-01 19:47:02 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-07-01 19:47:02 +0000
commitdd41035a4d71057108da8c7b5e1876cc02b4995c (patch)
treea8122ccd8c988b6a7e7645db1e8d7637e7992b1c /server-msg.c
parent87b9851f3a125820e04844733f792350f5ae3e2c (diff)
Protocol versioning, version is checked on identify message.
Diffstat (limited to 'server-msg.c')
-rw-r--r--server-msg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/server-msg.c b/server-msg.c
index ad193fd7..fef163d1 100644
--- a/server-msg.c
+++ b/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>
@@ -172,7 +172,15 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c)
buffer_read(c->in, &data, sizeof data);
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->sy = data.sy;