diff options
author | Werner Koch <[email protected]> | 2025-03-17 16:37:08 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2025-03-17 16:37:08 +0000 |
commit | f463586a9617392f68305a1059045ece1243475b (patch) | |
tree | b53d5936f09ebddd1b769149424b3b7e1b19bdc7 /agent/command.c | |
parent | gpgconf: Fix reload and kill of keyboxd. (diff) | |
download | gnupg-f463586a9617392f68305a1059045ece1243475b.tar.gz gnupg-f463586a9617392f68305a1059045ece1243475b.zip |
gpgsm: Extend --learn-card by an optional s/n argument.
* agent/command.c (cmd_learn): Allow for s/n argument.
* agent/learncard.c (agent_handle_learn): Ditto.
* agent/call-scd.c (agent_card_learn): Ditto. Pass it on to scd.
* scd/command.c (cmd_switchcard): Factor most code out to ...
(switchcard_core): new.
(cmd_learn): Add option --demand to specify a s/n.
* sm/gpgsm.c (main): Allow a s/n argument for --learn-card.
--
This help Kleopatra to get a stable certificate listing.
GnuPG-bug-id: 7379
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/agent/command.c b/agent/command.c index b61ab9354..ff018dde7 100644 --- a/agent/command.c +++ b/agent/command.c @@ -2376,27 +2376,31 @@ cmd_get_confirmation (assuan_context_t ctx, char *line) static const char hlp_learn[] = - "LEARN [--send] [--sendinfo] [--force]\n" + "LEARN [--send] [--sendinfo] [--force] [SERIALNO]\n" "\n" "Learn something about the currently inserted smartcard. With\n" "--sendinfo information about the card is returned; with --send\n" "the available certificates are returned as D lines; with --force\n" - "private key storage will be updated by the result."; + "private key storage will be updated by the result. With SERIALNO\n" + "given the current card is first switched to the specified one."; static gpg_error_t cmd_learn (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); gpg_error_t err; int send, sendinfo, force; + const char *demand_sn; send = has_option (line, "--send"); sendinfo = send? 1 : has_option (line, "--sendinfo"); force = has_option (line, "--force"); + line = skip_options (line); + demand_sn = *line? line : NULL; if (ctrl->restricted) return leave_cmd (ctx, gpg_error (GPG_ERR_FORBIDDEN)); - err = agent_handle_learn (ctrl, send, sendinfo? ctx : NULL, force); + err = agent_handle_learn (ctrl, send, sendinfo? ctx : NULL, force, demand_sn); return leave_cmd (ctx, err); } |