[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnutls-dev] [PATCH] Fixing OpenPGP keyring import (again)

From: Ludovic Courtès
Subject: Re: [gnutls-dev] [PATCH] Fixing OpenPGP keyring import (again)
Date: Mon, 14 May 2007 19:20:47 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> The issue now is that "gpg --export -a < ./keyring.gpg > ./keyring.asc"
> includes my own keyring (from `~/.gnupg/pubring.gpg') into its output.

I was able to work around it this way:

  $ gpg --keyring ./openpgp-keyring.gpg -a --export A7D93C3F CCC07C35 > t

(Where `openpgp-keyring.gpg' is the raw keyring we use in `keyring.c'.)

There's one last fix need for ASCII-import to work: `cdk_stream_close ()'
must not be called when `cdk_keydb_new_from_stream ()' succeeds
(patch attached).  I tested it (ASCII-import, followed by `check_id ()'
calls) from a Guile script and it does work with the patch applied
(segfaults otherwise).

BTW, you removed the repeated `if (err) { gnutls_assert () ... }' that
appeared in my patch.  I don't think this is a good idea: having
repeated `gnutls_assert ()' calls allows one to pinpoint the exact
source of a failure.

Also, please do update the `ChangeLog' file, it makes it easier to
follow what goes on.


--- orig/libextra/openpgp/extras.c
+++ mod/libextra/openpgp/extras.c
@@ -145,12 +145,19 @@ gnutls_openpgp_keyring_import (gnutls_op
       err = cdk_stream_tmp_from_mem (data->data, data->size, &input);
       if (!err)
-       err = cdk_stream_set_armor_flag (input, 0);
-      if (!err)
-       err = cdk_keydb_new_from_stream (&keyring->db, 0, input);
-      cdk_stream_close (input);
+       {
+         err = cdk_stream_set_armor_flag (input, 0);
+         if (err)
+           cdk_stream_close (input);
+         else
+           {
+             err = cdk_keydb_new_from_stream (&keyring->db, 0, input);
+             if (err)
+               cdk_stream_close (input);
+           }
+       }
   if (err)
     gnutls_assert ();
   return  _gnutls_map_cdk_rc (err);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]