gpg: Fix export problem in case an old keyring has PGP-2 keys.
authorWerner Koch <wk@gnupg.org>
Fri, 19 Jun 2015 10:39:29 +0000 (12:39 +0200)
committerWerner Koch <wk@gnupg.org>
Fri, 19 Jun 2015 10:39:29 +0000 (12:39 +0200)
* g10/export.c (do_export_stream): Skip legacy keys.

Signed-off-by: Werner Koch <wk@gnupg.org>
g10/export.c

index b65fb8d..5050128 100644 (file)
@@ -851,19 +851,26 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
       kek = NULL;
     }
 
-  while (!(err = keydb_search (kdbhd, desc, ndesc, &descindex)))
+  for (;;)
     {
       int skip_until_subkey = 0;
       u32 keyid[2];
       PKT_public_key *pk;
 
+      err = keydb_search (kdbhd, desc, ndesc, &descindex);
       if (!users)
         desc[0].mode = KEYDB_SEARCH_MODE_NEXT;
+      if (gpg_err_code (err) == GPG_ERR_LEGACY_KEY)
+        continue;  /* Skip PGP2 keys.  */
+      if (err)
+        break;
 
       /* Read the keyblock. */
       release_kbnode (keyblock);
       keyblock = NULL;
       err = keydb_get_keyblock (kdbhd, &keyblock);
+      if (gpg_err_code (err) == GPG_ERR_LEGACY_KEY)
+        continue;  /* Skip PGP2 keys.  */
       if (err)
         {
           log_error (_("error reading keyblock: %s\n"), gpg_strerror (err));