Fix smartcards only working when cold plugged

Related: RHEL-47261
This commit is contained in:
Felipe Borges 2024-10-29 12:57:51 +01:00
parent a72cadd67f
commit 93d1d3e16c
2 changed files with 42 additions and 1 deletions

View File

@ -11,7 +11,7 @@
Name: gnome-settings-daemon Name: gnome-settings-daemon
Version: 40.0.1 Version: 40.0.1
Release: 17%{?dist} Release: 18%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
License: GPLv2+ License: GPLv2+
@ -73,6 +73,7 @@ Patch00003: im-module-setting-fix.patch
Patch00004: print-notifications-clear-in-stop.patch Patch00004: print-notifications-clear-in-stop.patch
Patch00005: 0001-power-Respect-the-nothing-power-button-action-for-VM.patch Patch00005: 0001-power-Respect-the-nothing-power-button-action-for-VM.patch
Patch00006: usb-protection-dont-crash-when-screensaver-service-unavailable.patch Patch00006: usb-protection-dont-crash-when-screensaver-service-unavailable.patch
Patch00007: smartcard-hotplug.patch
%description %description
A daemon to share settings from GNOME to other applications. It also A daemon to share settings from GNOME to other applications. It also
@ -198,6 +199,10 @@ cp %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/glib-2.0/schemas
%{_libdir}/pkgconfig/gnome-settings-daemon.pc %{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog %changelog
* Tue Oct 29 2024 Felipe Borges <feborges@redhat.com> - 40.0.1-18
- Fix smartcards only working when cold-plugged
Related: RHEL-47261
* Mon Mar 25 2024 Felipe Borges <feborges@redhat.com> - 40.0.1-17 * Mon Mar 25 2024 Felipe Borges <feborges@redhat.com> - 40.0.1-17
- Fix usb-protection crash when when screensaver service is unavailable - Fix usb-protection crash when when screensaver service is unavailable
Related: RHEL-19295 Related: RHEL-19295

36
smartcard-hotplug.patch Normal file
View File

@ -0,0 +1,36 @@
From e5b52d51d301bf19efc4211f2fa9f256f64a2a29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20H=C3=A4rdeman?= <david@hardeman.nu>
Date: Wed, 12 Apr 2023 22:23:51 +0200
Subject: [PATCH] smartcard: check for the addition of new smartcard readers
gsd-smartcard currently checks for the insertion/removal of smartcards
in reader devices which where present at the time gsd-smartcard was
started, but does not account for new smartcard readers appearing
after gsd-smartcard was started.
This patch adds support for checking for the addition of new slots
(i.e. smartcard readers), which is necessary to support devices
like the Yubikey (a "reader" and a smartcard) which may be inserted
after gsd-smartcard was started.
---
plugins/smartcard/gsd-smartcard-manager.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index acd22df819..a219e22ef7 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -212,7 +212,12 @@ watch_one_event_from_driver (GsdSmartcardManager *self,
error_code = PORT_GetError ();
if (error_code == SEC_ERROR_NO_EVENT) {
- g_usleep (1 * G_USEC_PER_SEC);
+ int old_slot_count = operation->driver->slotCount;
+ SECMOD_UpdateSlotList (operation->driver);
+ if (operation->driver->slotCount != old_slot_count)
+ g_debug ("Slot count change %i -> %i", old_slot_count, operation->driver->slotCount);
+ else
+ g_usleep (1 * G_USEC_PER_SEC);
return TRUE;
}