[Spice-devel] [PATCH spice-gtk] main: Handle disabled file transfer

Victor Toso victortoso at redhat.com
Fri Mar 10 07:33:52 UTC 2017


Hi,

On Fri, Mar 10, 2017 at 08:20:53AM +0100, Pavel Grunt wrote:
> File transfer can be disabled by the server or agent, it is
> signalized by the VD_AGENT_CAP_FILE_XFER_DISABLED set.
>
> Do not try to transfer files when the capability is set.
>
> Resolves: rhbz#1373725
> ---
> Sending to show usage of the cap proposed in:
> https://lists.freedesktop.org/archives/spice-devel/2017-February/036106.html
> ---
>  src/channel-main.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/channel-main.c b/src/channel-main.c
> index cd3dee7..fd9764b 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -225,6 +225,7 @@ static const char *agent_caps[] = {
>      [ VD_AGENT_CAP_MAX_CLIPBOARD       ] = "max-clipboard",
>      [ VD_AGENT_CAP_AUDIO_VOLUME_SYNC   ] = "volume-sync",
>      [ VD_AGENT_CAP_MONITORS_CONFIG_POSITION ] = "monitors config position",
> +    [ VD_AGENT_CAP_FILE_XFER_DISABLED ] = "file transfer disabled",
>  };
>  #define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
>  
> @@ -3097,6 +3098,17 @@ void spice_main_file_copy_async(SpiceMainChannel *channel,
>          return;
>      }
>  
> +    if (test_agent_cap(channel, VD_AGENT_CAP_FILE_XFER_DISABLED)) {
> +        g_task_report_new_error(channel,
> +                                callback,
> +                                user_data,
> +                                spice_main_file_copy_async,
> +                                SPICE_CLIENT_ERROR,
> +                                SPICE_CLIENT_ERROR_FAILED,
> +                                "The file transfer is disabled");

_("The file transfer is disabled")

Maybe add "in the host" to not have one confused where it is disabled.

Acked-by: Victor Toso <victortoso at redhat.com>

> +        return;
> +    }
> +
>      xfer_op = g_new0(FileTransferOperation, 1);
>      xfer_op->channel = channel;
>      xfer_op->progress_callback = progress_callback;
> -- 
> 2.12.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170310/d83ca2f5/attachment.sig>


More information about the Spice-devel mailing list