[svn] GnuPG - r4707 - in trunk: g10 kbx po sm

svn author wk cvs at cvs.gnupg.org
Thu Mar 13 09:46:27 CET 2008


Author: wk
Date: 2008-03-13 09:46:08 +0100 (Thu, 13 Mar 2008)
New Revision: 4707

Modified:
   trunk/g10/ChangeLog
   trunk/g10/passphrase.c
   trunk/kbx/ChangeLog
   trunk/kbx/keybox-blob.c
   trunk/po/be.po
   trunk/po/ca.po
   trunk/po/cs.po
   trunk/po/da.po
   trunk/po/de.po
   trunk/po/el.po
   trunk/po/eo.po
   trunk/po/es.po
   trunk/po/et.po
   trunk/po/fi.po
   trunk/po/fr.po
   trunk/po/gl.po
   trunk/po/hu.po
   trunk/po/id.po
   trunk/po/it.po
   trunk/po/ja.po
   trunk/po/nb.po
   trunk/po/pl.po
   trunk/po/pt.po
   trunk/po/pt_BR.po
   trunk/po/ro.po
   trunk/po/ru.po
   trunk/po/sk.po
   trunk/po/sv.po
   trunk/po/tr.po
   trunk/po/zh_CN.po
   trunk/po/zh_TW.po
   trunk/sm/ChangeLog
   trunk/sm/certdump.c
   trunk/sm/keylist.c
Log:
Fixed an email/DN bug.
Changed pinentry prompts.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/g10/ChangeLog	2008-03-13 08:46:08 UTC (rev 4707)
@@ -1,3 +1,8 @@
+2008-03-13  Werner Koch  <wk at g10code.com>
+
+	* passphrase.c (PROMPTSTRING): Change string to me more similar to
+	the X.509 prompt.
+
 2008-02-26  Werner Koch  <wk at g10code.com>
 
 	* getkey.c (get_pubkey_byname): Fix comment.

Modified: trunk/kbx/ChangeLog
===================================================================
--- trunk/kbx/ChangeLog	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/kbx/ChangeLog	2008-03-13 08:46:08 UTC (rev 4707)
@@ -1,3 +1,9 @@
+2008-03-13  Werner Koch  <wk at g10code.com>
+
+	* keybox-blob.c (x509_email_kludge): Use the same code as in
+	..sm/keylist.c so that email parts are not only detected at the
+	start of the DN.  Reported by Yoshiaki Kasahara.
+
 2007-08-24  Werner Koch  <wk at g10code.com>
 
 	* keybox-init.c (keybox_register_file): Use same_file_p.

Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/sm/ChangeLog	2008-03-13 08:46:08 UTC (rev 4707)
@@ -1,3 +1,10 @@
+2008-03-13  Werner Koch  <wk at g10code.com>
+
+	* certdump.c (gpgsm_fpr_and_name_for_status): Fix signed/unsigned
+	char issue.
+	(gpgsm_format_keydesc): Remove superfluous test.  Add expire date
+	to the prompt.
+
 2008-02-18  Werner Koch  <wk at g10code.com>
 
 	* certchain.c (gpgsm_is_root_cert): Factor code out to ...

Modified: trunk/g10/passphrase.c
===================================================================
--- trunk/g10/passphrase.c	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/g10/passphrase.c	2008-03-13 08:46:08 UTC (rev 4707)
@@ -306,10 +306,11 @@
 
 #undef KEYIDSTRING
 
-#define PROMPTSTRING _("You need a passphrase to unlock the secret" \
-		       " key for user:\n" \
+#define PROMPTSTRING _("Please enter the passphrase to unlock the" \
+		       " secret key for the OpenPGP certificate:\n" \
 		       "\"%.*s\"\n" \
-		       "%u-bit %s key, ID %s, created %s%s\n" )
+		       "%u-bit %s key, ID %s,\n" \
+                       "created %s%s.\n" )
 
       atext = xmalloc ( 100 + strlen (PROMPTSTRING)  
                         + uidlen + 15 + strlen(algo_name) + keystrlen()
@@ -448,7 +449,8 @@
     {
       if (strchr (description, '%'))
         {
-          char *tmp = unescape_percent_string (description);
+          char *tmp = unescape_percent_string
+            ((const unsigned char*)description);
           tty_printf ("\n%s\n", tmp);
           xfree (tmp);
         }

Modified: trunk/kbx/keybox-blob.c
===================================================================
--- trunk/kbx/keybox-blob.c	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/kbx/keybox-blob.c	2008-03-13 08:46:08 UTC (rev 4707)
@@ -1,5 +1,5 @@
 /* keybox-blob.c - KBX Blob handling
- *	Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -778,34 +778,46 @@
 
 #ifdef KEYBOX_WITH_X509
 
-/* return an allocated string with the email address extracted from a
-   DN */
+/* Return an allocated string with the email address extracted from a
+   DN.  Note hat we use this code also in ../sm/keylist.c.  */
 static char *
 x509_email_kludge (const char *name)
 {
-  const char *p;
+  const char *p, *string;
   unsigned char *buf;
   int n;
 
-  if (strncmp (name, "1.2.840.113549.1.9.1=#", 22))
-    return NULL;
+  string = name;
+  for (;;)
+    {
+      p = strstr (string, "1.2.840.113549.1.9.1=#");
+      if (!p)
+        return NULL;
+      if (p == name || (p > string+1 && p[-1] == ',' && p[-2] != '\\'))
+        {
+          name = p + 22;
+          break;
+        }
+      string = p + 22;
+    }
+
+
   /* This looks pretty much like an email address in the subject's DN
      we use this to add an additional user ID entry.  This way,
-     openSSL generated keys get a nicer and usable listing */
-  name += 22;    
+     OpenSSL generated keys get a nicer and usable listing.  */
   for (n=0, p=name; hexdigitp (p) && hexdigitp (p+1); p +=2, n++)
     ;
-  if (*p != '#' || !n)
+  if (!n)
     return NULL;
   buf = xtrymalloc (n+3);
   if (!buf)
     return NULL; /* oops, out of core */
   *buf = '<';
-  for (n=1, p=name; *p != '#'; p +=2, n++)
+  for (n=1, p=name; hexdigitp (p); p +=2, n++)
     buf[n] = xtoi_2 (p);
   buf[n++] = '>';
   buf[n] = 0;
-  return (char *)buf;
+  return (char*)buf;
 }
 
 

Modified: trunk/po/be.po  [not shown]
Modified: trunk/po/ca.po  [not shown]
Modified: trunk/po/cs.po  [not shown]
Modified: trunk/po/da.po  [not shown]
Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/el.po  [not shown]
Modified: trunk/po/eo.po  [not shown]
Modified: trunk/po/es.po  [not shown]
Modified: trunk/po/et.po  [not shown]
Modified: trunk/po/fi.po  [not shown]
Modified: trunk/po/fr.po  [not shown]
Modified: trunk/po/gl.po  [not shown]
Modified: trunk/po/hu.po  [not shown]
Modified: trunk/po/id.po  [not shown]
Modified: trunk/po/it.po  [not shown]
Modified: trunk/po/ja.po  [not shown]
Modified: trunk/po/nb.po  [not shown]
Modified: trunk/po/pl.po  [not shown]
Modified: trunk/po/pt.po  [not shown]
Modified: trunk/po/pt_BR.po  [not shown]
Modified: trunk/po/ro.po  [not shown]
Modified: trunk/po/ru.po  [not shown]
Modified: trunk/po/sk.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/po/tr.po  [not shown]
Modified: trunk/po/zh_CN.po  [not shown]
Modified: trunk/po/zh_TW.po  [not shown]
Modified: trunk/sm/certdump.c
===================================================================
--- trunk/sm/certdump.c	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/sm/certdump.c	2008-03-13 08:46:08 UTC (rev 4707)
@@ -890,14 +890,14 @@
   buffer = xtrymalloc (strlen (fpr) + 1 + 3*strlen (name) + 1);
   if (buffer)
     {
-      const unsigned char *s;
+      const char *s;
 
       p = stpcpy (stpcpy (buffer, fpr), " ");
       for (s = name; *s; s++)
         {
           if (*s < ' ')
             {
-              sprintf (p, "%%%02X", *s);
+              sprintf (p, "%%%02X", *(const unsigned char*)s);
               p += 3;
             }
           else
@@ -922,6 +922,7 @@
   const char *s;
   ksba_isotime_t t;
   char created[20];
+  char expires[20];
   char *sn;
   ksba_sexp_t sexp;
   char *orig_codeset;
@@ -935,22 +936,28 @@
   ksba_free (sexp);
 
   ksba_cert_get_validity (cert, 0, t);
-  if (t && *t)
+  if (*t)
     sprintf (created, "%.4s-%.2s-%.2s", t, t+4, t+6);
   else
     *created = 0;
+  ksba_cert_get_validity (cert, 1, t);
+  if (*t)
+    sprintf (expires, "%.4s-%.2s-%.2s", t, t+4, t+6);
+  else
+    *expires = 0;
 
   orig_codeset = i18n_switchto_utf8 ();
 
   rc = asprintf (&name,
                  _("Please enter the passphrase to unlock the"
-                   " secret key for:\n"
+                   " secret key for the X.509 certificate:\n"
                    "\"%s\"\n"
-                   "S/N %s, ID 0x%08lX, created %s" ),
+                   "S/N %s, ID 0x%08lX,\n"
+                   "created %s, expires %s.\n" ),
                  subject? subject:"?",
                  sn? sn: "?",
                  gpgsm_get_short_fingerprint (cert),
-                 created);
+                 created, expires);
 
   i18n_switchback (orig_codeset);
 

Modified: trunk/sm/keylist.c
===================================================================
--- trunk/sm/keylist.c	2008-03-07 19:08:31 UTC (rev 4706)
+++ trunk/sm/keylist.c	2008-03-13 08:46:08 UTC (rev 4707)
@@ -286,7 +286,7 @@
 
 
 /* Return an allocated string with the email address extracted from a
-   DN */
+   DN.  Note hat we use this code also in ../kbx/keybox-blob.c.  */
 static char *
 email_kludge (const char *name)
 {
@@ -311,7 +311,7 @@
 
   /* This looks pretty much like an email address in the subject's DN
      we use this to add an additional user ID entry.  This way,
-     openSSL generated keys get a nicer and usable listing */
+     OpenSSL generated keys get a nicer and usable listing.  */
   for (n=0, p=name; hexdigitp (p) && hexdigitp (p+1); p +=2, n++)
     ;
   if (!n)




More information about the Gnupg-commits mailing list