yubico-piv-tool icon indicating copy to clipboard operation
yubico-piv-tool copied to clipboard

Imporve ykpiv_connect failure user message

Open alonbl opened this issue 2 years ago • 2 comments

Provide a hint for user that PC/SC service may be down, as user should take a specific action to resolve the issue.

Signed-off-by: Alon Bar-Lev [email protected]

alonbl avatar May 28 '22 18:05 alonbl

Thank you for the pull request!

We need to check how this works on different OS:es, I suspect the error code might differ.. As a first step, what have you tried this on ? Thx again.

qpernil avatar Jun 09 '22 14:06 qpernil

Hi, Tested on linux with pcsc-lite. In windows scard service always available but it also well documented https://docs.microsoft.com/en-us/windows/win32/com/com-error-codes-4 I can add SCARD_E_SERVICE_STOPPED to the same condition.

alonbl avatar Jun 09 '22 14:06 alonbl

Hello @qpernil, Can you please have another look? All pcsc implementations have SCARD_E_NO_SERVICE and also in the remotely chance that it is not available the previous functionality will be provided and return value will be YKPIV_PCSC_ERROR as of now. Thanks,

alonbl avatar Oct 18 '22 19:10 alonbl

I have created https://github.com/Yubico/yubico-piv-tool/pull/407 that maps PCSC errors everywhere, and includes your proposed new error code, which is printed as well now. I skipped your changes to the pkcs11 module as they were only debug output which is generated anyway. Let me know if this would solve your issue.

qpernil avatar Oct 21 '22 15:10 qpernil

Thanks! It seems ok. However, the missing bit is to understand what happens, you already have errors (not debug) for regular user to hint what's wrong, the error should be improved, I will note it in the other patch.

Superseded-By: #407

alonbl avatar Oct 21 '22 15:10 alonbl