summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-06-16 13:10:55 +0200
committerHans de Goede <hdegoede@redhat.com>2011-07-15 10:42:12 +0200
commita65884e6b6894c56492771b0a1bbb8458941a991 (patch)
tree15b8982638205d61919afbfa910347cbc123ca0f
parent5814222821a5e41e610633b73d6e739be7c4cbad (diff)
vdagents: add VDAGENTD_VERSION message
Disconnects vdagent if version mismatch.
-rw-r--r--src/vdagent.c12
-rw-r--r--src/vdagentd-proto-strings.h1
-rw-r--r--src/vdagentd-proto.h1
-rw-r--r--src/vdagentd.c3
4 files changed, 17 insertions, 0 deletions
diff --git a/src/vdagent.c b/src/vdagent.c
index 2b69865..db18617 100644
--- a/src/vdagent.c
+++ b/src/vdagent.c
@@ -19,6 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -68,6 +72,14 @@ void daemon_read_complete(struct udscs_connection **connp,
vdagent_x11_clipboard_release(x11, header->arg1);
free(data);
break;
+ case VDAGENTD_VERSION:
+ if (strcmp(data, VERSION) != 0) {
+ fprintf(logfile,
+ "Fatal vdagentd version mismatch: got %s expected %s\n",
+ data, VERSION);
+ udscs_destroy_connection(connp);
+ }
+ break;
default:
if (verbose)
fprintf(logfile, "Unknown message from vdagentd type: %d\n",
diff --git a/src/vdagentd-proto-strings.h b/src/vdagentd-proto-strings.h
index 02adf01..f39e25b 100644
--- a/src/vdagentd-proto-strings.h
+++ b/src/vdagentd-proto-strings.h
@@ -29,6 +29,7 @@ static const char * const vdagentd_messages[] = {
"clipboard request",
"clipboard data",
"clipboard release",
+ "version",
};
#endif
diff --git a/src/vdagentd-proto.h b/src/vdagentd-proto.h
index e570d2b..9d96540 100644
--- a/src/vdagentd-proto.h
+++ b/src/vdagentd-proto.h
@@ -33,6 +33,7 @@ enum {
VDAGENTD_CLIPBOARD_REQUEST, /* arg1: selection, arg 2 = type */
VDAGENTD_CLIPBOARD_DATA, /* arg1: sel, arg 2: type, data: data */
VDAGENTD_CLIPBOARD_RELEASE, /* arg1: selection */
+ VDAGENTD_VERSION, /* daemon -> client, data: version string */
VDAGENTD_NO_MESSAGES /* Must always be last */
};
diff --git a/src/vdagentd.c b/src/vdagentd.c
index be6ef1f..3c05ef0 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -522,6 +522,9 @@ void agent_connect(struct udscs_connection *conn)
udscs_set_user_data(conn, (void *)agent_data);
update_active_session_connection();
+ udscs_write(conn, VDAGENTD_VERSION, 0, 0,
+ (uint8_t *)VERSION, strlen(VERSION) + 1);
+
if (mon_config)
udscs_write(conn, VDAGENTD_MONITORS_CONFIG, 0, 0,
(uint8_t *)mon_config, sizeof(VDAgentMonitorsConfig) +