Ticket #21 (closed defect: fixed)
NB! Read about ReportingBugs before filing a ticket!
something strange in dir.c (opensc lib)
| Reported by: | richard.musil@… | Owned by: | devel |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | opensc | Version: | devel |
| Severity: | normal | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: |
Description
When creating EF.DIR (running "pkcs15-init -C") I got stuck in update_single_record function in dir.c file. When EF.DIR is just created (simple-tlv and empty) and app->rec_nr == 0 this simply did not work (calling UPDATE RECORD with P1=0 and P2=0). My card returned 0x6a83, I do not know whether this is my card fault (and did not find clarification in ISO either). My current workaround is like this:
Index: dir.c =================================================================== --- dir.c (revision 2368) +++ dir.c (working copy) @@ -344,7 +344,10 @@ r = encode_dir_record(card->ctx, app, &rec, &rec_size); if (r) return r; - r = sc_update_record(card, (unsigned int)app->rec_nr, rec, rec_size, 0); + if (app->rec_nr != 0) + r = sc_update_record(card, (unsigned int)app->rec_nr, rec, rec_size, SC_RECORD_BY_REC_NR); + else + r = sc_append_record(card, rec, rec_size, 0); free(rec); SC_TEST_RET(card->ctx, r, "Unable to update EF(DIR) record"); return 0;
Can anyone verify this is not just my card at fault?
Change History
Note: See
TracTickets for help on using
tickets.

I've committed the patch suggested on opensc-devel. case resolved.