mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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
This commit is contained in:
parent
5420c4ebde
commit
f463586a96
9 changed files with 99 additions and 39 deletions
|
@ -260,10 +260,14 @@ learn_status_cb (void *opaque, const char *line)
|
|||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Perform the LEARN command and return a list of all private keys
|
||||
stored on the card. */
|
||||
* stored on the card. If DEMAND_SN is given the info is returned for
|
||||
* the card with that S/N instead of the current card. This may then
|
||||
* switch the current card. */
|
||||
int
|
||||
agent_card_learn (ctrl_t ctrl,
|
||||
const char *demand_sn,
|
||||
void (*kpinfo_cb)(void*, const char *),
|
||||
void *kpinfo_cb_arg,
|
||||
void (*certinfo_cb)(void*, const char *),
|
||||
|
@ -273,6 +277,7 @@ agent_card_learn (ctrl_t ctrl,
|
|||
{
|
||||
int rc;
|
||||
struct learn_parm_s parm;
|
||||
char line[ASSUAN_LINELENGTH];
|
||||
|
||||
rc = start_scd (ctrl);
|
||||
if (rc)
|
||||
|
@ -285,7 +290,13 @@ agent_card_learn (ctrl_t ctrl,
|
|||
parm.certinfo_cb_arg = certinfo_cb_arg;
|
||||
parm.sinfo_cb = sinfo_cb;
|
||||
parm.sinfo_cb_arg = sinfo_cb_arg;
|
||||
rc = assuan_transact (daemon_ctx (ctrl), "LEARN --force",
|
||||
|
||||
if (demand_sn && *demand_sn)
|
||||
snprintf (line, sizeof line, "LEARN --demand=%s --force", demand_sn);
|
||||
else
|
||||
snprintf (line, sizeof line, "LEARN --force");
|
||||
|
||||
rc = assuan_transact (daemon_ctx (ctrl), line,
|
||||
NULL, NULL, NULL, NULL,
|
||||
learn_status_cb, &parm);
|
||||
if (rc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue