libfido2-util: Perform pre-flight checks as well when a specific device path is given
authorPeter Cai <peter@typeblog.net>
Mon, 14 Nov 2022 02:58:43 +0000 (21:58 -0500)
committerPeter Cai <peter@typeblog.net>
Sat, 10 Dec 2022 20:28:49 +0000 (15:28 -0500)
commit5d2c1ce4e4c9f903b5c064f67a59c2e0b0dbd037
tree664459fd0435d3337bcc38516dd252ed527b7b77
parent53c1ef9ce086356d2ee126135b71ca5ad9e3897d
libfido2-util: Perform pre-flight checks as well when a specific device path is given

This prevents unnecessary user interactions when `fido2-device` is set to
something other than `auto` -- a case overlooked in the original PR #23577
(and later #25268).

We do not move pre-flight checks to `fido2_use_hmac_hash_specific_token`
because the behaviors are different between different cases: when the
device path is NULL, we try to automatically choose the correct device,
in which case pre-flight errors should be "soft" errors, without
spamming the tty with error outputs; but when a specific device path is
given, a pre-flight request that determined the non-existence of the
credential should be treated the same as a failed assertion request.
src/shared/libfido2-util.c