Re: [PATCH 3/3] Add VD_AGENT_CAP_MAX_CLIPBOARD support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/2014 01:28 AM, Marc-André Lureau wrote:
> ping

Looks good to me.

> 
> On Thu, Nov 14, 2013 at 5:03 PM, Marc-André Lureau
> <marcandre.lureau@xxxxxxxxx> wrote:
>> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
>>
>> Do not send clipboard data bigger than last received
>> VDAgentMaxClipboard.
>>
>> There is no need to further limit at the session agent, since it is
>> already OOM safe, and since marhsalling/sending is local, that shouldn't
>> make any stability or speed difference that deserves the added
>> complexity.
>> ---
>>  src/vdagentd.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/src/vdagentd.c b/src/vdagentd.c
>> index 2eb97cb..1098fb6 100644
>> --- a/src/vdagentd.c
>> +++ b/src/vdagentd.c
>> @@ -74,6 +74,7 @@ static int agent_owns_clipboard[256] = { 0, };
>>  static int quit = 0;
>>  static int retval = 0;
>>  static int client_connected = 0;
>> +static int max_clipboard = -1;
>>
>>  /* utility functions */
>>  /* vdagentd <-> spice-client communication handling */
>> @@ -98,6 +99,7 @@ static void send_capabilities(struct vdagent_virtio_port *vport,
>>      VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION);
>>      VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG);
>>      VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF);
>> +    VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MAX_CLIPBOARD);
>>
>>      vdagent_virtio_port_write(vport, VDP_CLIENT_PORT,
>>                                VD_AGENT_ANNOUNCE_CAPABILITIES, 0,
>> @@ -369,6 +371,13 @@ int virtio_port_read_complete(
>>          vdagent_virtio_port_reset(vport, VDP_CLIENT_PORT);
>>          do_client_disconnect();
>>          break;
>> +    case VD_AGENT_MAX_CLIPBOARD:
>> +        if (message_header->size != sizeof(VDAgentMaxClipboard))
>> +            goto size_error;
>> +        VDAgentMaxClipboard *msg = (VDAgentMaxClipboard *)data;
>> +        syslog(LOG_DEBUG, "Set max clipboard: %d", msg->max);
>> +        max_clipboard = msg->max;
>> +        break;
>>      default:
>>          syslog(LOG_WARNING, "unknown message type %d, ignoring",
>>                 message_header->type);
>> @@ -453,6 +462,12 @@ int do_agent_clipboard(struct udscs_connection *conn,
>>      case VDAGENTD_CLIPBOARD_DATA:
>>          msg_type = VD_AGENT_CLIPBOARD;
>>          data_type = header->arg2;
>> +        if (max_clipboard != -1 && size > max_clipboard) {
>> +            syslog(LOG_WARNING, "clipboard is too large (%d > %d), discarding",
>> +                   size, max_clipboard);
>> +            virtio_write_clipboard(selection, msg_type, data_type, NULL, 0);
>> +            return 0;
>> +        }
>>          break;
>>      case VDAGENTD_CLIPBOARD_RELEASE:
>>          msg_type = VD_AGENT_CLIPBOARD_RELEASE;
>> --
>> 1.8.3.1
>>
> 
> 
> 

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]