Skip to content

Commit

Permalink
reinit for retrieving new uid after block 0 write
Browse files Browse the repository at this point in the history
  • Loading branch information
gelotus committed Jun 26, 2020
1 parent 3c55b87 commit 709ef83
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion utils/nfc-mfclassic.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,18 @@ write_card(int write_block_zero)
return false;

}

if (magic2 || magic3) {
if (nfc_initiator_init(pnd) < 0) {
nfc_perror(pnd, "nfc_initiator_init");
nfc_close(pnd);
nfc_exit(context);
exit(EXIT_FAILURE);
};
if (nfc_initiator_select_passive_target(pnd, nmMifare, NULL, 0, &nt) <= 0) {
printf("!\nError: tag was removed\n");
return false;
}
}
// Completely write the card, but skipping block 0
for (uiBlock = 1; uiBlock <= uiBlocks; uiBlock++) {
// Authenticate everytime we reach the first sector of a new block
Expand Down

0 comments on commit 709ef83

Please sign in to comment.