[git] GPGME - branch, master, updated. gpgme-1.5.1-5-g4160ef9

by Werner Koch cvs at cvs.gnupg.org
Tue Aug 12 18:50:47 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  4160ef90a1b1b778c735f31f98a6966ba3b3ea90 (commit)
       via  3450bff52baef2c14118958cf79ead46940d58f0 (commit)
      from  488e44cdb531035fa8813b95b212f9728abc7e62 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4160ef90a1b1b778c735f31f98a6966ba3b3ea90
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Aug 12 10:36:30 2014 +0200

    gpgme-tool: Print fingerprint and keyid with keyservers.
    
    * src/gpgme-tool.c (cmd_keylist): Print keyid.  Print FPR only if
    available.

diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index e1fd983..d42179b 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -3305,7 +3305,9 @@ cmd_keylist (assuan_context_t ctx, char *line)
 	  while (subkey) {
 	    result_xml_tag_start (&state, "subkey", NULL);
 	    /* FIXME: more data */
-	    result_add_fpr (&state, "fpr", subkey->fpr);
+	    result_add_keyid (&state, "keyid", subkey->keyid);
+            if (subkey->fpr)
+              result_add_fpr (&state, "fpr", subkey->fpr);
             result_add_value (&state, "secret", subkey->secret);
             result_add_value (&state, "is_cardkey", subkey->is_cardkey);
             if (subkey->card_number)

commit 3450bff52baef2c14118958cf79ead46940d58f0
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Aug 12 10:36:30 2014 +0200

    Handle modern keyserver output which may emit the fingerprint.
    
    * src/engine-gpg.c (read_colon_line): Split preprocessed lines.
    (gpg_keylist_preprocess): Limit keyid field and print fingerprint.

diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 4df0f3e..8e18253 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1242,10 +1242,26 @@ read_colon_line (engine_gpg_t gpg)
 		    }
 
 		  assert (gpg->colon.fnc);
-		  gpg->colon.fnc (gpg->colon.fnc_value, line ? line : buffer);
-		  if (line)
-		    free (line);
-		}
+                  if (line)
+                    {
+                      char *linep = line;
+                      char *endp;
+
+                      do
+                        {
+                          endp = strchr (linep, '\n');
+                          if (endp)
+                            *endp++ = 0;
+                          gpg->colon.fnc (gpg->colon.fnc_value, linep);
+                          linep = endp;
+                        }
+                      while (linep && *linep);
+
+                      free (line);
+                    }
+                  else
+                    gpg->colon.fnc (gpg->colon.fnc_value, buffer);
+                }
 
 	      /* To reuse the buffer for the next line we have to
 		 shift the remaining data to the buffer start and
@@ -2071,6 +2087,7 @@ gpg_keylist_preprocess (char *line, char **r_line)
 #define NR_FIELDS 16
   char *field[NR_FIELDS];
   int fields = 0;
+  size_t n;
 
   *r_line = NULL;
 
@@ -2106,16 +2123,34 @@ gpg_keylist_preprocess (char *line, char **r_line)
 	 pub:<keyid>:<algo>:<keylen>:<creationdate>:<expirationdate>:<flags>
 
 	 as defined in 5.2. Machine Readable Indexes of the OpenPGP
-	 HTTP Keyserver Protocol (draft).
+	 HTTP Keyserver Protocol (draft).  Modern versions of the SKS
+	 keyserver return the fingerprint instead of the keyid.  We
+	 detect this here and use the v4 fingerprint format to convert
+	 it to a key id.
 
 	 We want:
 	 pub:o<flags>:<keylen>:<algo>:<keyid>:<creatdate>:<expdate>::::::::
       */
 
-      if (asprintf (r_line, "pub:o%s:%s:%s:%s:%s:%s::::::::",
-		    field[6], field[3], field[2], field[1],
-		    field[4], field[5]) < 0)
-	return gpg_error_from_syserror ();
+      n = strlen (field[1]);
+      if (n > 16)
+        {
+          if (asprintf (r_line,
+                        "pub:o%s:%s:%s:%s:%s:%s::::::::\n"
+                        "fpr:::::::::%s:",
+                        field[6], field[3], field[2], field[1] + n - 16,
+                        field[4], field[5], field[1]) < 0)
+            return gpg_error_from_syserror ();
+        }
+      else
+        {
+          if (asprintf (r_line,
+                        "pub:o%s:%s:%s:%s:%s:%s::::::::",
+                        field[6], field[3], field[2], field[1],
+                        field[4], field[5]) < 0)
+            return gpg_error_from_syserror ();
+        }
+
       return 0;
 
     case RT_UID:

-----------------------------------------------------------------------

Summary of changes:
 src/engine-gpg.c |   53 ++++++++++++++++++++++++++++++++++++++++++++---------
 src/gpgme-tool.c |    4 +++-
 2 files changed, 47 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list