diff options
author | Werner Koch <wk@gnupg.org> | 2003-10-25 16:22:42 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2003-10-25 16:22:42 +0200 |
commit | 5ee820978d09fea7aa660201f395434a16950dbb (patch) | |
tree | 953c23c3d8810a57ccc85108638b678c806a92d4 /scd | |
parent | (learn_status_cb, scd_genkey_cb): Fixed faulty use (diff) | |
download | gnupg2-5ee820978d09fea7aa660201f395434a16950dbb.tar.xz gnupg2-5ee820978d09fea7aa660201f395434a16950dbb.zip |
* command.c (cmd_genkey, cmd_passwd): Fixed faulty use of
!spacep().
* apdu.c (apdu_open_reader): Hacks for PC/SC under Windows.
Diffstat (limited to 'scd')
-rw-r--r-- | scd/ChangeLog | 7 | ||||
-rw-r--r-- | scd/apdu.c | 33 | ||||
-rw-r--r-- | scd/ccid-driver.c | 4 | ||||
-rw-r--r-- | scd/command.c | 8 |
4 files changed, 45 insertions, 7 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog index 40a928895..0b683d506 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,10 @@ +2003-10-25 Werner Koch <wk@gnupg.org> + + * command.c (cmd_genkey, cmd_passwd): Fixed faulty use of + !spacep(). + + * apdu.c (apdu_open_reader): Hacks for PC/SC under Windows. + 2003-10-20 Werner Koch <wk@gnupg.org> * command.c (cmd_checkpin): New. diff --git a/scd/apdu.c b/scd/apdu.c index 2b17ef53b..9f5d36e09 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -298,6 +298,8 @@ ct_activate_card (int reader) { log_error ("ct_activate_card(%d): activation failed: %s\n", reader, ct_error_string (rc)); + if (!rc) + log_printhex (" received data:", buf, buflen); return -1; } @@ -933,7 +935,7 @@ apdu_open_reader (const char *portstr) CT_close = dlsym (handle, "CT_close"); if (!CT_init || !CT_data || !CT_close) { - log_error ("apdu_open_reader: invalid ctAPI driver\n"); + log_error ("apdu_open_reader: invalid CT-API driver\n"); dlclose (handle); return -1; } @@ -959,9 +961,21 @@ apdu_open_reader (const char *portstr) pcsc_establish_context = dlsym (handle, "SCardEstablishContext"); pcsc_release_context = dlsym (handle, "SCardReleaseContext"); pcsc_list_readers = dlsym (handle, "SCardListReaders"); +#ifdef _WIN32 + if (!pcsc_list_readers) + pcsc_list_readers = dlsym (handle, "SCardListReadersA"); +#endif pcsc_connect = dlsym (handle, "SCardConnect"); +#ifdef _WIN32 + if (!pcsc_connect) + pcsc_connect = dlsym (handle, "SCardConnectA"); +#endif pcsc_disconnect = dlsym (handle, "SCardDisconnect"); pcsc_status = dlsym (handle, "SCardStatus"); +#ifdef _WIN32 + if (pcsc_status) + pcsc_status = dlsym (handle, "SCardStatusA"); +#endif pcsc_begin_transaction = dlsym (handle, "SCardBeginTransaction"); pcsc_end_transaction = dlsym (handle, "SCardEndTransaction"); pcsc_transmit = dlsym (handle, "SCardTransmit"); @@ -976,9 +990,22 @@ apdu_open_reader (const char *portstr) || !pcsc_begin_transaction || !pcsc_end_transaction || !pcsc_transmit - || !pcsc_set_timeout) + /* || !pcsc_set_timeout */) { - log_error ("apdu_open_reader: invalid PC/SC driver\n"); + /* Note that set_timeout is currently not used and also not + available under Windows. */ + log_error ("apdu_open_reader: invalid PC/SC driver " + "(%d%d%d%d%d%d%d%d%d%d)\n", + !!pcsc_establish_context, + !!pcsc_release_context, + !!pcsc_list_readers, + !!pcsc_connect, + !!pcsc_disconnect, + !!pcsc_status, + !!pcsc_begin_transaction, + !!pcsc_end_transaction, + !!pcsc_transmit, + !!pcsc_set_timeout ); dlclose (handle); return -1; } diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index f14600cc2..8868a2cfc 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -880,6 +880,10 @@ ccid_transceive (ccid_driver_t handle, if (rc) return rc; + /* Fixme: The next line for the current Valgrid without support + for USB IOCTLs. */ + memset (recv_buffer, 0, sizeof recv_buffer); + msg = recv_buffer; rc = bulk_in (handle, msg, sizeof recv_buffer, &msglen, RDR_to_PC_DataBlock, seqno); diff --git a/scd/command.c b/scd/command.c index 8808b10e9..363b46480 100644 --- a/scd/command.c +++ b/scd/command.c @@ -813,7 +813,7 @@ cmd_genkey (ASSUAN_CONTEXT ctx, char *line) /* Skip over options. */ while ( *line == '-' && line[1] == '-' ) { - while (!spacep (line)) + while (*line && !spacep (line)) line++; while (spacep (line)) line++; @@ -821,7 +821,7 @@ cmd_genkey (ASSUAN_CONTEXT ctx, char *line) if (!*line) return set_error (Parameter_Error, "no key number given"); keyno = line; - while (!spacep (line)) + while (*line && !spacep (line)) line++; *line = 0; @@ -894,7 +894,7 @@ cmd_passwd (ASSUAN_CONTEXT ctx, char *line) /* Skip over options. */ while (*line == '-' && line[1] == '-') { - while (!spacep (line)) + while (*line && !spacep (line)) line++; while (spacep (line)) line++; @@ -902,7 +902,7 @@ cmd_passwd (ASSUAN_CONTEXT ctx, char *line) if (!*line) return set_error (Parameter_Error, "no CHV number given"); chvnostr = line; - while (!spacep (line)) + while (*line && !spacep (line)) line++; *line = 0; |