[spice-gtk] smartcard: Warn if multiple readers are detected

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

 



spice-server does not deal properly with multiple smartcard readers,
only the first one will be working. Add a warning when this happens to
make it easier to diagnose such issues.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 src/smartcard-manager.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index ceecfdc7..456c3c2e 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -389,6 +389,25 @@ typedef struct {
     GError *err;
 } SmartcardManagerInitArgs;
 
+/* spice-server only supports one smartcard reader being in use */
+static void smartcard_check_reader_count(void)
+{
+    unsigned int reader_count = 0;
+    GList *readers;
+    GList *it;
+
+    readers = spice_smartcard_manager_get_readers(spice_smartcard_manager_get());
+
+    for (it = readers; it != NULL; it = it->next) {
+        reader_count++;
+        g_boxed_free(SPICE_TYPE_SMARTCARD_READER, it->data);
+    }
+    if (reader_count > 1) {
+        g_warning("Multiple smartcard readers are plugged in, only the first one will be shared with the VM");
+    }
+    g_list_free(readers);
+}
+
 static gboolean smartcard_manager_init(SmartcardManagerInitArgs *args)
 {
     gchar *emul_args = NULL;
@@ -442,6 +461,7 @@ init:
                                 "Failed to initialize smartcard");
         goto end;
     }
+    smartcard_check_reader_count();
 
     retval = TRUE;
 
-- 
2.20.1

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




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