From 55bfa5dafbcc43d284d7f0df7d820cfef0f4e05a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 29 Jan 2023 14:11:24 +0000 Subject: [PATCH] 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. --- src/key.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/key.rs b/src/key.rs index 4e41149..573cfb3 100644 --- a/src/key.rs +++ b/src/key.rs @@ -186,6 +186,9 @@ fn open_by_serial(serial: Serial) -> Result { if serial == yubikey.serial() { return Ok(yubikey); + } else { + // We didn't want this YubiKey; don't reset it. + disconnect_without_reset(yubikey); } }