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

Ludovic Courtès ludo at chbouib.org
Sun May 13 13:00:55 CEST 2007


Hi,

The patch below (against) `HEAD' fixes OpenPGP keyring import.  It
should also work for ASCII-armored keyrings, although I did not test it
since I did not have ASCII-armored keyrings at hand.  It also adds a
test for this so that we can catch it earlier next time.

Two issues with the test:

  1. For some reason, `check_id ()' doesn't work with the second ID
     that's commented in `keyring.c', although it should.  Actually, I
     have the exact same test in Scheme and that one works.  So there
     must be something fishy going on, but I couldn't find out what.

  2. There's a memory leak in `cdk_keydb_get_pk ()':

     3,466 (24 direct, 3,442 indirect) bytes in 2 blocks are definitely lost in loss record 4 of 4
        at 0x401D4B0: malloc (vg_replace_malloc.c:149)
        by 0x420C7F3: (within /usr/lib/libgcrypt.so.11.2.2)
        by 0x420CA60: gcry_malloc (in /usr/lib/libgcrypt.so.11.2.2)
        by 0x420CCDC: gcry_calloc (in /usr/lib/libgcrypt.so.11.2.2)
        by 0x402BBA5: cdk_calloc (main.c:163)
        by 0x402E33A: cdk_kbnode_new (kbnode.c:41)
        by 0x4030758: cdk_keydb_get_keyblock (keydb.c:1715)
        by 0x4031953: cdk_keydb_search (keydb.c:938)
        by 0x40325D7: cdk_keydb_get_pk (keydb.c:1268)
        by 0x4029878: gnutls_openpgp_keyring_check_id (extras.c:103)
        by 0x8048921: doit (keyring.c:163)
        by 0x8048B44: main (utils.c:148)

     Fixing it is left as an exercise to the reader.  :-)

     Also, for some unknown reason, Valgrind doesn't show the above leak
     when just run from `make check'.

Thanks,
Ludovic.

PS: BTW, how's Git going?  :-)


ChangeLog entry:

	* libextra/openpgp/extras.c (gnutls_openpgp_keyring_import):
	Fixed again, for raw keyring import (ASCII keyring import
	untested).

	* configure.in: Added `tests/openpgp/Makefile'.
	* tests/Makefile.am (SUBDIRS): Add `openpgp' when
	`ENABLE_OPENPGP' is true.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ,,keyring-import-2.diff
Type: text/x-patch
Size: 13230 bytes
Desc: The patch
URL: </pipermail/attachments/20070513/0dc51480/attachment.bin>


More information about the Gnutls-devel mailing list