diff --git a/scd/command.c b/scd/command.c index 7838cff11..9d8737572 100644 --- a/scd/command.c +++ b/scd/command.c @@ -1874,11 +1874,13 @@ static const char hlp_getinfo[] = " - Return a list of active apps on all inserted cards.\n" " cmd_has_option CMD OPT\n" " - Returns OK if command CMD has option OPT.\n" + " dump_state - Dump internal infos to the log stream.\n" " apdu_strerror NUMBER\n" " - Return a string for a status word.\n"; static gpg_error_t cmd_getinfo (assuan_context_t ctx, char *line) { + ctrl_t ctrl = assuan_get_pointer (ctx); int rc = 0; const char *s; @@ -1898,6 +1900,7 @@ cmd_getinfo (assuan_context_t ctx, char *line) && (line[14] == ' ' || line[14] == '\t' || !line[14])) { char *cmd, *cmdopt; + line += 14; while (*line == ' ' || *line == '\t') line++; @@ -1943,7 +1946,6 @@ cmd_getinfo (assuan_context_t ctx, char *line) } else if (!strcmp (line, "status")) { - ctrl_t ctrl = assuan_get_pointer (ctx); char flag; if (open_card (ctrl)) @@ -1980,13 +1982,11 @@ cmd_getinfo (assuan_context_t ctx, char *line) } else if (!strcmp (line, "card_list")) { - ctrl_t ctrl = assuan_get_pointer (ctx); rc = app_send_card_list (ctrl); } else if (!strcmp (line, "active_apps")) { - ctrl_t ctrl = assuan_get_pointer (ctx); card_t card = card_get (ctrl, NULL); if (!card) @@ -1999,7 +1999,6 @@ cmd_getinfo (assuan_context_t ctx, char *line) } else if (!strcmp (line, "all_active_apps")) { - ctrl_t ctrl = assuan_get_pointer (ctx); rc = app_send_active_apps (NULL, ctrl); } else if ((s=has_leading_keyword (line, "apdu_strerror"))) @@ -2008,6 +2007,10 @@ cmd_getinfo (assuan_context_t ctx, char *line) s = apdu_strerror (ul); rc = assuan_send_data (ctx, s, strlen (s)); } + else if (!strcmp (line, "dump_state")) + { + app_dump_state (); + } else rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); return rc;