Bug#790426: libspice-client-glib-2.0-8: Cannot access USB devices from spice client

2015-08-24 Thread Laurent Bigonville
On Mon, 29 Jun 2015 15:09:00 +0200 Michal Suchanek
 wrote:
> Hello,

Hi,

> I set up udev rules to enable access to select USB devices from my
> account but I cannot redirect them from the spice client.
> 
> This is because I did not set up policy kit permissions for those
> devices and opening the device directly is not attempted when
> policylit support is enabled.
> 
> Sending a patch that fixes this.

Could you please try to propose that patch upstream first?

Cheers,

Laurent Bigonville

> 
> Thanks
> 
> Michal
> 



Bug#790426: libspice-client-glib-2.0-8: Cannot access USB devices from spice client

2015-06-29 Thread Michal Suchanek
Package: libspice-client-glib-2.0-8
Version: 0.28-1
Severity: normal

Hello,

I set up udev rules to enable access to select USB devices from my
account but I cannot redirect them from the spice client.

This is because I did not set up policy kit permissions for those
devices and opening the device directly is not attempted when policylit
support is enabled.

Sending a patch that fixes this.

Thanks

Michal

-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (900, 'stable'), (610, 'oldstable'), (500, 'testing'), (410, 
'unstable'), (400, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.1.0-rc7+ (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages libspice-client-glib-2.0-8 depends on:
ii  libc6 2.19-18
ii  libglib2.0-0  2.42.1-1
ii  libjpeg62-turbo   1:1.3.1-12
ii  liblz4-1  0.0~r122-2
ii  libopus0  1.1-2
ii  libpixman-1-0 0.32.6-3
ii  libpulse-mainloop-glib0   5.0-13
ii  libpulse0 5.0-13
ii  libsasl2-22.1.26.dfsg1-13
ii  libssl1.0.0   1.0.1k-3+deb8u1
ii  libusb-1.0-0  2:1.0.19-1
ii  libusbredirhost1  0.7-1
ii  libusbredirparser10.7-1
ii  multiarch-support 2.19-18
ii  spice-client-glib-usb-acl-helper  0.25-1+b1
ii  zlib1g1:1.2.8.dfsg-2+b1

libspice-client-glib-2.0-8 recommends no packages.

libspice-client-glib-2.0-8 suggests no packages.

-- no debconf information
Even if polkit is used try to open the device first.
Otherwise user accessible devices are denied because of negative polkit reply.
Index: spice-gtk-0.28/gtk/channel-usbredir.c
===
--- spice-gtk-0.28.orig/gtk/channel-usbredir.c	2015-02-06 02:24:10.0 +0100
+++ spice-gtk-0.28/gtk/channel-usbredir.c	2015-06-29 14:49:44.962340089 +0200
@@ -319,9 +319,7 @@
 {
 SpiceUsbredirChannelPrivate *priv = channel->priv;
 GSimpleAsyncResult *result;
-#if ! USE_POLKIT
 GError *err = NULL;
-#endif
 
 g_return_if_fail(SPICE_IS_USBREDIR_CHANNEL(channel));
 g_return_if_fail(device != NULL);
@@ -348,28 +346,28 @@
 priv->device = libusb_ref_device(device);
 priv->spice_device = g_boxed_copy(spice_usb_device_get_type(),
   spice_device);
+if (!spice_usbredir_channel_open_device(channel, &err)) {
 #if USE_POLKIT
-priv->result = result;
-priv->state  = STATE_WAITING_FOR_ACL_HELPER;
-priv->acl_helper = spice_usb_acl_helper_new();
-g_object_set(spice_channel_get_session(SPICE_CHANNEL(channel)),
- "inhibit-keyboard-grab", TRUE, NULL);
-spice_usb_acl_helper_open_acl(priv->acl_helper,
-  libusb_get_bus_number(device),
-  libusb_get_device_address(device),
-  cancellable,
-  spice_usbredir_channel_open_acl_cb,
-  channel);
-return;
+priv->result = result;
+priv->state  = STATE_WAITING_FOR_ACL_HELPER;
+priv->acl_helper = spice_usb_acl_helper_new();
+g_object_set(spice_channel_get_session(SPICE_CHANNEL(channel)),
+"inhibit-keyboard-grab", TRUE, NULL);
+spice_usb_acl_helper_open_acl(priv->acl_helper,
+libusb_get_bus_number(device),
+libusb_get_device_address(device),
+cancellable,
+spice_usbredir_channel_open_acl_cb,
+channel);
+return;
 #else
-if (!spice_usbredir_channel_open_device(channel, &err)) {
 g_simple_async_result_take_error(result, err);
 libusb_unref_device(priv->device);
 priv->device = NULL;
 g_boxed_free(spice_usb_device_get_type(), priv->spice_device);
 priv->spice_device = NULL;
-}
 #endif
+}
 
 done:
 g_simple_async_result_complete_in_idle(result);