diff options
author | Werner Koch <[email protected]> | 2021-04-01 08:31:52 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-04-01 08:31:52 +0000 |
commit | ff87f4e578f412332ae59fdab016f0a5304baaf9 (patch) | |
tree | 8bdc825e66936906031dcdc6bd0edf7f981c5d41 /scd/command.c | |
parent | scd:p15: New flag APP_LEARN_FLAG_REREAD. (diff) | |
download | gnupg-ff87f4e578f412332ae59fdab016f0a5304baaf9.tar.gz gnupg-ff87f4e578f412332ae59fdab016f0a5304baaf9.zip |
scd: New flag --reread for LEARN
* scd/command.c (cmd_learn): Add flag --reread.
* scd/app-common.h (struct app_ctx_s): New field need_reset.
* scd/app.c (write_learn_status_core): Set need_reset if we notice an
error after returning from a reread. Change all callers of card
functions to return GPG_ERR_CARD_RESET so that that app is not anymore
used.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r-- | scd/command.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/scd/command.c b/scd/command.c index 2be00bb40..fc1bb0145 100644 --- a/scd/command.c +++ b/scd/command.c @@ -420,7 +420,7 @@ cmd_switchapp (assuan_context_t ctx, char *line) static const char hlp_learn[] = - "LEARN [--force] [--keypairinfo] [--multi]\n" + "LEARN [--force] [--keypairinfo] [--reread] [--multi]\n" "\n" "Learn all useful information of the currently inserted card. When\n" "used without the force options, the command might do an INQUIRE\n" @@ -433,7 +433,8 @@ static const char hlp_learn[] = "error message.\n" "\n" "With the option --keypairinfo only KEYPAIRINFO status lines are\n" - "returned.\n" + "returned. With the option --reread information from the card are\n" + "read again without the need for a reset (sone some cards).\n" "\n" "The response of this command is a list of status lines formatted as\n" "this:\n" @@ -498,6 +499,8 @@ cmd_learn (assuan_context_t ctx, char *line) int rc = 0; int only_keypairinfo = has_option (line, "--keypairinfo"); int opt_multi = has_option (line, "--multi"); + int opt_reread = has_option (line, "--reread"); + unsigned int flags; if ((rc = open_card (ctrl))) return rc; @@ -559,11 +562,16 @@ cmd_learn (assuan_context_t ctx, char *line) /* Let the application print out its collection of useful status information. */ + flags = 0; + if (only_keypairinfo) + flags |= APP_LEARN_FLAG_KEYPAIRINFO; + if (opt_multi) + flags |= APP_LEARN_FLAG_MULTI; + if (opt_reread) + flags |= APP_LEARN_FLAG_REREAD; + if (!rc) - rc = app_write_learn_status - (ctrl->card_ctx, ctrl, - ( (only_keypairinfo? APP_LEARN_FLAG_KEYPAIRINFO : 0) - | (opt_multi? APP_LEARN_FLAG_MULTI : 0)) ); + rc = app_write_learn_status (ctrl->card_ctx, ctrl, flags); return rc; } |