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:
frankmorgner
2011-09-02 13:48:17 +00:00
parent a0cc017ae6
commit 59b8a9b0da
3 changed files with 16 additions and 3 deletions

View File

@@ -316,6 +316,7 @@ main(int argc, char *argv[])
memcpy(sendbuf+6, pin, pinlen); /* PIN */
sendbuf[6+pinlen] = 0x00; /* length certificate description */
sendbuf[7+pinlen] = 0x00; /* length certificate description */
t_start = time(NULL);
r = SCardControl(hCard, pace_ctl,
sendbuf, 8+pinlen,
@@ -330,7 +331,8 @@ main(int argc, char *argv[])
r = parse_EstablishPACEChannel_OutputData(recvbuf, recvlen);
if (r != SCARD_S_SUCCESS) {
printb("EstablishPACEChannel", recvbuf, recvlen);
printb("EstablishPACEChannel InBuffer\n", sendbuf, 8+pinlen);
printb("EstablishPACEChannel OutBuffer\n", recvbuf, recvlen);
goto err;
}

View File

@@ -111,11 +111,17 @@ detect_card_presence(void)
if (sc_result == 0
&& 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");
}
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");
}
if (sc_result & SC_READER_CARD_PRESENT
@@ -852,6 +858,9 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
goto err;
}
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "EstablishPACEChannel InBuffer",
abData, abDatalen);
if (abDatalen < parsed+1) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Buffer too small, could not get PinID");
sc_result = SC_ERROR_INVALID_ARGUMENTS;

View File

@@ -1524,6 +1524,8 @@ special:
if (verbose > 1)
fprintf(stderr, "control loop: writing %d bytes... ", result);
result = write (fd, outbuf, result);
/* TODO outbuf should also be freed on error */
free(outbuf);
if (result < 0)
goto stall;
if (verbose > 1)