1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-08 12:44:23 +01:00

* g10.c, options.h: New option --limit-card-insert-tries.

* cardglue.c (open_card): Use it.
This commit is contained in:
Werner Koch 2005-07-19 12:14:39 +00:00
parent 730247b19e
commit a0b4f40301
4 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2005-07-19 Werner Koch <wk@g10code.com>
* g10.c, options.h: New option --limit-card-insert-tries.
* cardglue.c (open_card): Use it.
* export.c (parse_export_options): New option
export-reset-subkey-passwd.
(do_export_stream): Implement it.

View File

@ -385,6 +385,7 @@ open_card (void)
int rc;
app_t app;
int did_shutdown = 0;
int retry_count = 0;
/* First check whether we can contact a gpg-agent and divert all
operation to it. This is required because gpg as well as the
@ -421,7 +422,10 @@ open_card (void)
app = xcalloc (1, sizeof *app);
app->slot = slot;
rc = app_select_openpgp (app);
if (rc && !opt.batch)
if (opt.limit_card_insert_tries
&& ++retry_count >= opt.limit_card_insert_tries)
;
else if (rc && !opt.batch)
{
write_status_text (STATUS_CARDCTRL, "1");

View File

@ -347,6 +347,7 @@ enum cmd_and_opt_values
oMultifile,
oKeyidFormat,
oNoInteractiveSelection,
oLimitCardInsertTries,
oReaderPort,
octapiDriver,
@ -677,6 +678,7 @@ static ARGPARSE_OPTS opts[] = {
{ oMultifile, "multifile", 0, "@" },
{ oKeyidFormat, "keyid-format", 2, "@" },
{ oNoInteractiveSelection, "no-interactive-selection", 0, "@" },
{ oLimitCardInsertTries, "limit-card-insert-tries", 1, "@"},
{ oReaderPort, "reader-port", 2, "@"},
{ octapiDriver, "ctapi-driver", 2, "@"},
@ -1583,7 +1585,7 @@ parse_trust_model(const char *model)
}
int
main( int argc, char **argv )
main (int argc, char **argv )
{
ARGPARSE_ARGS pargs;
IOBUF a;
@ -2546,6 +2548,11 @@ main( int argc, char **argv )
case oNoInteractiveSelection:
opt.no_interactive_selection = 1;
break;
case oLimitCardInsertTries:
opt.limit_card_insert_tries = pargs.r.ret_int;
break;
case oNoop: break;

View File

@ -195,6 +195,8 @@ struct
byte *show_subpackets;
int rfc2440_text;
int limit_card_insert_tries; /* If > 0, limit the number of card
insertion prompts to this value. */
#ifdef ENABLE_CARD_SUPPORT
const char *ctapi_driver; /* Library to access the ctAPI. */
const char *pcsc_driver; /* Library to access the PC/SC system. */