diff options
author | NIIBE Yutaka <[email protected]> | 2017-01-18 06:48:50 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2017-01-18 07:03:47 +0000 |
commit | 79cea89774e6327b6785e22b7057f9e3e188ac2b (patch) | |
tree | 6ac0f0a6e4df8a0d4995617c5a0fc9f659cbd3f4 /scd/command.c | |
parent | scd: Add "card_list" sub command for GETINFO. (diff) | |
download | gnupg-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/command.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/scd/command.c b/scd/command.c index cad8c6e39..8c7ca20a6 100644 --- a/scd/command.c +++ b/scd/command.c @@ -264,7 +264,6 @@ cmd_serialno (assuan_context_t ctx, char *line) struct server_local_s *sl; int rc = 0; char *serial; - time_t stamp; const char *demand; if ( IS_LOCKED (ctrl) ) @@ -302,12 +301,11 @@ cmd_serialno (assuan_context_t ctx, char *line) c->server_local->card_removed = 0; } - rc = app_get_serial_and_stamp (ctrl->app_ctx, &serial, &stamp); - if (rc) - return rc; + serial = app_get_serialno (ctrl->app_ctx); + if (!serial) + return gpg_error (GPG_ERR_INV_VALUE); - rc = print_assuan_status (ctx, "SERIALNO", "%s %lu", - serial, (unsigned long)stamp); + rc = assuan_write_status (ctx, "SERIALNO", serial); xfree (serial); return rc; } @@ -320,7 +318,7 @@ static const char hlp_learn[] = "used without the force options, the command might do an INQUIRE\n" "like this:\n" "\n" - " INQUIRE KNOWNCARDP <hexstring_with_serialNumber> <timestamp>\n" + " INQUIRE KNOWNCARDP <hexstring_with_serialNumber>\n" "\n" "The client should just send an \"END\" if the processing should go on\n" "or a \"CANCEL\" to force the function to terminate with a Cancel\n" @@ -400,7 +398,6 @@ cmd_learn (assuan_context_t ctx, char *line) { const char *reader; char *serial; - time_t stamp; app_t app = ctrl->app_ctx; if (!app) @@ -412,12 +409,11 @@ cmd_learn (assuan_context_t ctx, char *line) send_status_direct (ctrl, "READER", reader); /* No need to free the string of READER. */ - rc = app_get_serial_and_stamp (ctrl->app_ctx, &serial, &stamp); - if (rc) - return rc; + serial = app_get_serialno (ctrl->app_ctx); + if (!serial) + return gpg_error (GPG_ERR_INV_VALUE); - rc = print_assuan_status (ctx, "SERIALNO", "%s %lu", - serial, (unsigned long)stamp); + rc = assuan_write_status (ctx, "SERIALNO", serial); if (rc < 0) { xfree (serial); @@ -428,8 +424,7 @@ cmd_learn (assuan_context_t ctx, char *line) { char *command; - rc = gpgrt_asprintf (&command, "KNOWNCARDP %s %lu", - serial, (unsigned long)stamp); + rc = gpgrt_asprintf (&command, "KNOWNCARDP %s", serial); if (rc < 0) { xfree (serial); |