[Gpa-commits] r998 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 20 17:08:55 CEST 2009


Author: werner
Date: 2009-05-20 17:08:54 +0200 (Wed, 20 May 2009)
New Revision: 998

Modified:
   trunk/src/ChangeLog
   trunk/src/cm-openpgp.c
Log:
Fix Reset Code handling.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-05-20 07:41:03 UTC (rev 997)
+++ trunk/src/ChangeLog	2009-05-20 15:08:54 UTC (rev 998)
@@ -1,3 +1,7 @@
+2009-05-20  Werner Koch  <wk at g10code.com>
+
+	* cm-openpgp.c (change_pin): Fix use of the Reset Code.
+
 2009-05-19  Werner Koch  <wk at g10code.com>
 
 	* cm-openpgp.c (update_entry_chv_status): Reverse force_pw1 setting.

Modified: trunk/src/cm-openpgp.c
===================================================================
--- trunk/src/cm-openpgp.c	2009-05-20 07:41:03 UTC (rev 997)
+++ trunk/src/cm-openpgp.c	2009-05-20 15:08:54 UTC (rev 998)
@@ -1040,7 +1040,8 @@
   gpg_error_t err;
   GtkWidget *dialog;
   gpgme_ctx_t gpgagent;
-  int reset_mode;
+  int reset_mode = 0;
+  int unblock_pin = 0;
   const char *string;
   int okay;
 
@@ -1054,12 +1055,31 @@
 
   if (pinno == 0 && !card->is_v2)
     reset_mode = (!card->retry_counter[0] || !card->retry_counter[1]);
-  else
-    reset_mode = !card->retry_counter[pinno];
+  else if (pinno == 0 && !card->retry_counter[0] && card->retry_counter[1])
+    {
+      unblock_pin = 1;
+      pinno = 1;
+    }
+  else if (!card->retry_counter[pinno])
+    reset_mode = 1;
 
-  g_debug ("%s pin for PIN %d", reset_mode? "reset":"change", pinno);
+/*   g_debug ("%s pin for PIN %d", reset_mode? "reset":"change", pinno); */
 
-  if (!reset_mode && pinno == 0)
+  if (unblock_pin)
+    string = _("<b>Unblocking the PIN</b>\n"
+               "\n"
+               "The retry counter of the PIN is down to zero "
+               "but a Reset Code has been set.\n"
+               "\n"
+               "The Reset Code is similar to a PUK (PIN Unblocking Code)"
+               "and used to unblock a PIN without the need to know the "
+               "Admin-PIN.\n"
+               "\n"
+               "If you proceed you will be asked to enter the current "
+               "value of the <b>Reset Code</b> and then to enter a new "
+               "value for the PIN and repeat that new value at another "
+               "prompt.");
+  else if (!reset_mode && pinno == 0)
     string = _("<b>Changing the PIN</b>\n"
                "\n"
                "If you proceed you will be asked to enter "



More information about the Gpa-commits mailing list