1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* command.c (cmd_genkey, cmd_passwd): Fixed faulty use of

!spacep().

* apdu.c (apdu_open_reader): Hacks for PC/SC under Windows.
This commit is contained in:
Werner Koch 2003-10-25 14:22:42 +00:00
parent f936866734
commit 5ee820978d
4 changed files with 45 additions and 7 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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);

View File

@ -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;