aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2017-01-18 06:48:50 +0000
committerNIIBE Yutaka <[email protected]>2017-01-18 07:03:47 +0000
commit79cea89774e6327b6785e22b7057f9e3e188ac2b (patch)
tree6ac0f0a6e4df8a0d4995617c5a0fc9f659cbd3f4 /scd/app-openpgp.c
parentscd: Add "card_list" sub command for GETINFO. (diff)
downloadgnupg-79cea89774e6327b6785e22b7057f9e3e188ac2b.tar.gz
gnupg-79cea89774e6327b6785e22b7057f9e3e188ac2b.zip
scd: Cleanup SERIALNO protocol.
* scd/app.c (app_get_serial_and_stamp): Remove. (app_get_serialno): New. (app_write_learn_status): Use send_status_direct. (app_getattr): Use app_get_serialno for SERIALNO and send with send_status_direct. * scd/app-openpgp.c (do_getattr): Likewise. * scd/command.c (cmd_serialno): Don't send TIMESTAMP of 0. (cmd_learn): Likewise. Don't inquire with TIMESTAMP of 0. -- In the SERIALNO protocol, timestamp used to be considered, but had never used at all. In the new implementation, removed card/token is always detected and connection becomes invalid, no timestamp is required any more. Examined scute and poldi as well for this protocol change. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to '')
-rw-r--r--scd/app-openpgp.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 4d8b1bc9e..71c9e1b83 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -978,21 +978,13 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
if (table[idx].special == -1)
{
/* The serial number is very special. We could have used the
- AID DO to retrieve it, but we have it already in the app
- context and the stamp argument is required anyway which we
- can't by other means. The AID DO is available anyway but not
- hex formatted. */
- char *serial;
- time_t stamp;
- char tmp[50];
-
- if (!app_get_serial_and_stamp (app, &serial, &stamp))
+ AID DO to retrieve it. The AID DO is available anyway but
+ not hex formatted. */
+ char *serial = app_get_serialno (app);
+
+ if (serial)
{
- sprintf (tmp, "%lu", (unsigned long)stamp);
- send_status_info (ctrl, "SERIALNO",
- serial, strlen (serial),
- tmp, strlen (tmp),
- NULL, 0);
+ send_status_direct (ctrl, "SERIALNO", serial);
xfree (serial);
}
return 0;
@@ -1029,10 +1021,9 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
}
if (table[idx].special == -4)
{
- char *serial;
- time_t stamp;
+ char *serial = app_get_serialno (app);
- if (!app_get_serial_and_stamp (app, &serial, &stamp))
+ if (serial)
{
if (strlen (serial) > 16+12)
{