mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Distinguish cancel by user and protocol error.
* scd/apdu.h (SW_HOST_CANCELLED): New. * scd/apdu.c (host_sw_string): Support SW_HOST_CANCELLED. (pcsc_error_to_sw): Return SW_HOST_CANCELLED for PCSC_E_CANCELLED. * scd/iso7816.c (map_sw): Return GPG_ERR_INV_RESPONSE for SW_HOST_ABORTED and GPG_ERR_CANCELED for SW_HOST_CANCELLED. -- Cherry-picked master commit of: 2396055c096884d521c26b76f26263a146207c24 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
6e422b5135
commit
90e5f49b6a
@ -501,6 +501,7 @@ host_sw_string (long err)
|
||||
case SW_HOST_ABORTED: return "aborted";
|
||||
case SW_HOST_NO_PINPAD: return "no pinpad";
|
||||
case SW_HOST_ALREADY_CONNECTED: return "already connected";
|
||||
case SW_HOST_CANCELLED: return "cancelled";
|
||||
default: return "unknown host status error";
|
||||
}
|
||||
}
|
||||
@ -607,7 +608,7 @@ pcsc_error_to_sw (long ec)
|
||||
{
|
||||
case 0: rc = 0; break;
|
||||
|
||||
case PCSC_E_CANCELLED: rc = SW_HOST_ABORTED; break;
|
||||
case PCSC_E_CANCELLED: rc = SW_HOST_CANCELLED; break;
|
||||
case PCSC_E_NO_MEMORY: rc = SW_HOST_OUT_OF_CORE; break;
|
||||
case PCSC_E_TIMEOUT: rc = SW_HOST_CARD_IO_ERROR; break;
|
||||
case PCSC_E_NO_SERVICE:
|
||||
|
@ -71,7 +71,8 @@ enum {
|
||||
SW_HOST_NO_READER = 0x1000c,
|
||||
SW_HOST_ABORTED = 0x1000d,
|
||||
SW_HOST_NO_PINPAD = 0x1000e,
|
||||
SW_HOST_ALREADY_CONNECTED = 0x1000f
|
||||
SW_HOST_ALREADY_CONNECTED = 0x1000f,
|
||||
SW_HOST_CANCELLED = 0x10010
|
||||
};
|
||||
|
||||
struct dev_list;
|
||||
|
@ -94,8 +94,9 @@ map_sw (int sw)
|
||||
case SW_HOST_CARD_IO_ERROR: ec = GPG_ERR_EIO; break;
|
||||
case SW_HOST_GENERAL_ERROR: ec = GPG_ERR_GENERAL; break;
|
||||
case SW_HOST_NO_READER: ec = GPG_ERR_ENODEV; break;
|
||||
case SW_HOST_ABORTED: ec = GPG_ERR_CANCELED; break;
|
||||
case SW_HOST_ABORTED: ec = GPG_ERR_INV_RESPONSE; break;
|
||||
case SW_HOST_NO_PINPAD: ec = GPG_ERR_NOT_SUPPORTED; break;
|
||||
case SW_HOST_CANCELLED: ec = GPG_ERR_CANCELED; break;
|
||||
|
||||
default:
|
||||
if ((sw & 0x010000))
|
||||
|
Loading…
x
Reference in New Issue
Block a user