On Tue, Apr 09, 2013 at 08:25:00PM -0700, Kevin J. McCarthy wrote:
I'm working on ticket 3564. The reporter is unable to use a particular key for encrypting an email. The essence of the problem is that the key's primary uid record has an empty User-ID field.The "gpg --list-keys" command returns no uid records, and the pub record has an empty User-ID field too. This is resulting in a pgp_key_t with no address records. Since "gpg --list-keys --with-colons" merges the primary uid and primary key record, I wonder if it would be okay to modify parse_pub_line() to *not* ignore an empty Field 10 for a pub record type. So basically the patch would be something like: case 10: /* name */ { - if (!pend || !*p) + if (!(pend && (*p || is_pub))) break; /* empty field or no trailing colon */ This would create an address record, recording the trust and flags, but with a null addr field. Can anyone think of an adverse effect from doing this? (I believe) this would at least allow the primary key to be selected and used for encryption.
I'm not familiar with that code, but your comment on the but report says that the gpgme driver can cope with it, so it's possible that the NULL addr field would be ok. You'd need to check where that struct gets used an ensure that the references to ->addr are protected by NONULL() if they are using to display to the user, otherwise you'll get a segmentation fault on the pointer dereference.
