Treat pcsc::Error::NoSmartcard as a "YubiKey disconnected" error

Some SmartCard readers report this error when no SmartCard is inserted,
so we need to check for it when filtering for connected YubiKeys (along
with `pcsc::Error::RemovedCard` which some _other_ SmartCard readers
report instead).

Closes str4d/age-plugin-yubikey#81.
This commit is contained in:
Jack Grigg
2023-01-29 14:27:20 +00:00
parent a5178bb16e
commit ff3e8e37c9
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -11,6 +11,8 @@ to 0.3.0 are beta releases.
- When `age-plugin-yubikey` assists the user in changing their PIN from the - When `age-plugin-yubikey` assists the user in changing their PIN from the
default PIN, it no longer tells the user that PINs shorter than 6 characters default PIN, it no longer tells the user that PINs shorter than 6 characters
are allowed, and instead loops until the user enters a PIN of valid length. are allowed, and instead loops until the user enters a PIN of valid length.
- More kinds of SmartCard readers are ignored when they have no SmartCard
inserted.
## [0.3.2] - 2023-01-01 ## [0.3.2] - 2023-01-01
### Changed ### Changed
+1 -1
View File
@@ -41,7 +41,7 @@ pub(crate) fn is_connected(reader: Reader) -> bool {
pub(crate) fn filter_connected(reader: &Reader) -> bool { pub(crate) fn filter_connected(reader: &Reader) -> bool {
match reader.open() { match reader.open() {
Err(yubikey::Error::PcscError { Err(yubikey::Error::PcscError {
inner: Some(pcsc::Error::RemovedCard), inner: Some(pcsc::Error::NoSmartcard | pcsc::Error::RemovedCard),
}) => { }) => {
warn!( warn!(
"{}", "{}",