• Jason Andryuk's avatar
    vreader: Handle read failure · 652b01db
    Jason Andryuk authored
    If a command fails, card_status will not match VCARD_DONE.  That will
    trigger the assert and abort the process.  Instead, handle VCARD_FAIL and
    return an error in that case.  Client software can then deal with the
    error, and we continue running to handle future commands.
    This can be triggered by removing the physical smartcard mid-operation.
    The setup is qemu <-> vscclient <-> pcscd with passthru:
    vscclient -e 'use_hw=yes hw_type=passthru'
    In a Windows VM, I ran `certutil -scinfo` from a cmd window.  While it
    was running, I pulled out my smart card.  Without this patch, vscclient
    terminates.  With it, vscclient continues running.
    The call stack is:
    apdu_cb can return VCARD_FAIL for send_receive or
    vcard_response_new_data failure.
    Signed-off-by: 's avatarJason Andryuk <jandryuk@gmail.com>
    Acked-by: 's avatarJakub Jelen <jjelen@redhat.com>