fixed bugs due to new version of opensc
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@517 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -316,6 +316,7 @@ main(int argc, char *argv[])
|
|||||||
memcpy(sendbuf+6, pin, pinlen); /* PIN */
|
memcpy(sendbuf+6, pin, pinlen); /* PIN */
|
||||||
sendbuf[6+pinlen] = 0x00; /* length certificate description */
|
sendbuf[6+pinlen] = 0x00; /* length certificate description */
|
||||||
sendbuf[7+pinlen] = 0x00; /* length certificate description */
|
sendbuf[7+pinlen] = 0x00; /* length certificate description */
|
||||||
|
|
||||||
t_start = time(NULL);
|
t_start = time(NULL);
|
||||||
r = SCardControl(hCard, pace_ctl,
|
r = SCardControl(hCard, pace_ctl,
|
||||||
sendbuf, 8+pinlen,
|
sendbuf, 8+pinlen,
|
||||||
@@ -330,7 +331,8 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
r = parse_EstablishPACEChannel_OutputData(recvbuf, recvlen);
|
r = parse_EstablishPACEChannel_OutputData(recvbuf, recvlen);
|
||||||
if (r != SCARD_S_SUCCESS) {
|
if (r != SCARD_S_SUCCESS) {
|
||||||
printb("EstablishPACEChannel", recvbuf, recvlen);
|
printb("EstablishPACEChannel InBuffer\n", sendbuf, 8+pinlen);
|
||||||
|
printb("EstablishPACEChannel OutBuffer\n", recvbuf, recvlen);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,11 +111,17 @@ detect_card_presence(void)
|
|||||||
|
|
||||||
if (sc_result == 0
|
if (sc_result == 0
|
||||||
&& card) {
|
&& card) {
|
||||||
sc_disconnect_card(card);
|
/* FIXME recent OpenSC versions throw an error when disconnecting an
|
||||||
|
* obsolete card handle
|
||||||
|
sc_disconnect_card(card); */
|
||||||
|
card = NULL;
|
||||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Card removed");
|
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Card removed");
|
||||||
}
|
}
|
||||||
if (sc_result & SC_READER_CARD_CHANGED) {
|
if (sc_result & SC_READER_CARD_CHANGED) {
|
||||||
sc_disconnect_card(card);
|
/* FIXME recent OpenSC versions throw an error when disconnecting an
|
||||||
|
* obsolete card handle
|
||||||
|
sc_disconnect_card(card); */
|
||||||
|
card = NULL;
|
||||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Card exchanged");
|
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Card exchanged");
|
||||||
}
|
}
|
||||||
if (sc_result & SC_READER_CARD_PRESENT
|
if (sc_result & SC_READER_CARD_PRESENT
|
||||||
@@ -852,6 +858,9 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "EstablishPACEChannel InBuffer",
|
||||||
|
abData, abDatalen);
|
||||||
|
|
||||||
if (abDatalen < parsed+1) {
|
if (abDatalen < parsed+1) {
|
||||||
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Buffer too small, could not get PinID");
|
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Buffer too small, could not get PinID");
|
||||||
sc_result = SC_ERROR_INVALID_ARGUMENTS;
|
sc_result = SC_ERROR_INVALID_ARGUMENTS;
|
||||||
|
|||||||
@@ -1524,6 +1524,8 @@ special:
|
|||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
fprintf(stderr, "control loop: writing %d bytes... ", result);
|
fprintf(stderr, "control loop: writing %d bytes... ", result);
|
||||||
result = write (fd, outbuf, result);
|
result = write (fd, outbuf, result);
|
||||||
|
/* TODO outbuf should also be freed on error */
|
||||||
|
free(outbuf);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
goto stall;
|
goto stall;
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user