gnupg/g10 (ChangeLog cardglue.c g10.c options.h)

cvs user wk cvs at cvs.gnupg.org
Tue Jul 19 13:48:48 CEST 2005


    Date: Tuesday, July 19, 2005 @ 14:14:39
  Author: wk
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog cardglue.c g10.c options.h

* g10.c, options.h: New option --limit-card-insert-tries.
* cardglue.c (open_card): Use it.


------------+
 ChangeLog  |    3 +++
 cardglue.c |    6 +++++-
 g10.c      |    9 ++++++++-
 options.h  |    2 ++
 4 files changed, 18 insertions(+), 2 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.764 gnupg/g10/ChangeLog:1.765
--- gnupg/g10/ChangeLog:1.764	Tue Jul 19 10:50:28 2005
+++ gnupg/g10/ChangeLog	Tue Jul 19 14:14:39 2005
@@ -1,5 +1,8 @@
 2005-07-19  Werner Koch  <wk at 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.
Index: gnupg/g10/cardglue.c
diff -u gnupg/g10/cardglue.c:1.34 gnupg/g10/cardglue.c:1.35
--- gnupg/g10/cardglue.c:1.34	Sat Jun 18 13:49:50 2005
+++ gnupg/g10/cardglue.c	Tue Jul 19 14:14:39 2005
@@ -385,6 +385,7 @@
   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 @@
   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");
       
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.311 gnupg/g10/g10.c:1.312
--- gnupg/g10/g10.c:1.311	Mon Jun 20 19:03:27 2005
+++ gnupg/g10/g10.c	Tue Jul 19 14:14:39 2005
@@ -347,6 +347,7 @@
     oMultifile,
     oKeyidFormat,
     oNoInteractiveSelection,
+    oLimitCardInsertTries,
 
     oReaderPort,
     octapiDriver,
@@ -677,6 +678,7 @@
     { 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 @@
 }
 
 int
-main( int argc, char **argv )
+main (int argc, char **argv )
 {
     ARGPARSE_ARGS pargs;
     IOBUF a;
@@ -2546,6 +2548,11 @@
           case oNoInteractiveSelection:
             opt.no_interactive_selection = 1;
             break;
+
+	  case oLimitCardInsertTries: 
+            opt.limit_card_insert_tries = pargs.r.ret_int; 
+            break;
+
   
 	  case oNoop: break;
 
Index: gnupg/g10/options.h
diff -u gnupg/g10/options.h:1.146 gnupg/g10/options.h:1.147
--- gnupg/g10/options.h:1.146	Tue Jul 19 10:50:28 2005
+++ gnupg/g10/options.h	Tue Jul 19 14:14:39 2005
@@ -195,6 +195,8 @@
   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. */




More information about the Gnupg-commits mailing list