diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-06-06 16:03:33 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-06-06 16:07:30 +0200 |
commit | db278430f8994fe774beb50397cc935de5f1755f (patch) | |
tree | cff7b836f3ef7de76584a99756ccf49076c7b14b /server/reds.c | |
parent | b30daf38bfcb9e4a7c0e80b128493e0794469ba2 (diff) |
server: Add support for filtering out agent file-xfer msgs (rhbz#961848)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'server/reds.c')
-rw-r--r-- | server/reds.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/server/reds.c b/server/reds.c index ae02e098..b3dfb25a 100644 --- a/server/reds.c +++ b/server/reds.c @@ -125,6 +125,7 @@ void *red_tunnel = NULL; #endif int agent_mouse = TRUE; int agent_copypaste = TRUE; +int agent_file_xfer = TRUE; static bool exit_on_disconnect = FALSE; static RedsState *reds = NULL; @@ -483,7 +484,8 @@ static void reds_reset_vdp(void) state->current_read_buf = NULL; } /* Reset read filter to start with clean state when the agent reconnects */ - agent_msg_filter_init(&state->read_filter, agent_copypaste, TRUE); + agent_msg_filter_init(&state->read_filter, agent_copypaste, + agent_file_xfer, TRUE); /* Throw away pending chunks from the current (if any) and future * messages written by the client. * TODO: client should clear its agent messages queue when the agent @@ -596,7 +598,7 @@ void reds_client_disconnect(RedClient *client) /* Reset write filter to start with clean state on client reconnect */ agent_msg_filter_init(&reds->agent_state.write_filter, agent_copypaste, - TRUE); + agent_file_xfer, TRUE); /* Throw away pending chunks from the current (if any) and future * messages read from the agent */ @@ -3880,8 +3882,10 @@ static void init_vd_agent_resources(void) int i; ring_init(&state->read_bufs); - agent_msg_filter_init(&state->write_filter, agent_copypaste, TRUE); - agent_msg_filter_init(&state->read_filter, agent_copypaste, TRUE); + agent_msg_filter_init(&state->write_filter, agent_copypaste, + agent_file_xfer, TRUE); + agent_msg_filter_init(&state->read_filter, agent_copypaste, + agent_file_xfer, TRUE); state->read_state = VDI_PORT_READ_STATE_READ_HEADER; state->recive_pos = (uint8_t *)&state->vdi_chunk_header; @@ -4334,6 +4338,15 @@ SPICE_GNUC_VISIBLE int spice_server_set_agent_copypaste(SpiceServer *s, int enab return 0; } +SPICE_GNUC_VISIBLE int spice_server_set_agent_file_xfer(SpiceServer *s, int enable) +{ + spice_assert(reds == s); + agent_file_xfer = enable; + reds->agent_state.write_filter.file_xfer_enabled = agent_file_xfer; + reds->agent_state.read_filter.file_xfer_enabled = agent_file_xfer; + return 0; +} + /* returns FALSE if info is invalid */ static int reds_set_migration_dest_info(const char* dest, int port, int secure_port, |