[Spice-commits] src/smartcard-manager.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 19 13:56:43 UTC 2019


 src/smartcard-manager.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 9130a54fb54a4ea0c8b9ffb11b62f9d416cb7534
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Feb 15 15:31:12 2019 +0100

    smartcard: Warn if multiple readers are detected
    
    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 at redhat.com>
    Acked-by: Marc-André Lureau <marcandre.lureau at gmail.com>

diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index ceecfdc..35bb275 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -389,6 +389,24 @@ typedef struct {
     GError *err;
 } SmartcardManagerInitArgs;
 
+
+static void smartcard_reader_free(gpointer data)
+{
+    g_boxed_free(SPICE_TYPE_SMARTCARD_READER, data);
+}
+
+/* spice-server only supports one smartcard reader being in use */
+static void smartcard_check_reader_count(void)
+{
+    GList *readers;
+
+    readers = spice_smartcard_manager_get_readers(spice_smartcard_manager_get());
+    if (g_list_length(readers) > 1) {
+        g_warning("Multiple smartcard readers are plugged in, only the first one will be shared with the VM");
+    }
+    g_list_free_full(readers, smartcard_reader_free);
+}
+
 static gboolean smartcard_manager_init(SmartcardManagerInitArgs *args)
 {
     gchar *emul_args = NULL;
@@ -442,6 +460,7 @@ init:
                                 "Failed to initialize smartcard");
         goto end;
     }
+    smartcard_check_reader_count();
 
     retval = TRUE;
 


More information about the Spice-commits mailing list