Avoid resetting YubiKeys that don't match the desired serial

If multiple YubiKeys were connected, and the one we needed for plugin
encryption or decryption was not first in the list of readers, any
YubiKeys before it were being reset upon drop. We now explicitly
disconnect without resetting, since we only access these YubiKeys as a
side-effect of finding the one we need.
This commit is contained in:
Jack Grigg
2023-01-29 14:11:24 +00:00
parent 90b61682bd
commit 55bfa5dafb
+3
View File
@@ -186,6 +186,9 @@ fn open_by_serial(serial: Serial) -> Result<YubiKey, yubikey::Error> {
if serial == yubikey.serial() { if serial == yubikey.serial() {
return Ok(yubikey); return Ok(yubikey);
} else {
// We didn't want this YubiKey; don't reset it.
disconnect_without_reset(yubikey);
} }
} }