aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-09-04 10:08:07 +0000
committerWerner Koch <[email protected]>2019-09-04 10:08:07 +0000
commit5cf5a04bae03d622a42753735c60dfab3b24ade8 (patch)
tree7c404442c779861db16ee7a41e2180cdd85adb9d /scd/command.c
parentscd: Use a macro for the flag parameter of learn_status. (diff)
downloadgnupg-5cf5a04bae03d622a42753735c60dfab3b24ade8.tar.gz
gnupg-5cf5a04bae03d622a42753735c60dfab3b24ade8.zip
scd: Add option --multi to the LEARN command.
* scd/app-common.h (APP_LEARN_FLAG_MULTI): New. * scd/command.c (cmd_learn): Add option --multi. * scd/app.c (app_write_learn_status): Factor some code out to ... (write_learn_status_core): new. (app_write_learn_status): Implement flag --multi. -- This new option is intended to return information about all active applications of the current card. Thus if a "SERIALNO openpgp" and a "SERIALNO piv" has been done in a session the command "LEARN --force --multi" returns information about both applications. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/scd/command.c b/scd/command.c
index 1baa9670d..b37b29c3f 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -338,7 +338,7 @@ cmd_serialno (assuan_context_t ctx, char *line)
static const char hlp_learn[] =
- "LEARN [--force] [--keypairinfo]\n"
+ "LEARN [--force] [--keypairinfo] [--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"
@@ -366,7 +366,8 @@ static const char hlp_learn[] =
" PIV = PIV card\n"
" NKS = NetKey card\n"
"\n"
- "are implemented. These strings are aliases for the AID\n"
+ "are implemented. These strings are aliases for the AID. With option\n"
+ "--multi information for all switchable apps are returned.\n"
"\n"
" S KEYPAIRINFO <hexstring_with_keygrip> <hexstring_with_id> [<usage>]\n"
"\n"
@@ -413,6 +414,7 @@ cmd_learn (assuan_context_t ctx, char *line)
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc = 0;
int only_keypairinfo = has_option (line, "--keypairinfo");
+ int opt_multi = has_option (line, "--multi");
if ((rc = open_card (ctrl)))
return rc;
@@ -477,7 +479,8 @@ cmd_learn (assuan_context_t ctx, char *line)
if (!rc)
rc = app_write_learn_status
(ctrl->card_ctx, ctrl,
- (only_keypairinfo? APP_LEARN_FLAG_KEYPAIRINFO : 0));
+ ( (only_keypairinfo? APP_LEARN_FLAG_KEYPAIRINFO : 0)
+ | (opt_multi? APP_LEARN_FLAG_MULTI : 0)) );
return rc;
}