{
pgp_uid_t *uid = NULL;
int field = 0, is_uid = 0;
+ int is_pub = 0;
char *pend, *p;
int trust = 0;
int flags = 0;
if ((pend = strchr (p, ':')))
*pend++ = 0;
field++;
- if (field > 1 && !*p)
+ if (!*p && (field != 1) && (field != 10))
continue;
switch (field)
dprint (2, (debugfile, "record type: %s\n", p));
if (!mutt_strcmp (p, "pub"))
- ;
+ is_pub = 1;
else if (!mutt_strcmp (p, "sub"))
*is_subkey = 1;
else if (!mutt_strcmp (p, "sec"))
break;
case 10: /* name */
{
- if (!pend || !*p)
- break; /* empty field or no trailing colon */
+ /* Empty field or no trailing colon.
+ * We allow an empty field for a pub record type because it is
+ * possible for a primary uid record to have an empty User-ID
+ * field. Without any address records, it is not possible to
+ * use the key in mutt.
+ */
+ if (!(pend && (*p || is_pub)))
+ break;
/* ignore user IDs on subkeys */
if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))