[usbredir PATCH] usbredirfilter_check: block device if all its interfaces skipped

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

 



See usbredirfilter.h for when interfaces are skipped.

Fixes rhbz#1179210
---
 usbredirparser/usbredirfilter.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/usbredirparser/usbredirfilter.c b/usbredirparser/usbredirfilter.c
index ef9c63a..5cbbfbf 100644
--- a/usbredirparser/usbredirfilter.c
+++ b/usbredirparser/usbredirfilter.c
@@ -172,7 +172,7 @@ int usbredirfilter_check(
     uint16_t vendor_id, uint16_t product_id, uint16_t device_version_bcd,
     int flags)
 {
-    int i, rc;
+    int i, rc, num_skipped=0;
 
     if (usbredirfilter_verify(rules, rules_count))
         return -EINVAL;
@@ -190,9 +190,10 @@ int usbredirfilter_check(
     for (i = 0; i < interface_count; i++) {
         if (!(flags & usbredirfilter_fl_dont_skip_non_boot_hid) &&
                 interface_count > 1 && interface_class[i] == 0x03 &&
-                interface_subclass[i] == 0x00 && interface_protocol[i] == 0x00)
+                interface_subclass[i] == 0x00 && interface_protocol[i] == 0x00) {
+            num_skipped++;
             continue;
-
+	}
         rc = usbredirfilter_check1(rules, rules_count, interface_class[i],
                                    vendor_id, product_id, device_version_bcd,
                                    flags & usbredirfilter_fl_default_allow);
@@ -200,6 +201,10 @@ int usbredirfilter_check(
             return rc;
     }
 
+    /* If all interfaces were skipped, block the device */
+    if (num_skipped == interface_count)
+	return -ENOENT;
+
     return 0;
 }
 
-- 
2.4.3

_______________________________________________
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]