Skip to content

Commit

Permalink
qrexec: add version negotiation
Browse files Browse the repository at this point in the history
Use lower version from (local, remote).

QubesOS/qubes-issues#4909
  • Loading branch information
marmarek committed Mar 31, 2019
1 parent b6e3f36 commit 61ec339
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qrexec/qrexec-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ int handle_agent_hello(libvchan_t *ctrl, const char *domain_name)
{
struct msg_header hdr;
struct peer_info info;
int actual_version;

if (libvchan_recv(ctrl, &hdr, sizeof(hdr)) != sizeof(hdr)) {
fprintf(stderr, "Failed to read agent HELLO hdr\n");
Expand All @@ -202,7 +203,9 @@ int handle_agent_hello(libvchan_t *ctrl, const char *domain_name)
return -1;
}

if (info.version != QREXEC_PROTOCOL_VERSION) {
actual_version = info.version < QREXEC_PROTOCOL_VERSION ? info.version : QREXEC_PROTOCOL_VERSION;

if (actual_version != QREXEC_PROTOCOL_VERSION) {
fprintf(stderr, "Incompatible agent protocol version (remote %d, local %d)\n", info.version, QREXEC_PROTOCOL_VERSION);
incompatible_protocol_error_message(domain_name, info.version);
return -1;
Expand Down

0 comments on commit 61ec339

Please sign in to comment.