mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
agent,g10: Remove redundant SERIALNO request.
* agent/learncard.c (agent_handle_learn): Don't call agent_card_serialno. Get the serialno in status response. * g10/call-agent.c (agent_scd_learn): Don't request "SCD SERIALNO". (agent_scd_serialno): New. (card_cardlist_cb, agent_scd_cardlist): New. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
a98459d3f4
commit
8c8ce8711d
3 changed files with 109 additions and 22 deletions
|
@ -302,11 +302,10 @@ int
|
|||
agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context, int force)
|
||||
{
|
||||
int rc;
|
||||
|
||||
struct kpinfo_cb_parm_s parm;
|
||||
struct certinfo_cb_parm_s cparm;
|
||||
struct sinfo_cb_parm_s sparm;
|
||||
char *serialno = NULL;
|
||||
const char *serialno = NULL;
|
||||
KEYPAIR_INFO item;
|
||||
SINFO sitem;
|
||||
unsigned char grip[20];
|
||||
|
@ -329,11 +328,6 @@ agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context, int force)
|
|||
parm.ctrl = ctrl;
|
||||
cparm.ctrl = ctrl;
|
||||
|
||||
/* Check whether a card is present and get the serial number */
|
||||
rc = agent_card_serialno (ctrl, &serialno, NULL);
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
/* Now gather all the available info. */
|
||||
rc = agent_card_learn (ctrl, kpinfo_cb, &parm, certinfo_cb, &cparm,
|
||||
sinfo_cb, &sparm);
|
||||
|
@ -345,17 +339,25 @@ agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context, int force)
|
|||
goto leave;
|
||||
}
|
||||
|
||||
log_info ("card has S/N: %s\n", serialno);
|
||||
|
||||
/* Pass on all the collected status information. */
|
||||
if (assuan_context)
|
||||
{
|
||||
for (sitem = sparm.info; sitem; sitem = sitem->next)
|
||||
{
|
||||
if (!strcmp (sitem->keyword, "SERIALNO"))
|
||||
serialno = sitem->data;
|
||||
assuan_write_status (assuan_context, sitem->keyword, sitem->data);
|
||||
}
|
||||
}
|
||||
|
||||
if (!serialno)
|
||||
{
|
||||
rc = GPG_ERR_NOT_FOUND;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
log_info ("card has S/N: %s\n", serialno);
|
||||
|
||||
/* Write out the certificates in a standard order. */
|
||||
for (i=0; certtype_list[i] != -1; i++)
|
||||
{
|
||||
|
@ -438,7 +440,6 @@ agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context, int force)
|
|||
|
||||
|
||||
leave:
|
||||
xfree (serialno);
|
||||
release_keypair_info (parm.info);
|
||||
release_certinfo (cparm.info);
|
||||
release_sinfo (sparm.info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue